From 389adefef9ba1ffa45aa7d68d15c108b7f0cd5ca Mon Sep 17 00:00:00 2001 From: kkapsner Date: Tue, 13 Dec 2016 23:07:56 +0100 Subject: [PATCH] Changed the gathering of the require function in the frame script. Fixes #94. --- data/frame.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/data/frame.js b/data/frame.js index 64c2c9a..1b94526 100644 --- a/data/frame.js +++ b/data/frame.js @@ -4,10 +4,28 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ (function(){ "use strict"; - const {utils: Cu} = Components; - const COMMONJS_URI = "resource://gre/modules/commonjs"; - const {require} = Cu.import(COMMONJS_URI + "/toolkit/require.js", {}); + var chrome = { + Cc: Components.classes, + Ci: Components.interfaces, + Cm: Components.manager, + Cr: Components.results, + Cu: Components.utils, + CC: Components.Constructor, + components: Components, + ChromeWorker: undefined + }; + const { Loader, Require, unload, Module} = Components.utils.import('resource://gre/modules/commonjs/toolkit/loader.js'); + var loader = Loader({ + paths: { + "": "resource://gre/modules/commonjs/" + }, + modules: { + "chrome": chrome + } + }); + var requirer = Module("resource://canvasblocker-at-kkapsner-dot-de/data/frame.js", "./data/frame.js"); + var require = Require(loader, requirer); const {intercept} = require("../lib/intercept.js"); const {ask} = require("../lib/askForPermission.js");