Merge m-c to b-i.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 03 Dec 2013 17:43:24 -0500
changeset 158720 7f6a53b49f8e1f9c51fdfd7b89a2d8923141bc22
parent 158719 94b8161eb20aae33d2bb41494a23c64efebe1d5f (diff)
parent 158610 9ac7ed427cd22058835b3f6bb700b38e41725756 (current diff)
child 158721 d997913037df89a04960346a36de1860425d6458
push id25754
push usercbook@mozilla.com
push dateWed, 04 Dec 2013 08:48:02 +0000
treeherdermozilla-central@9688476c1544 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone28.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
Merge m-c to b-i.
--- a/b2g/components/FilePicker.js
+++ b/b2g/components/FilePicker.js
@@ -98,17 +98,20 @@ FilePicker.prototype = {
     if (filterMask & Ci.nsIFilePicker.filterVideo) {
       this.mFilterTypes = this.mFilterTypes.concat(VIDEO_FILTERS);
     }
 
     if (filterMask & Ci.nsIFilePicker.filterAudio) {
       this.mFilterTypes = this.mFilterTypes.concat(AUDIO_FILTERS);
     }
 
-    // Ci.nsIFilePicker.filterAll is by default
+    if (filterMask & Ci.nsIFilePicker.filterAll) {
+      // This property is needed for the gallery app pick activity.
+      this.mExtraProps['nocrop'] = true;
+    }
   },
 
   appendFilter: function(title, extensions) {
     // pick activity doesn't support extensions
   },
 
   open: function(aFilePickerShownCallback) {
     this.mFilePickerShownCallback = aFilePickerShownCallback;
--- a/dom/network/src/NetworkStatsService.jsm
+++ b/dom/network/src/NetworkStatsService.jsm
@@ -29,20 +29,19 @@ const NET_TYPE_MOBILE = Ci.nsINetworkInt
 
 // The maximum traffic amount can be saved in the |cachedAppStats|.
 const MAX_CACHED_TRAFFIC = 500 * 1000 * 1000; // 500 MB
 
 XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
                                    "@mozilla.org/parentprocessmessagemanager;1",
                                    "nsIMessageListenerManager");
 
-XPCOMUtils.defineLazyServiceGetter(this, "networkManager",
-                                   "@mozilla.org/network/manager;1",
-                                   "nsINetworkManager");
-
+XPCOMUtils.defineLazyServiceGetter(this, "gRil",
+                                   "@mozilla.org/ril;1",
+                                   "nsIRadioInterfaceLayer");
 
 XPCOMUtils.defineLazyServiceGetter(this, "networkService",
                                    "@mozilla.org/network/service;1",
                                    "nsINetworkService");
 
 XPCOMUtils.defineLazyServiceGetter(this, "appsService",
                                    "@mozilla.org/AppsService;1",
                                    "nsIAppsService");
@@ -189,16 +188,30 @@ this.NetworkStatsService = {
    */
   notify: function(aTimer) {
     this.updateAllStats();
   },
 
   /*
    * nsINetworkStatsService
    */
+  getRilNetworks: function() {
+    let networks = {};
+    let numRadioInterfaces = gRil.numRadioInterfaces;
+    for (let i = 0; i < numRadioInterfaces; i++) {
+      let radioInterface = gRil.getRadioInterface(i);
+      if (radioInterface.rilContext.iccInfo) {
+        let netId = this.getNetworkId(radioInterface.rilContext.iccInfo.iccid,
+                                      NET_TYPE_MOBILE);
+        networks[netId] = { id : radioInterface.rilContext.iccInfo.iccid,
+                            type: NET_TYPE_MOBILE };
+      }
+    }
+    return networks;
+  },
 
   convertNetworkInterface: function(aNetwork) {
     if (aNetwork.type != NET_TYPE_MOBILE &&
         aNetwork.type != NET_TYPE_WIFI) {
       return null;
     }
 
     let id = '0';
@@ -224,17 +237,35 @@ this.NetworkStatsService = {
     return netId;
   },
 
   getNetworkId: function getNetworkId(aIccId, aNetworkType) {
     return aIccId + '' + aNetworkType;
   },
 
   getAvailableNetworks: function getAvailableNetworks(mm, msg) {
+    let self = this;
+    let rilNetworks = this.getRilNetworks();
     this._db.getAvailableNetworks(function onGetNetworks(aError, aResult) {
+
+      // Also return the networks that are valid but have not
+      // established connections yet.
+      for (let netId in rilNetworks) {
+        let found = false;
+        for (let i = 0; i < aResult.length; i++) {
+          if (netId == self.getNetworkId(aResult[i].id, aResult[i].type)) {
+            found = true;
+            break;
+          }
+        }
+        if (!found) {
+          aResult.push(rilNetworks[netId]);
+        }
+      }
+
       mm.sendAsyncMessage("NetworkStats:GetAvailableNetworks:Return",
                           { id: msg.id, error: aError, result: aResult });
     });
   },
 
   /*
    * Function called from manager to get stats from database.
    * In order to return updated stats, first is performed a call to
@@ -278,18 +309,33 @@ this.NetworkStatsService = {
         });
       });
       return;
     }
 
     // Check if the network is available in the DB. If yes, we also
     // retrieve the stats for it from the DB.
     this._db.isNetworkAvailable(network, function(aError, aResult) {
+      let toFind = false;
       if (aResult) {
-        // If network is not active, there is no need to update stats.
+        toFind = true;
+      } else if (!aError) {
+        // Network is not found in the database without any errors.
+        // Check if network is valid but has not established a connection yet.
+        let rilNetworks = self.getRilNetworks();
+        if (rilNetworks[netId]) {
+          // find will not get data for network from the database but will format the
+          // result object in order to make NetworkStatsManager be able to construct a
+          // nsIDOMMozNetworkStats object.
+          toFind = true;
+        }
+      }
+
+      if (toFind) {
+        // If network is not active, there is no need to update stats before finding.
         self._db.find(function onStatsFound(aError, aResult) {
           mm.sendAsyncMessage("NetworkStats:Get:Return",
                               { id: msg.id, error: aError, result: aResult });
         }, network, start, end, appId, manifestURL);
         return;
       }
 
       if (!aError) {
@@ -303,18 +349,28 @@ this.NetworkStatsService = {
 
   clearInterfaceStats: function clearInterfaceStats(mm, msg) {
     let network = msg.network;
     let netId = this.getNetworkId(network.id, network.type);
 
     debug("clear stats for network " + network.id + " of type " + network.type);
 
     if (!this._networks[netId]) {
+      let error = "Invalid networkType";
+      let result = null;
+
+      // Check if network is valid but has not established a connection yet.
+      let rilNetworks = this.getRilNetworks();
+      if (rilNetworks[netId]) {
+        error = null;
+        result = true;
+      }
+
       mm.sendAsyncMessage("NetworkStats:Clear:Return",
-                          { id: msg.id, error: "Invalid networkType", result: null });
+                          { id: msg.id, error: error, result: result });
       return;
     }
 
     this._db.clearInterfaceStats(network, function onDBCleared(aError, aResult) {
         mm.sendAsyncMessage("NetworkStats:Clear:Return",
                             { id: msg.id, error: aError, result: aResult });
     });
   },
--- a/layout/tools/reftest/b2g_start_script.js
+++ b/layout/tools/reftest/b2g_start_script.js
@@ -1,50 +1,70 @@
-args = __marionetteParams;
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+let serverAddr = __marionetteParams[0];
+let serverPort = __marionetteParams[1];
 
 function setDefaultPrefs() {
     // This code sets the preferences for extension-based reftest; for
     // command-line based reftest they are set in function handler_handle in
     // reftest-cmdline.js.  These two locations should stay in sync.
     //
     // FIXME: These should be in only one place.
-    var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-                getService(Components.interfaces.nsIPrefService);
+    var prefs = Cc["@mozilla.org/preferences-service;1"].
+                getService(Ci.nsIPrefService);
     var branch = prefs.getDefaultBranch("");
     branch.setBoolPref("dom.use_xbl_scopes_for_remote_xul", false);
     branch.setBoolPref("gfx.color_management.force_srgb", true);
     branch.setBoolPref("browser.dom.window.dump.enabled", true);
     branch.setIntPref("ui.caretBlinkTime", -1);
     branch.setBoolPref("dom.send_after_paint_to_content", true);
     // no slow script dialogs
     branch.setIntPref("dom.max_script_run_time", 0);
     branch.setIntPref("dom.max_chrome_script_run_time", 0);
     branch.setIntPref("hangmonitor.timeout", 0);
     // Ensure autoplay is enabled for all platforms.
     branch.setBoolPref("media.autoplay.enabled", true);
     // Disable updates
     branch.setBoolPref("app.update.enabled", false);
+    // Disable addon updates and prefetching so we don't leak them
+    branch.setBoolPref("extensions.update.enabled", false);
+    branch.setBoolPref("extensions.getAddons.cache.enabled", false);
+    // Disable blocklist updates so we don't have them reported as leaks
+    branch.setBoolPref("extensions.blocklist.enabled", false);
+    // Make url-classifier updates so rare that they won't affect tests
+    branch.setIntPref("urlclassifier.updateinterval", 172800);
+    // Disable high-quality downscaling, since it makes reftests more difficult.
+    branch.setBoolPref("image.high_quality_downscaling.enabled", false);
+    // Checking whether two files are the same is slow on Windows.
+    // Setting this pref makes tests run much faster there.
+    branch.setBoolPref("security.fileuri.strict_origin_policy", false);
+    // Disable the thumbnailing service
+    branch.setBoolPref("browser.pagethumbnails.capturing_disabled", true);
 }
 
-function setPermissions(webserver, port) {
-  var perms = Components.classes["@mozilla.org/permissionmanager;1"]
-              .getService(Components.interfaces.nsIPermissionManager);
-  var ioService = Components.classes["@mozilla.org/network/io-service;1"]
-                  .getService(Components.interfaces.nsIIOService);
-  var uri = ioService.newURI("http://" + webserver + ":" + port, null, null);
-  perms.add(uri, "allowXULXBL", Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
+function setPermissions() {
+  let perms = Cc["@mozilla.org/permissionmanager;1"]
+              .getService(Ci.nsIPermissionManager);
+  let ioService = Cc["@mozilla.org/network/io-service;1"]
+                  .getService(Ci.nsIIOService);
+  let uri = ioService.newURI("http://" + serverAddr + ":" + serverPort, null, null);
+  perms.add(uri, "allowXULXBL", Ci.nsIPermissionManager.ALLOW_ACTION);
 }
 
 // Load into any existing windows
-let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
-                   .getService(Components.interfaces.nsIWindowMediator);
+let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+            .getService(Ci.nsIWindowMediator);
 let win = wm.getMostRecentWindow('');
 
 // Set preferences and permissions
 setDefaultPrefs();
-setPermissions(args[0], args[1]);
+setPermissions();
 
 // Loading this into the global namespace causes intermittent failures.
 // See bug 882888 for more details.
-let reftest = {}; Components.utils.import("chrome://reftest/content/reftest.jsm", reftest);
+let reftest = {};
+Cu.import("chrome://reftest/content/reftest.jsm", reftest);
 
 // Start the reftests
 reftest.OnRefTestLoad(win);
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -255,28 +255,29 @@ this.OnRefTestLoad = function OnRefTestL
     }
     if (gContainingWindow == null && win != null) {
       gContainingWindow = win;
     }
 
     if (gBrowserIsIframe) {
       gBrowser = gContainingWindow.document.createElementNS(XHTML_NS, "iframe");
       gBrowser.setAttribute("mozbrowser", "");
+      gBrowser.setAttribute("mozapp", prefs.getCharPref("browser.manifestURL"));
     } else {
       gBrowser = gContainingWindow.document.createElementNS(XUL_NS, "xul:browser");
     }
     gBrowser.setAttribute("id", "browser");
     gBrowser.setAttribute("type", "content-primary");
     gBrowser.setAttribute("remote", gBrowserIsRemote ? "true" : "false");
     // Make sure the browser element is exactly 800x1000, no matter
     // what size our window is
     gBrowser.setAttribute("style", "min-width: 800px; min-height: 1000px; max-width: 800px; max-height: 1000px");
 
-#if BOOTSTRAP
-#if REFTEST_B2G
+#ifdef BOOTSTRAP
+#ifdef REFTEST_B2G
     var doc = gContainingWindow.document.getElementsByTagName("html")[0];
 #else
     var doc = gContainingWindow.document.getElementById('main-window');
 #endif
     while (doc.hasChildNodes()) {
       doc.removeChild(doc.firstChild);
     }
     doc.appendChild(gBrowser);
@@ -327,18 +328,18 @@ function InitAndStartRefTests()
     try {
         var logFile = prefs.getCharPref("reftest.logFile");
         if (logFile) {
             try {
                 var f = FileUtils.File(logFile);
                 var mfl = FileUtils.openFileOutputStream(f, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE);
                 // Set to mirror to stdout as well as the file
                 gDumpLog = function (msg) {
-#if BOOTSTRAP
-#if REFTEST_B2G
+#ifdef BOOTSTRAP
+#ifdef REFTEST_B2G
                     dump(msg);
 #else
                     //NOTE: on android-xul, we have a libc crash if we do a dump with %7s in the string
 #endif
 #else
                     dump(msg);
 #endif
                     mfl.write(msg, msg.length);
--- a/layout/tools/reftest/runreftestb2g.py
+++ b/layout/tools/reftest/runreftestb2g.py
@@ -399,26 +399,24 @@ class B2GReftest(RefTest):
         profile = RefTest.createReftestProfile(self, options, reftestlist,
                                                server=options.remoteWebServer,
                                                special_powers=False)
         profileDir = profile.profile
 
         prefs = {}
         # Turn off the locale picker screen
         prefs["browser.firstrun.show.localepicker"] = False
-        prefs["browser.homescreenURL"] = "app://system.gaiamobile.org"
-        prefs["browser.manifestURL"] = "app://system.gaiamobile.org/manifest.webapp"
+        prefs["browser.homescreenURL"] = "app://test-container.gaiamobile.org/index.html"
+        prefs["browser.manifestURL"] = "app://test-container.gaiamobile.org/manifest.webapp"
         prefs["browser.tabs.remote"] = False
-        prefs["dom.ipc.browser_frames.oop_by_default"] = True
         prefs["dom.ipc.tabs.disabled"] = False
         prefs["dom.mozBrowserFramesEnabled"] = True
-        prefs["dom.mozBrowserFramesWhitelist"] = "app://system.gaiamobile.org"
-        prefs["network.dns.localDomains"] = "app://system.gaiamobile.org"
         prefs["font.size.inflation.emPerLine"] = 0
         prefs["font.size.inflation.minTwips"] = 0
+        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
         prefs["reftest.browser.iframe.enabled"] = False
         prefs["reftest.remote"] = True
         prefs["reftest.uri"] = "%s" % reftestlist
         # Set a future policy version to avoid the telemetry prompt.
         prefs["toolkit.telemetry.prompted"] = 999
         prefs["toolkit.telemetry.notifiedOptOut"] = 999
 
         # Set the extra prefs.
--- a/widget/gonk/nsAppShell.cpp
+++ b/widget/gonk/nsAppShell.cpp
@@ -319,31 +319,23 @@ public:
 };
 
 bool
 GeckoPointerController::getBounds(float* outMinX,
                                   float* outMinY,
                                   float* outMaxX,
                                   float* outMaxY) const
 {
-    int32_t width, height, orientation;
-
     DisplayViewport viewport;
 
     mConfig->getDisplayInfo(false, &viewport);
 
     *outMinX = *outMinY = 0;
-    if (orientation == DISPLAY_ORIENTATION_90 ||
-        orientation == DISPLAY_ORIENTATION_270) {
-        *outMaxX = viewport.deviceHeight;
-        *outMaxY = viewport.deviceWidth;
-    } else {
-        *outMaxX = viewport.deviceWidth;
-        *outMaxY = viewport.deviceHeight;
-    }
+    *outMaxX = viewport.logicalRight;
+    *outMaxY = viewport.logicalBottom;
     return true;
 }
 
 void
 GeckoPointerController::move(float deltaX, float deltaY)
 {
     float minX, minY, maxX, maxY;
     getBounds(&minX, &minY, &maxX, &maxY);