Thrawn wrote:Is there a specific problem with surrogates running as chrome://?
There isn't any yet that I know so far, it's just that I took notice of it, knowing that surrogates in NS, as far as I can tell, were created to workaround breakages in webpages where scripts are blocked. So I find it unsual that surrogates should also be running inside internal URIs if it does nothing there, assuming it does nothing, and not to mention it is an unecessary use of memory resource.
Actually I was trying to reliably replicate a possible memory leak manifested via ghost windows/zombie compartments while running NS and Ghostery together apparently, even after creating a new profile with just the two aforementioned addons. And I thought to ask about why surrogates are running inside internal URIs as well.
Thrawn wrote:What sandboxing are you referring to?
Code: Select all
chrome://noscript/content/ScriptSurrogate.js:
_sandboxParams: {
wantXrays: false,
sandboxName: ""
},
executeSandbox: function(document, scriptBlock, env) {
var w = document.defaultView;
try {
if (typeof w.wrappedJSObject === "object") w = w.wrappedJSObject;
this._sandboxParams.sandboxName = "NoScript::ScriptSurrogate@" + document.URL;
this._sandboxParams.sandboxPrototype = w;
let s = new Cu.Sandbox(w, this._sandboxParams); // <---- Line 244 ----<< //
if (!("top" in s)) s.__proto__ = w;
if (typeof env !== "undefined") {
s.env = env;
let ep = {};
for (let p in env) {
ep[p] = "rw";
}
env.__exposedProps__ = ep;
}
let code = "with(window){" + scriptBlock + "}delete this.env;";
if ("keys" in Object) code += "for each(let p in Object.keys(this))window[p]=this[p];";
Cu.evalInSandbox(code, s, this.JS_VERSION);
} catch (e) {
if (ns.consoleDump) {
ns.dump(e);
ns.dump(scriptBlock);
}
if (this.debug) Cu.reportError(e);
} finally {
delete this._sandboxParams.sandboxPrototype;
}
},