/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
exports.DOMHelpers = { /** *Asimplewaytobenotified(once)whenawindowbecomes *interactive(DOMContentLoaded). * *ItisbasedonthechromeEventHandler.Thisisusefulwhen *chromeiframesareloadedincontentdocshells(inFirefox *tabsforexample). * *@paramnsIDOMWindowwin *Thecontentwindow,owningthedocumenttotraverse. *@paramFunctioncallback *Themethodtocallwhentheframeisloaded. *@paramStringtargetURL *(optional)CheckthattheframeURLcorrespondstotheprovidedURL *beforecallingthecallback.
*/
onceDOMReady(win, callback, targetURL) { if (!win) { thrownew Error("window can't be null or undefined");
} const docShell = win.docShell; const onReady = function (event) { if (event.target == win.document) {
docShell.chromeEventHandler.removeEventListener( "DOMContentLoaded",
onReady
); // If in `callback` the URL of the window is changed and a listener to DOMContentLoaded // is attached, the event we just received will be also be caught by the new listener. // We want to avoid that so we execute the callback in the next queue.
Services.tm.dispatchToMainThread(callback);
}
}; // The initial document is special in that, while uncommitted, its readyState // will already be "complete" even though the document is still loading. // It is either transient and will be replaced by a different document, // or it will be committed to and a load event will be fired for it. if (
(win.document.readyState == "complete" ||
win.document.readyState == "interactive") &&
win.location.href == targetURL &&
!win.document.isUncommittedInitialDocument
) {
Services.tm.dispatchToMainThread(callback);
} else {
docShell.chromeEventHandler.addEventListener("DOMContentLoaded", onReady);
}
},
};
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.