mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-05-19 19:02:21 +02:00
parent
c5872ef5a1
commit
68fb7730b9
@ -2,16 +2,29 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
window.scope = {};
|
const require = function(){
|
||||||
function require(module){
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
window.scope = {};
|
||||||
|
const scope = window.scope;
|
||||||
|
function require(module){
|
||||||
if (module.startsWith("./")){
|
if (module.startsWith("./")){
|
||||||
var scopeName = module.substr(2).replace(/\..+/, "");
|
var scopeName = module.substr(2).replace(/\..+/, "");
|
||||||
return window.scope[scopeName];
|
return scope[scopeName];
|
||||||
}
|
}
|
||||||
else if (module === "sdk/getWrapped"){
|
else if (module === "sdk/getWrapped"){
|
||||||
return function getWrapped(obj){
|
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"){
|
else if (module === "sdk/simple-prefs"){
|
||||||
@ -29,6 +42,7 @@ function require(module){
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
throw new ReferenceError("Unable to get non relative module " + 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