Bug 897417 - Add support for Talos tp-cmdline parameters in metro browser startup. r=mbrubeck
authorJim Mathies <jmathies@mozilla.com>
Fri, 26 Jul 2013 07:05:37 -0500
changeset 152430 e8ef43506a4df5964dd5cb464984d18a9d6897cb
parent 152429 9a1a962eaa193b39ca238a46ff6c865455f75572
child 152431 3de1033e44b730906715cfb3b19a07130aa6893f
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs897417
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 897417 - Add support for Talos tp-cmdline parameters in metro browser startup. r=mbrubeck
browser/metro/base/content/browser.js
--- a/browser/metro/base/content/browser.js
+++ b/browser/metro/base/content/browser.js
@@ -16,16 +16,19 @@ const kSetInactiveStateTimeout = 100;
 
 const kDefaultMetadata = { autoSize: false, allowZoom: true, autoScale: true };
 
 // Override sizeToContent in the main window. It breaks things (bug 565887)
 window.sizeToContent = function() {
   Cu.reportError("window.sizeToContent is not allowed in this window");
 }
 
+/*
+ * Returns the browser for the currently displayed tab.
+ */
 function getBrowser() {
   return Browser.selectedBrowser;
 }
 
 var Browser = {
   _debugEvents: false,
   _tabs: [],
   _selectedTab: null,
@@ -122,21 +125,30 @@ var Browser = {
     window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = new nsBrowserAccess();
 
     Elements.browsers.addEventListener("DOMUpdatePageReport", PopupBlockerObserver.onUpdatePageReport, false);
 
     // Make sure we're online before attempting to load
     Util.forceOnline();
 
     // If this is an intial window launch the commandline handler passes us the default
-    // page as an argument. commandURL _should_ never be empty, but we protect against it
-    // below. However, we delay trying to get the fallback homepage until we really need it.
+    // page as an argument.
     let commandURL = null;
-    if (window.arguments && window.arguments[0])
-      commandURL = window.arguments[0];
+    try {
+      let argsObj = window.arguments[0].wrappedJSObject;
+      if (argsObj && argsObj.pageloadURL) {
+        // Talos tp-cmdline parameter
+        commandURL = argsObj.pageloadURL;
+      } else if (window.arguments && window.arguments[0]) {
+        // BrowserCLH paramerter
+        commandURL = window.arguments[0];
+      }
+    } catch (ex) {
+      Util.dumpLn(ex);
+    }
 
     messageManager.addMessageListener("DOMLinkAdded", this);
     messageManager.addMessageListener("MozScrolledAreaChanged", this);
     messageManager.addMessageListener("Browser:ViewportMetadata", this);
     messageManager.addMessageListener("Browser:FormSubmit", this);
     messageManager.addMessageListener("Browser:ZoomToPoint:Return", this);
     messageManager.addMessageListener("Browser:CanUnload:Return", this);
     messageManager.addMessageListener("scroll", this);