I am writing a Firefox extension,
this is my XUL (no problem) < / P>
& lt ;? XML version = "1.0" encoding = "ISO-885 9-1"? & Gt; & Lt ;! DOCTYPE Overlay System "Chrome: //locale/myDtd.dtd" & gt; & Lt; Page id = "overlay" xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns: xhtml = "http://www.w3.org/1999/XHtml" & Gt; & Lt; Script type = "app / x-javascript" src = "chrome: //addon/content/test.js" /> & Lt; / Page & gt; And here is the problematic part of javascript test.js
window.addEventListener ("load", function (event) {var appcontent = window .document .getElementById ("Appetizer"); App Containant.AdventListener ("Load", Envant Load, True);}, True); The second 'load' listener on the appentant is very slow for my needs DOM loading when 'load' event has started.
My question: Does anyone know that as soon as a document is loading (first load event of the domain)? (An on-one lock or an on-raststart event is present) In the Chrome extension, we can use "run_at": "document_start" in 'manifest.json', and in the Safari extension , We can use 'script start' extensions builder but in Firefox ... I do not know how to do the same trick
I need this so that they can see the elements in the DOM only when they come (but this is another story).
I appreciate any help, thanks!
Here's a good explanation:
Suggestions The solution is dependent on the Firefox Supervisor and http-on-modify-request:
Components.classes ["@ mozilla.org / supervisor service; 1"] .getService (Components.interfaces.nsIObserverService) .addObserver ({Inspection: Function (A Topic, Atopic, Edata) {If ("http-on-modify-request" == aTopic) {var url = a topic .QueryInterface (Components.interfaces.nsIHttpChannel) .originalURI.spec ; If (URL & url.match ('facebook')) {aSubject.cancel (Compo nents.results.NS_BINDING_SUCCEEDED);}}}}, "Http-on-modify-request", Incorrect);
Comments
Post a Comment