Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// GM window to be shared patch
// 2011/01/31 id:Constellation
let gm = Components.classes[';1'];
if (gm) {
gm = gm.getService().wrappedJSObject;
let evalInSandbox = gm.evalInSandbox;
addAround(gm, 'injectScripts', function(proceed, args) {
let shared = args[2];
addAround(gm, 'evalInSandbox', function(proceed, args) {
let sandbox = args[1];
sandbox.sharedWindow = shared;
sandbox.__proto__ = shared;
args[0] = '(function(window, document) {\n' + args[0] + '\n})(sharedWindow, sharedWindow.document)';
return proceed(args);
let res = proceed(args);
gm.evalInSandbox = evalInSandbox;
return res;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.