layout/tools/reftest/bootstrap.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 Components.utils.import("resource://gre/modules/FileUtils.jsm");
michael@0 2
michael@0 3 function loadIntoWindow(window) {}
michael@0 4 function unloadFromWindow(window) {}
michael@0 5
michael@0 6 function setDefaultPrefs() {
michael@0 7 // This code sets the preferences for extension-based reftest.
michael@0 8 var prefs = Components.classes["@mozilla.org/preferences-service;1"].
michael@0 9 getService(Components.interfaces.nsIPrefService);
michael@0 10 var branch = prefs.getDefaultBranch("");
michael@0 11
michael@0 12 #include reftest-preferences.js
michael@0 13 }
michael@0 14
michael@0 15 var windowListener = {
michael@0 16 onOpenWindow: function(aWindow) {
michael@0 17 let domWindow = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowInternal || Components.interfaces.nsIDOMWindow);
michael@0 18 domWindow.addEventListener("load", function() {
michael@0 19 domWindow.removeEventListener("load", arguments.callee, false);
michael@0 20
michael@0 21 let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
michael@0 22
michael@0 23 // Load into any existing windows
michael@0 24 let enumerator = wm.getEnumerator("navigator:browser");
michael@0 25 while (enumerator.hasMoreElements()) {
michael@0 26 let win = enumerator.getNext().QueryInterface(Components.interfaces.nsIDOMWindow);
michael@0 27 setDefaultPrefs();
michael@0 28 Components.utils.import("chrome://reftest/content/reftest.jsm");
michael@0 29 win.addEventListener("pageshow", function() {
michael@0 30 win.removeEventListener("pageshow", arguments.callee);
michael@0 31 // We add a setTimeout here because windows.innerWidth/Height are not set yet;
michael@0 32 win.setTimeout(function () {OnRefTestLoad(win);}, 0);
michael@0 33 });
michael@0 34 break;
michael@0 35 }
michael@0 36 }, false);
michael@0 37 },
michael@0 38 onCloseWindow: function(aWindow){ },
michael@0 39 onWindowTitleChange: function(){ },
michael@0 40 };
michael@0 41
michael@0 42 function startup(aData, aReason) {
michael@0 43 let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
michael@0 44 getService (Components.interfaces.nsIWindowMediator);
michael@0 45
michael@0 46 Components.manager.addBootstrappedManifestLocation(aData.installPath);
michael@0 47
michael@0 48 // Load into any new windows
michael@0 49 wm.addListener(windowListener);
michael@0 50 }
michael@0 51
michael@0 52 function shutdown(aData, aReason) {
michael@0 53 // When the application is shutting down we normally don't have to clean up any UI changes
michael@0 54 if (aReason == APP_SHUTDOWN)
michael@0 55 return;
michael@0 56
michael@0 57 let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
michael@0 58 getService(Components.interfaces.nsIWindowMediator);
michael@0 59
michael@0 60 // Stop watching for new windows
michael@0 61 wm.removeListener(windowListener);
michael@0 62
michael@0 63 // Unload from any existing windows
michael@0 64 let enumerator = wm.getEnumerator("navigator:browser");
michael@0 65 while (enumerator.hasMoreElements()) {
michael@0 66 let win = enumerator.getNext().QueryInterface(Components.interfaces.nsIDOMWindow);
michael@0 67 unloadFromWindow(win);
michael@0 68 }
michael@0 69 }
michael@0 70
michael@0 71 function install(aData, aReason) { }
michael@0 72 function uninstall(aData, aReason) { }
michael@0 73

mercurial