window.js: Ensure that window_initialize_late_hook is run before other "late" hooks
authorJeremy Maitin-Shepard <jeremy@jeremyms.com>
Sun, 10 Feb 2013 01:13:18 +0000 (9 17:13 -0800)
committerJeremy Maitin-Shepard <jeremy@jeremyms.com>
Sun, 10 Feb 2013 01:13:18 +0000 (9 17:13 -0800)
By itself, this doesn't fix anything, but it makes more sense and may
allow for a more robust scrollbar fix.

modules/window.js

index 1837e61..77fcbcb 100644 (file)
@@ -203,18 +203,24 @@ function window_initialize (window) {
                                 return this.buffers.current.browser.contentWindow;
                             });
 
-    window_initialize_early_hook.run(window);
-    delete window.window_initialize_early_hook; // used only once
-
-    window_initialize_hook.run(window);
-    delete window.window_initialize_hook; // used only once
+    // Tell Mozilla the window_initialize_late_hook to run after a timeout
 
+    // Do this here, before doing the rest of the window
+    // initialization, so that window_initialize_late_hook will be run
+    // prior to any other "late" hooks set up by other modules in a
+    // function registered in window_initialize{_early,}_hook.
     window.setTimeout(function () {
             window_initialize_late_hook.run(window);
             delete window.window_initialize_late_hook; // used only once
             delete window.args; // get rid of args
         }, 0);
 
+    window_initialize_early_hook.run(window);
+    delete window.window_initialize_early_hook; // used only once
+
+    window_initialize_hook.run(window);
+    delete window.window_initialize_hook; // used only once
+
     window.addEventListener("close",
                             function (event) {
                                 event.preventDefault();