Skip to content

Commit

Permalink
GM_{Tombloo, Tombfix}: Fix support for Greasemonkey to#23
Browse files Browse the repository at this point in the history
* Fix a bug that can't access GM_{Tombloo, Tombfix} from User Script on Greasemonkey

Close to#23
  • Loading branch information
syoichi committed Dec 17, 2014
1 parent f0551c0 commit 17add4a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions xpi/components/tombfix.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,17 @@
let gmService = Cc['@greasemonkey.mozdev.org/greasemonkey-service;1'];

if (gmService) {
let gm = gmService.getService().wrappedJSObject;
let gmGlobal = Cu.getGlobalForObject(
gmService.getService().wrappedJSObject
);

env.addAround(gmGlobal, 'createSandbox', (proceed, args) => {
var sandbox = proceed(args);

env.addBefore(gm, 'evalInSandbox', function createGMAPI(...args) {
for (let arg of args) {
if (typeof arg === 'object') {
arg.GM_Tombloo = GM_Tombloo;
arg.GM_Tombfix = GM_Tombfix;
sandbox.GM_Tombloo = GM_Tombloo;
sandbox.GM_Tombfix = GM_Tombfix;

return;
}
}
return sandbox;
});
}
}
Expand Down

0 comments on commit 17add4a

Please sign in to comment.