Bug 870101 - Make BackgroundPageThumbs load about:blank after capturing windows so that they're eventually collected. r=markh

This commit is contained in:
Drew Willcoxon 2013-07-03 17:44:38 -07:00
Родитель b5a902e5a8
Коммит 68a6a0964e
1 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -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);