Platform/JS Compartments Mochitest: Difference between revisions

Jump to navigation Jump to search
Line 169: Line 169:
35 failing tests out of 13605, in these files:
35 failing tests out of 13605, in these files:


<pre>
chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_evalInSandbox.xul
chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_cows.xul
chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_evalInSandbox.xul
  -> add a function that the sandbox can call which forwards to getClassName
  -> add a function that the sandbox can call which forwards to getClassName
chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/test_wrappers-2.xul
  -> enumeration?
</pre>


The first problem in test_cows.xul is simply that the error message isn't what's expected. I tried fixing this by calling DoThrowException, just like the existing XPCChromeObjectWrapper code did -- but strangely this caused the exception not to be readable at all. I can see why why the exception thrown by DoThrowException would be rewrapped so that the caller couldn't read it, but I don't understand why exceptions thrown by JS_ReportError aren't affected in the same way. --jto, 10/4/2010
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
-> enumeration?
 
Looking at this one next.
 
-jorendorff, 10/5/2010


= Browserchrome =
= Browserchrome =
638

edits

Navigation menu