mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 790201. Nuke social worker sandbox on shutdown. r=mhammond
This commit is contained in:
parent
79030af494
commit
ad36389b3d
@ -77,7 +77,7 @@ function FrameWorker(url, name) {
|
||||
if (!doc.defaultView || doc.defaultView != self.frame.contentWindow) {
|
||||
return;
|
||||
}
|
||||
Services.obs.removeObserver(injectController, "document-element-inserted", false);
|
||||
Services.obs.removeObserver(injectController, "document-element-inserted");
|
||||
try {
|
||||
self.createSandbox();
|
||||
} catch (e) {
|
||||
@ -103,8 +103,11 @@ FrameWorker.prototype = {
|
||||
'location'];
|
||||
workerAPI.forEach(function(fn) {
|
||||
try {
|
||||
// XXX Need to unwrap for this to work - find out why!
|
||||
sandbox[fn] = XPCNativeWrapper.unwrap(workerWindow)[fn];
|
||||
sandbox[fn] = workerWindow[fn];
|
||||
// Bug 798660 - XHR has issues in a sandbox and need
|
||||
// to be unwrapped to work
|
||||
if (fn == "XMLHttpRequest")
|
||||
sandbox[fn] = XPCNativeWrapper.unwrap(workerWindow)[fn];
|
||||
}
|
||||
catch(e) {
|
||||
Cu.reportError("FrameWorker: failed to import API "+fn+"\n"+e+"\n");
|
||||
@ -153,8 +156,14 @@ FrameWorker.prototype = {
|
||||
workerWindow.addEventListener(t, l, c)
|
||||
};
|
||||
|
||||
// This is necessary to keep the sandbox alive
|
||||
this.sandbox = sandbox;
|
||||
|
||||
Services.obs.addObserver(function cleanupSandbox () {
|
||||
Services.obs.removeObserver(cleanupSandbox, "xpcom-shutdown");
|
||||
Cu.nukeSandbox(sandbox);
|
||||
}, "xpcom-shutdown", false);
|
||||
|
||||
let worker = this;
|
||||
|
||||
workerWindow.addEventListener("load", function loadListener() {
|
||||
@ -226,6 +235,8 @@ FrameWorker.prototype = {
|
||||
// now nuke the iframe itself and forget everything about this worker.
|
||||
this.frame.parentNode.removeChild(this.frame);
|
||||
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
||||
|
||||
Cu.nukeSandbox(this.sandbox);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user