Bug 517600: support opening more than one fennec window so that talos works, r=mfinkle
authorGavin Sharp <gavin@mozilla.com>
Sat, 19 Sep 2009 00:23:44 -0400
changeset 65579 51b99ac87d1e8082c0ee2516b8d1980494b14eb7
parent 65578 73413e896bbcd06385f8c3ca001df7fe3fa12141
child 65580 186bc5b45288d3fb2942ecd3e578da01164d816f
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs517600
Bug 517600: support opening more than one fennec window so that talos works, r=mfinkle
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -488,29 +488,28 @@ var Browser = {
     // Init it with the "browsers" element, which will receive keypress events
     // for all of our <browser>s
     SpatialNavigation.init(browsers, panCallback);
 
     /* Login Manager */
     Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
 
     /* Command line arguments/initial homepage */
+    var whereURI = "about:blank";
+    try {
+      // Check for and use a default homepage
+      whereURI = gPrefService.getCharPref("browser.startup.homepage");
+    } catch (e) {}
+
     // If this is an intial window launch (was a nsICommandLine passed via window params)
     // we execute some logic to load the initial launch page
-    if (window.arguments && window.arguments[0]) {
-      var whereURI = null;
-
+    if (window.arguments && window.arguments[0] &&
+	window.arguments[0] instanceof Ci.nsICommandLine) {
       try {
-        // Try to access the commandline
-        var cmdLine = window.arguments[0].QueryInterface(Ci.nsICommandLine);
-
-        try {
-          // Check for and use a default homepage
-          whereURI = gPrefService.getCharPref("browser.startup.homepage");
-        } catch (e) {}
+        var cmdLine = window.arguments[0];
 
         // Check for and use a single commandline parameter
         if (cmdLine.length == 1) {
           // Assume the first arg is a URI if it is not a flag
           var uri = cmdLine.getArgument(0);
           if (uri != "" && uri[0] != '-') {
             whereURI = cmdLine.resolveURI(uri);
             if (whereURI)
@@ -521,21 +520,20 @@ var Browser = {
         // Check for the "url" flag
         var uriFlag = cmdLine.handleFlagWithParam("url", false);
         if (uriFlag) {
           whereURI = cmdLine.resolveURI(uriFlag);
           if (whereURI)
             whereURI = whereURI.spec;
         }
       } catch (e) {}
-
-      if (whereURI)
-        this.addTab(whereURI, true);
     }
 
+    this.addTab(whereURI, true);
+
     // JavaScript Error Console
     if (gPrefService.getBoolPref("browser.console.showInPanel")){
       let tool_console = document.getElementById("tool-console");
       tool_console.hidden = false;
     }
 
     // Re-enable plugins if we had previously disabled them. We should get rid of
     // this code eventually...