Closed Bug 607535 Opened 15 years ago Closed 2 years ago

jstests - emulate shell evalcx in browser using Components.utils.evalInSandbox

Categories

(Core :: JavaScript Engine, enhancement)

enhancement

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: bc, Unassigned)

Details

bug 600137 comment 8 requested browser emulation of the shell only evalcx function for use in the jstests. 600137 comment 9 suggested Components.utils.evalInSandbox. <quote> The necessary code to implement evalcx could be placed in the top level browser.js script to provide the functionality. Is it possible to emulate evalcx <https://developer.mozilla.org/en/Introduction_to_the_JavaScript_shell#evalcx%28string.5b.2c_object.5d%29> using Components.utils.evalInSandbox <https://developer.mozilla.org/en/Components.utils.evalInSandbox> with sufficient fidelity? It will need privileges to invoke it however. Is there a different functionality that doesn't require elevated privileges? jmaher: what is the current strategy for dealing with the need for elevated privileges? </quote>
Note from js shell help('evalcx') how wacky this little helper is: Command Description ======= =========== evalcx(s[, o]) Evaluate s in optional sandbox object o if (s == '' && !o) return new o with eager standard classes if (s == 'lazy' && !o) return new o with lazy standard classes if (s == 'split' && !o) return new split-object o with lazy standard classes We'll want to find the tests using evalcx and fix their jstests.list entries to remove the skip-if(!xulRuntime.shell) prefixing. /be
from bug 600137 comment 11 <quote> Joel Maher (:jmaher) 2010-10-26 18:52:05 PDT reftest runs in chrome, so it doesn't need special powers. Assuming we ran it in content, we have the 'sandbox' which would effectively give a cache of data during load time which is accessible by the tests. For mochitests which are run in content and need privileges, we are looking at doing a special powers object: https://bugzilla.mozilla.org/show_bug.cgi?id=582472 </quote> jmaher: so all of the jstest browser.js stuff that is asking for privileges can go away as long as it is running in a reftest environment? mmmm.
jmaher replied in bug 600137 comment 11: "reftest runs in chrome, so it doesn't need special powers. Assuming we ran it in content, we have the 'sandbox' which would effectively give a cache of data during load time which is accessible by the tests. For mochitests which are run in content and need privileges, we are looking at doing a special powers object: https://bugzilla.mozilla.org/show_bug.cgi?id=582472" /be
It's deja vu all over again!
D'oh -- I plead sickness (kids' cold got me). Sorry! /be
Assignee: general → nobody
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.