Platform/JS Compartments Mochitest: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
(13 intermediate revisions by 2 users not shown)
Line 48: Line 48:
= Mochitest =
= Mochitest =


Run with <code>python runtests.py --total-chunks=20 --this-chunk=n --autorun --debugger=gdb</code> where <code>n</code> is the chunk you want to examine.
Pass.


== Remaining large-ish items ==
== Remaining large-ish items ==
Line 55: Line 55:
* document.domain (we currently don't revoke access to the document's original domain, we probably should do that).
* document.domain (we currently don't revoke access to the document's original domain, we probably should do that).
* Error hacks?
* Error hacks?
* XPCSafeJSObjectWrapper::WrapObject() fails<br>    -> remove XPCSafeJSObjectWrapper
* Fix error messages for property access denied. Old message included two origins, new one doesn't, and it looks like we're not using any of the localization that the old message had. Error console should show both origins, exception message probably (?) shouldn't.
* Fix error messages for property access denied. Old message included two origins, new one doesn't, and it looks like we're not using any of the localization that the old message had. Error console should show both origins, exception message probably (?) shouldn't.
* Confirm that the fix in docshell/test/chrome/test_bug454235.xul is appropriate.
* Confirm that the fix in docshell/test/chrome/test_bug454235.xul is appropriate.
Line 76: Line 75:


<pre>
<pre>
http://mochi.test:8888/tests/js/src/xpconnect/tests/mochitest/test_bug517163.html (jst is fixing the test)
http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/test_postMessage_joined.html
http://mochi.test:8888/tests/layout/forms/test/test_bug536567.html
http://mochi.test:8888/tests/toolkit/components/microformats/tests/test_Microformats.html
http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/test_basic_form_1pw.html
http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/test_basic_form_2pw_1.html
http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/test_prompt.html
</pre>
</pre>


Line 88: Line 80:


<pre>
<pre>
http://mochi.test:8888/tests/toolkit/components/microformats/tests/test_Microformats_add.html
</pre>
</pre>
== Chunk 1 ==
pass, 22848 tests
== Chunk 2 ==
pass, 11244 tests:
== Chunk 3 ==
pass, 14532 tests
== Chunk 4 ==
passed, 19311 tests
* test_play_twice.html is notoriously rando-orange, see {{bug|558812}} and {{bug|573232}}
== Chunk 5 ==
pass, 4977 tests
== Chunk 6 ==
pass, 4825 tests
== Chunk 7 ==
pass, 194 tests
== Chunk 8 ==
pass, 346 tests
== Chunk 9 ==
pass, 159 tests
== Chunk 10 ==
pass, 396 tests
== Chunk 11 ==
pass, 234 tests
== Chunk 12 ==
pass, 396 tests
== Chunk 13 ==
pass, 458 tests
== Chunk 14 ==
pass, 482 tests
== Chunk 15 ==
pass, 491 tests
== Chunk 16 ==
pass, 7163 tests
== Chunk 17 ==
pass, 573 tests (sloooooooooow to run)
== Chunk 18 ==
pass, 5073 tests
== Chunk 19 ==
pass, 89415 tests
* bent: I fixed test_pluginstream_newstream.html so that it will work, but the underlying cause is a change in our access denied exception messages, which needs to get fixed. Followup bug?
== Chunk 20 ==
pass, 17909 tests


= Mochichrome =
= Mochichrome =


13 failing tests out of 14051, in these files:
<pre>
 
</pre>
chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_evalInSandbox.xul
-> add a function that the sandbox can call which forwards to getClassName
 
No idea what that comment about getClassName means.  What is happening here is that the test is using exactly the same technique GreaseMonkey uses to set up the sandbox, and that doesn't work anymore.
 
The specific issue is with code that does <code>sandbox.__proto__ = new XPCNativeWrapper(window);</code> where the caller is chrome, but ''sandbox'' and ''window'' are same-domain. When we rewrap the XPCNativeWrapper, it becomes a simple cross-compartment wrapper without X-ray behavior.
 
The whole rewrapping mechanism works as designed right up to WrapperFactory::Rewrap where it's actually time to create the new wrapper. We have a ''flags'' parameter that indicates we want X-ray behavior. But we create a wrapper without it.
 
We could just make that work, but mrbkap thinks we should instead provide a better sandboxing API and require GreaseMonkey (and any similar extensions) to switch to that.
 
-jorendorff, 10/5/2010


  chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul
  chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul
Line 213: Line 109:
  7269 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | iwin.eval does not throw an exception
  7269 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | iwin.eval does not throw an exception


iwin.eval("'PASS'") must not throw an exception. But it is throwing.
iwin.eval("'PASS'") is supposed to succeed, but iwin.eval is undefined.
 
iwin.eval is undefined.


  7271 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | Unable to wrap a primitive, even without 'new'
  7271 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | Unable to wrap a primitive, even without 'new'
Line 223: Line 117:


  7276 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | XPCNativeWrappers allow expandos through
  7276 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | XPCNativeWrappers allow expandos through
7284 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | delete doesn't delete underlying properties - got undefined, expected 5
     let iwin = $('ifr').contentWindow;
     let iwin = $('ifr').contentWindow;
     let (w = new XPCNativeWrapper($('ifr').contentWindow)) {
     let (w = new XPCNativeWrapper($('ifr').contentWindow)) {
         w.foopybar = 5;
         w.foopybar = 5;
         ok(!("foopybar" in iwin), "XPCNativeWrappers allow expandos through");
         ok(!("foopybar" in iwin), "XPCNativeWrappers allow expandos through");
        ...
XPCNativeWrappers must not allow expandos through. But they do.
7284 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | delete doesn't delete underlying properties - got undefined, expected 5
    let iwin = $('ifr').contentWindow;
    let (w = new XPCNativeWrapper($('ifr').contentWindow)) {
         ...
         ...
         iwin.foopy = 5;
         iwin.foopy = 5;
Line 239: Line 127:
         is(iwin.foopy, 5, "delete doesn't delete underlying properties");
         is(iwin.foopy, 5, "delete doesn't delete underlying properties");


Again, an XPCNativeWrapper must not allow chrome to delete expando
We create an explicit XPCNativeWrapper ''w'' around ''iwin'', a wrapper of an outer window. Expandos of ''w'' must not affect ''iwin'' and vice versa.
properties. I'm not sure why we don't want to allow that, but we're allowing
 
it.
I think the basic story here is "there are no same-compartment X-ray wrappers".  


  7288 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | allowed to update iwin.__proto__ to null - got [], expected null
  7288 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | allowed to update iwin.__proto__ to null - got [], expected null
Line 253: Line 141:


-jorendorff, 10/5/2010
-jorendorff, 10/5/2010
I am also getting these failures:
7353 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/layout/base/test/chrome/test_printpreview.xul | Timers should have run! - didn't expect "0 timers", but got it
7354 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/layout/base/test/chrome/test_printpreview.xul | Timers should have run! - didn't expect 0, but got it


= Browserchrome =
= Browserchrome =


Failures:
Pass.
 
<pre>
chrome://mochikit/content/browser/toolkit/components/console/hudservice/tests/browser/browser_webconsole_netlogging.js
chrome://mochikit/content/browser/browser/components/sessionstore/test/browser/browser_461743.js
chrome://mochikit/content/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowser_newwindow_stopcmd.js
chrome://mochikit/content/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_forgetthissite.js
chrome://mochikit/content/browser/browser/components/preferences/tests/browser/browser_privacypane_1.js
chrome://mochikit/content/browser/browser/components/places/tests/browser/browser_sidebarpanels_click.js
chrome://mochikit/content/browser/browser/components/places/tests/browser/browser_library_middleclick.js
</pre>


= make check =
= make check =


Passes
Pass.


= make jstestbrowser (jsreftest) =
= make jstestbrowser (jsreftest) =


We're seeing this consistently on debug builds on try.
Pass.
 
<pre>
TEST-UNEXPECTED-FAIL | js1_8/regress/regress-464418.js | application timed out after 330 seconds with no output
</pre>

Latest revision as of 02:10, 14 October 2010

This page is a tracking page for getting the JS compartments work to pass xpcshell tests and Mochitests and other automated test suites.

How to get the patch queue

Install hg queues.

Then add to .hg/patches/.hg/hgrc

[paths]

default = http://hg.mozilla.org/users/mrbkap_mozilla.com/brain-transplants

Then go into .hg/patches and hg pull, hg up and then go back to ../../ and do hg qpush -a. Build. Every time we update the queue you have to do qpop -a in the repository, then pull and update the patch queue, and then go back and do qpush -a to get the patches applied again.

Known issues still being worked on

QA

Started build for QA to test.

Fixed:

  • Adblock doesn't seem to filter (tries to call a function on undefined).
  • Adblock crashes.

xpcshell

default compartment leaks

todo

done

bug 599761 (_newJSDContext)

bug 599762 (js::ctypes::CClosure::ClosureStub)

bug 600022 (XPCShellEnvironment::Init())

bug 600032 (JetpackChild::Init())

bug 600173 (atoms should always be in the default compartment)

bug 600580 (_newJSDContext, part 2)

bug 600402 (don't copy strings for the same compartment)

Mochitest

Pass.

Remaining large-ish items

Post b7:

  • document.domain (we currently don't revoke access to the document's original domain, we probably should do that).
  • Error hacks?
  • Fix error messages for property access denied. Old message included two origins, new one doesn't, and it looks like we're not using any of the localization that the old message had. Error console should show both origins, exception message probably (?) shouldn't.
  • Confirm that the fix in docshell/test/chrome/test_bug454235.xul is appropriate.
  • We no longer support .wrappedJSObject on location and XMLHttpRequest. Confirm that it was ok to remove those from tests/js/src/xpconnect/tests/mochitest/test_bug553407.html.

FIXED issues:

  • I allow named frames to be created on xray wrappers so parent[name] works.
  • Fix up XrayWrappers
  • Make chrome wrappers expose nothing by default
  • added scriptOnly check to chrome object and make all XOWs script only
  • Location object
  • nsJSContext::BindCompiledEventHandler(), target and funobj from
  • Components.utils.import() from non-chrome code.
  • DocShell navigation tests
  • XPCNativeWrapper.unwrap() different compartments
  • IndexedDB and DOM worker tests, need cross compartment structured clone (jorendorff/bent)
  • XPCNW holder objects vs JS_ClearScope()

Remaining test failures


Asserts to death:


Mochichrome


chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul

Lots of different issues:

7257 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | enumeration over XOWs walks the prototype chain - got "host,hostname,port", expected "assign,foopy,hash,host,hostname,href,pathname,port,protocol,reload,replace,search"

Enumeration bug. "for (e in location)" doesn't walk the prototype chain.

7259 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | wrapper iterators are properly iterators - got "object", expected "function,function,function,number,string,string,string,string,string,string,string,string"

Enumeration bug. "Iterator(new XPCNativeWrapper(location))" is busted. I will look into this further.

7261 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | enumeration over SJOWs walks the prototype chain and works over XOWs - got "", expected "assign,foopy,hash,host,hostname,href,pathname,port,protocol,reload,replace,search"

Enumeration bug. Same kind of problem but here we're trying to iterate over iwin.wrappedObject.location.

7268 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | cyclic proto value allowed

We do iwin.__proto__ = iwin and expect it to fail, but this just creates a new ordinary data property called __proto__ on the holder.

7269 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | iwin.eval does not throw an exception

iwin.eval("'PASS'") is supposed to succeed, but iwin.eval is undefined.

7271 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | Unable to wrap a primitive, even without 'new'

An old feature we didn't retain. XPCNativeWrapper("") is expected to return "". Maybe we can just remove the test.

7276 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | XPCNativeWrappers allow expandos through
7284 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | delete doesn't delete underlying properties - got undefined, expected 5
   let iwin = $('ifr').contentWindow;
   let (w = new XPCNativeWrapper($('ifr').contentWindow)) {
       w.foopybar = 5;
       ok(!("foopybar" in iwin), "XPCNativeWrappers allow expandos through");
       ...
       iwin.foopy = 5;
       ok(delete w.foopy, "delete returns true");
       is(iwin.foopy, 5, "delete doesn't delete underlying properties");

We create an explicit XPCNativeWrapper w around iwin, a wrapper of an outer window. Expandos of w must not affect iwin and vice versa.

I think the basic story here is "there are no same-compartment X-ray wrappers".

7288 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul | allowed to update iwin.__proto__ to null - got [], expected null

Possibly just noise. If I comment out the cyclic-__proto__ test, this one passes.

But I can't imagine why iwin.__proto__ appears to be [] here. I looked, and the value we eventually return is a cross-compartment XrayWrapper of an OuterWindowProxy. The value should be null.

-jorendorff, 10/5/2010

Browserchrome

Pass.

make check

Pass.

make jstestbrowser (jsreftest)

Pass.