зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 8ee18c517127 (bug 881590)
This commit is contained in:
Родитель
31bcad286f
Коммит
681391ee06
|
@ -294,8 +294,8 @@ function HiddenBrowser(width, height) {
|
|||
let doc = aFrame.document;
|
||||
this._browser = doc.createElementNS(XUL_NS, "browser");
|
||||
this._browser.setAttribute("type", "content");
|
||||
this._browser.setAttribute("src", NEWTAB_URL);
|
||||
doc.getElementById("win").appendChild(this._browser);
|
||||
this.preload();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -333,6 +333,16 @@ HiddenBrowser.prototype = {
|
|||
|
||||
observe: function () {
|
||||
this._timer = null;
|
||||
this.preload();
|
||||
},
|
||||
|
||||
preload: function () {
|
||||
if (!this._browser) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the browser has the right size.
|
||||
this.resize(this._width, this._height);
|
||||
|
||||
// Start pre-loading the new tab page.
|
||||
this._browser.loadURI(NEWTAB_URL);
|
||||
|
@ -383,10 +393,7 @@ let HostFrame = {
|
|||
},
|
||||
|
||||
destroy: function () {
|
||||
if (this._frame) {
|
||||
this._frame.remove();
|
||||
this._frame = null;
|
||||
}
|
||||
},
|
||||
|
||||
_create: function (callback) {
|
||||
|
@ -394,16 +401,17 @@ let HostFrame = {
|
|||
let iframe = doc.createElementNS(HTML_NS, "iframe");
|
||||
doc.documentElement.appendChild(iframe);
|
||||
|
||||
iframe.addEventListener("load", function onload() {
|
||||
iframe.removeEventListener("load", onload, true);
|
||||
|
||||
let frame = iframe.contentWindow;
|
||||
let docShell = frame.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDocShell);
|
||||
|
||||
docShell.createAboutBlankContentViewer(null);
|
||||
frame.location = XUL_PAGE;
|
||||
|
||||
iframe.addEventListener("load", function onload() {
|
||||
iframe.removeEventListener("load", onload, true);
|
||||
let eventHandler = docShell.chromeEventHandler;
|
||||
eventHandler.addEventListener("DOMContentLoaded", function onLoad() {
|
||||
eventHandler.removeEventListener("DOMContentLoaded", onLoad, false);
|
||||
callback(HostFrame._frame = frame);
|
||||
}, true);
|
||||
}, true);
|
||||
}, false);
|
||||
}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче