Created
December 4, 2012 19:55
-
-
Save AutomatedTester/4208010 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var window = gBrowser.selectedBrowser.contentWindow; | |
| var doc = window.document; | |
| var sandbox = new Components.utils.Sandbox(window); | |
| sandbox.window = window; | |
| sandbox.document = doc.wrappedJSObject ? doc.wrappedJSObject : doc; | |
| sandbox.navigator = window.navigator; | |
| sandbox.__webdriverParams = [{"foo": "bar", "goo":[1,2]}]; | |
| try { | |
| var scriptSrc = 'with(window) { ' + | |
| ' var __webdriverFunc = function(){ ' + | |
| ' return arguments[0].foo;' + | |
| '};' + | |
| '__webdriverFunc.apply(null, __webdriverParams); }'; | |
| Components.utils.evalInSandbox(scriptSrc, sandbox); | |
| } catch (e) { | |
| throw e | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment