mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1236452 - Fix DOMHelpers.onceDOMReady against already loaded documents. r=jryans
This commit is contained in:
parent
67993dab8c
commit
16bfcb7fa8
@ -356,7 +356,7 @@ Toolbox.prototype = {
|
||||
iframe.setAttribute("src", this._URL);
|
||||
iframe.setAttribute("aria-label", toolboxStrings("toolbox.label"));
|
||||
let domHelper = new DOMHelpers(iframe.contentWindow);
|
||||
domHelper.onceDOMReady(() => domReady.resolve());
|
||||
domHelper.onceDOMReady(() => domReady.resolve(), this._URL);
|
||||
// Optimization: fire up a few other things before waiting on
|
||||
// the iframe being ready (makes startup faster)
|
||||
|
||||
@ -365,7 +365,6 @@ Toolbox.prototype = {
|
||||
|
||||
// Attach the thread
|
||||
this._threadClient = yield attachThread(this);
|
||||
|
||||
yield domReady.promise;
|
||||
|
||||
this.isReady = true;
|
||||
|
@ -137,7 +137,7 @@ DOMHelpers.prototype = {
|
||||
* chrome iframes are loaded in content docshells (in Firefox
|
||||
* tabs for example).
|
||||
*/
|
||||
onceDOMReady: function Helpers_onLocationChange(callback) {
|
||||
onceDOMReady: function Helpers_onLocationChange(callback, targetURL) {
|
||||
let window = this.window;
|
||||
let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
@ -151,6 +151,12 @@ DOMHelpers.prototype = {
|
||||
Services.tm.mainThread.dispatch(callback, 0);
|
||||
}
|
||||
}
|
||||
docShell.chromeEventHandler.addEventListener("DOMContentLoaded", onReady, false);
|
||||
if ((window.document.readyState == "complete" ||
|
||||
window.document.readyState == "interactive") &&
|
||||
window.location.href == targetURL) {
|
||||
Services.tm.mainThread.dispatch(callback, 0);
|
||||
} else {
|
||||
docShell.chromeEventHandler.addEventListener("DOMContentLoaded", onReady, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user