Created
October 12, 2011 09:00
-
-
Save eagletmt/1280704 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
diff --git a/components/greasemonkey.js b/components/greasemonkey.js | |
index 121f661..b199425 100644 | |
--- a/components/greasemonkey.js | |
+++ b/components/greasemonkey.js | |
@@ -67,7 +67,7 @@ function GM_apiLeakCheck(apiName) { | |
} | |
function createSandbox( | |
- aScript, aContentWin, aChromeWin, aFirebugConsole, aUrl | |
+ aScript, aContentWin, aChromeWin, aFirebugConsole, aUrl, aSharedWin | |
) { | |
var unsafeWin = aContentWin.wrappedJSObject; | |
var sandbox = new Components.utils.Sandbox(aContentWin); | |
@@ -78,6 +78,7 @@ function createSandbox( | |
sandbox.document = aContentWin.document; | |
} | |
+ sandbox.window = aSharedWin; | |
sandbox.__proto__ = aContentWin; | |
sandbox.unsafeWindow = unsafeWin; | |
sandbox.XPathResult = Ci.nsIDOMXPathResult; | |
@@ -429,10 +430,13 @@ service.prototype.injectScripts = function( | |
scripts, url, wrappedContentWin, chromeWin | |
) { | |
var firebugConsole = getFirebugConsole(wrappedContentWin, chromeWin); | |
+ var sharedWin = {}; | |
+ sharedWin.window = sharedWin; | |
+ sharedWin.__proto__ = wrappedContentWin; | |
for (var i = 0, script = null; script = scripts[i]; i++) { | |
var sandbox = createSandbox( | |
- script, wrappedContentWin, chromeWin, firebugConsole, url); | |
+ script, wrappedContentWin, chromeWin, firebugConsole, url, sharedWin); | |
var requires = []; | |
var offsets = []; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment