Firefox: fix script injection

pull/2/head
Deathamns 10 years ago committed by gorhill
parent d66b8aa329
commit 0579c1bcaa

@ -114,17 +114,6 @@ let contentPolicy = {
let docObserver = { let docObserver = {
contentBaseURI: 'chrome://' + appName + '/content/', contentBaseURI: 'chrome://' + appName + '/content/',
injectScript: function(script, evalCode) {
if (evalCode) {
Components.utils.evalInSandbox(script, this);
return;
}
Services.scriptloader.loadSubScript(
docObserver.contentBaseURI + script,
this
);
},
initContext: function(win, sandbox) { initContext: function(win, sandbox) {
let messager = getMessager(win); let messager = getMessager(win);
@ -137,10 +126,20 @@ let docObserver = {
win.self = win; win.self = win;
Components.utils.exportFunction( // anonymous function needs to be used here
this.injectScript, win.injectScript = Components.utils.exportFunction(
win, function(script, evalCode) {
{defineAs: 'injectScript'} if (evalCode) {
Components.utils.evalInSandbox(script, win);
return;
}
Services.scriptloader.loadSubScript(
docObserver.contentBaseURI + script,
win
);
},
win
); );
} }

Loading…
Cancel
Save