зеркало из https://github.com/mozilla/gecko-dev.git
Bug 870101 - Make BackgroundPageThumbs load about:blank after capturing windows so that they're eventually collected. r=markh
This commit is contained in:
Родитель
b5a902e5a8
Коммит
68a6a0964e
|
@ -21,9 +21,6 @@ const backgroundPageThumbsContent = {
|
|||
docShell.allowMedia = false;
|
||||
docShell.allowPlugins = false;
|
||||
|
||||
// Stop about:blank from loading. If it finishes loading after a capture
|
||||
// request is received, it could trigger the capture's load listener.
|
||||
this._webNav.stop(Ci.nsIWebNavigation.STOP_NETWORK);
|
||||
addMessageListener("BackgroundPageThumbs:capture",
|
||||
this._onCapture.bind(this));
|
||||
},
|
||||
|
@ -33,10 +30,9 @@ const backgroundPageThumbsContent = {
|
|||
},
|
||||
|
||||
_onCapture: function (msg) {
|
||||
if (this._onLoad) {
|
||||
this._webNav.stop(Ci.nsIWebNavigation.STOP_NETWORK);
|
||||
this._webNav.stop(Ci.nsIWebNavigation.STOP_NETWORK);
|
||||
if (this._onLoad)
|
||||
removeEventListener("load", this._onLoad, true);
|
||||
}
|
||||
|
||||
this._onLoad = function onLoad(event) {
|
||||
if (event.target != content.document)
|
||||
|
@ -58,6 +54,11 @@ const backgroundPageThumbsContent = {
|
|||
});
|
||||
};
|
||||
canvas.toBlob(blob => fileReader.readAsArrayBuffer(blob));
|
||||
|
||||
// Load about:blank to cause the captured window to be collected...
|
||||
// eventually.
|
||||
this._webNav.loadURI("about:blank", Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
|
||||
null, null, null);
|
||||
}.bind(this);
|
||||
|
||||
addEventListener("load", this._onLoad, true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче