mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-18 09:28:52 +01:00
parent
c5872ef5a1
commit
68fb7730b9
@ -2,16 +2,29 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
window.scope = {};
|
||||
function require(module){
|
||||
const require = function(){
|
||||
"use strict";
|
||||
window.scope = {};
|
||||
const scope = window.scope;
|
||||
function require(module){
|
||||
if (module.startsWith("./")){
|
||||
var scopeName = module.substr(2).replace(/\..+/, "");
|
||||
return window.scope[scopeName];
|
||||
return scope[scopeName];
|
||||
}
|
||||
else if (module === "sdk/getWrapped"){
|
||||
return function getWrapped(obj){
|
||||
return obj.wrappedJSObject || obj;
|
||||
if (!obj){
|
||||
return obj;
|
||||
}
|
||||
var wrapped;
|
||||
try {
|
||||
wrapped = obj.wrappedJSObject || obj;
|
||||
}
|
||||
catch (e){
|
||||
require("./logging").error("getWrapped failed for", obj, ":", e);
|
||||
wrapped = obj;
|
||||
}
|
||||
return wrapped;
|
||||
};
|
||||
}
|
||||
else if (module === "sdk/simple-prefs"){
|
||||
@ -31,4 +44,5 @@ function require(module){
|
||||
throw new ReferenceError("Unable to get non relative module " + module + "!");
|
||||
}
|
||||
|
||||
window.scope.require = require;
|
||||
return require;
|
||||
}();
|
Loading…
x
Reference in New Issue
Block a user