Merge mozilla-central and b2g-inbound
authorEd Morley <emorley@mozilla.com>
Mon, 09 Sep 2013 13:30:32 +0100
changeset 146150 b1f2748e657cb7e72de1c6b91f930b5ea1faac24
parent 146137 218d4334d29e5d55bcb70498bb66228d8b4463c5 (current diff)
parent 146149 2dd351292f7cc21f6e657bb285b5b98b3984d28b (diff)
child 146151 a466675aa4b8102e23b40ed6aa088537611a49db
push id25243
push userryanvm@gmail.com
push dateMon, 09 Sep 2013 19:52:36 +0000
treeherdermozilla-central@9edc229b7d09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone26.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 mozilla-central and b2g-inbound
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -739,17 +739,17 @@ pref("captivedetect.canonicalContent", "
 
 // The url of the manifest we use for ADU pings.
 pref("ping.manifestURL", "https://marketplace.firefox.com/packaged.webapp");
 
 // Enable the disk space watcher
 pref("disk_space_watcher.enabled", true);
 
 // Enable promise
-pref("dom.promise.enabled", false);
+pref("dom.promise.enabled", true);
 
 // Allow ADB to run for this many hours before disabling
 // (only applies when marionette is disabled)
 // 0 disables the timer.
 pref("b2g.adb.timeout-hours", 12);
 
 // enable Skia/GL (OpenGL-accelerated 2D drawing) for large enough 2d canvases,
 // falling back to Skia/software for smaller canvases
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -158,49 +158,49 @@ SettingsListener.observe('language.curre
       Services.prefs.setCharPref('wap.UAProf.tagname', value);
   });
 })();
 
 //=================== DeviceInfo ====================
 Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
 Components.utils.import('resource://gre/modules/ctypes.jsm');
 (function DeviceInfoToSettings() {
-  XPCOMUtils.defineLazyServiceGetter(this, 'gSettingsService',
-                                     '@mozilla.org/settingsService;1',
-                                     'nsISettingsService');
-  let lock = gSettingsService.createLock();
   // MOZ_B2G_VERSION is set in b2g/confvars.sh, and is output as a #define value
   // from configure.in, defaults to 1.0.0 if this value is not exist.
 #filter attemptSubstitution
   let os_version = '@MOZ_B2G_VERSION@';
   let os_name = '@MOZ_B2G_OS_NAME@';
 #unfilter attemptSubstitution
-  lock.set('deviceinfo.os', os_version, null, null);
-  lock.set('deviceinfo.software', os_name + ' ' + os_version, null, null);
 
   let appInfo = Cc["@mozilla.org/xre/app-info;1"]
                   .getService(Ci.nsIXULAppInfo);
-  lock.set('deviceinfo.platform_version', appInfo.platformVersion, null, null);
-  lock.set('deviceinfo.platform_build_id', appInfo.platformBuildID, null, null);
-
   let update_channel = Services.prefs.getCharPref('app.update.channel');
-  lock.set('deviceinfo.update_channel', update_channel, null, null);
 
   // Get the hardware info and firmware revision from device properties.
   let hardware_info = null;
   let firmware_revision = null;
   let product_model = null;
 #ifdef MOZ_WIDGET_GONK
     hardware_info = libcutils.property_get('ro.hardware');
     firmware_revision = libcutils.property_get('ro.firmware_revision');
     product_model = libcutils.property_get('ro.product.model');
 #endif
-  lock.set('deviceinfo.hardware', hardware_info, null, null);
-  lock.set('deviceinfo.firmware_revision', firmware_revision, null, null);
-  lock.set('deviceinfo.product_model', product_model, null, null);
+
+  let software = os_name + ' ' + os_version;
+  let setting = {
+    'deviceinfo.os': os_version,
+    'deviceinfo.software': software,
+    'deviceinfo.platform_version': appInfo.platformVersion,
+    'deviceinfo.platform_build_id': appInfo.platformBuildID,
+    'deviceinfo.update_channel': update_channel,
+    'deviceinfo.hardware': hardware_info,
+    'deviceinfo.firmware_revision': firmware_revision,
+    'deviceinfo.product_model': product_model
+  }
+  window.navigator.mozSettings.createLock().set(setting);
 })();
 
 // =================== Debugger / ADB ====================
 
 #ifdef MOZ_WIDGET_GONK
 let AdbController = {
   DEBUG: false,
   locked: undefined,
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "627f494cb7b6eb49057434711d1070341430b367", 
+    "revision": "8c3555526de25f58f1bd738bb794b1258bd1b0b1", 
     "repo_path": "/integration/gaia-central"
 }
--- a/content/media/test/test_mediarecorder_avoid_recursion.html
+++ b/content/media/test/test_mediarecorder_avoid_recursion.html
@@ -10,25 +10,29 @@
 a Bug 897776</a>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 function startTest() {
   navigator.mozGetUserMedia({audio: true, fake: true}, function(stream) {
     var mediaRecorder = new MediaRecorder(stream);
     var count = 0;
     mediaRecorder.start();
+    info("mediaRecorder start");
     mediaRecorder.ondataavailable = function (e) {
       if (count++ == 30) {
         stream.stop();
       }
       if (mediaRecorder.state == 'recording') {
+        info("get data again");
         mediaRecorder.requestData();
       }
+      info("got ondataavailable data size = " + e.data.size);
     }
     mediaRecorder.requestData();
+    info("mediaRecorder requestData");
     mediaRecorder.onstop = function () {
       ok(true, "requestData within ondataavailable successfully avoided infinite recursion");
       SimpleTest.finish();
     }
   }, function(err) {
     ok(false, 'Unexpected error fired with: ' + err);
     SimpleTest.finish();
   });
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -3792,34 +3792,26 @@ let RIL = {
   _cancelEmergencyCbModeTimeout: function _cancelEmergencyCbModeTimeout() {
     if (this._exitEmergencyCbModeTimeoutID) {
       clearTimeout(this._exitEmergencyCbModeTimeoutID);
       this._exitEmergencyCbModeTimeoutID = null;
     }
   },
 
   _handleChangedEmergencyCbMode: function _handleChangedEmergencyCbMode(active) {
-    if (this._isInEmergencyCbMode === active) {
-      return;
-    }
-
+    this._isInEmergencyCbMode = active;
+
+    // Clear the existed timeout event.
+    this._cancelEmergencyCbModeTimeout();
+
+    // Start a new timeout event when entering the mode.
     if (active) {
-      // Start a new timeout event when enter the mode.
-      let ril = this;
-      this._cancelEmergencyCbModeTimeout();
-      this._exitEmergencyCbModeTimeoutID = setTimeout(function() {
-          ril.exitEmergencyCbMode();
-      }, EMERGENCY_CB_MODE_TIMEOUT_MS);
-    } else {
-      // Clear the timeout event when exit mode.
-      this._cancelEmergencyCbModeTimeout();
-    }
-
-    // Keep current mode and write to property.
-    this._isInEmergencyCbMode = active;
+      this._exitEmergencyCbModeTimeoutID = setTimeout(
+          this.exitEmergencyCbMode.bind(this), EMERGENCY_CB_MODE_TIMEOUT_MS);
+    }
 
     let message = {rilMessageType: "emergencyCbModeChange",
                    active: active,
                    timeoutMs: EMERGENCY_CB_MODE_TIMEOUT_MS};
     this.sendChromeMessage(message);
   },
 
   _processNetworks: function _processNetworks() {
--- a/dom/system/gonk/tests/test_ril_worker_ecm.js
+++ b/dom/system/gonk/tests/test_ril_worker_ecm.js
@@ -23,24 +23,25 @@ function _getWorker() {
     get worker() {
       return _worker;
     }
   };
 }
 
 var timeoutCallback = null;
 var timeoutDelayMs = 0;
-var TIMER_ID = 1234;
+const TIMER_ID = 1234;
+const TIMEOUT_VALUE = 300000;  // 5 mins.
 
 // No window in xpcshell-test. Create our own timer mechanism.
 
 function setTimeout(callback, timeoutMs) {
   timeoutCallback = callback;
   timeoutDelayMs = timeoutMs;
-  do_check_eq(timeoutMs, 300000);  // 5 mins.
+  do_check_eq(timeoutMs, TIMEOUT_VALUE);
   return TIMER_ID;
 }
 
 function clearTimeout(timeoutId) {
   do_check_eq(timeoutId, TIMER_ID);
   timeoutCallback = null;
 }
 
@@ -51,29 +52,32 @@ function fireTimeout() {
     timeoutCallback = null;
   }
 }
 
 add_test(function test_enter_emergencyCbMode() {
   let workerHelper = _getWorker();
   let worker = workerHelper.worker;
 
-  worker.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
-  let postedMessage = workerHelper.postedMessage;
+  // Do it twice. Should always send the event.
+  for (let i = 0; i < 2; ++i) {
+    worker.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
+    let postedMessage = workerHelper.postedMessage;
 
-  // Should store the mode.
-  do_check_eq(worker.RIL._isInEmergencyCbMode, true);
+    // Should store the mode.
+    do_check_eq(worker.RIL._isInEmergencyCbMode, true);
 
-  // Should notify change.
-  do_check_eq(postedMessage.rilMessageType, "emergencyCbModeChange");
-  do_check_eq(postedMessage.active, true);
-  do_check_eq(postedMessage.timeoutMs, 300000);
+    // Should notify change.
+    do_check_eq(postedMessage.rilMessageType, "emergencyCbModeChange");
+    do_check_eq(postedMessage.active, true);
+    do_check_eq(postedMessage.timeoutMs, TIMEOUT_VALUE);
 
-  // Should start timer.
-  do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
+    // Should start timer.
+    do_check_eq(worker.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
+  }
 
   run_next_test();
 });
 
 add_test(function test_exit_emergencyCbMode() {
   let workerHelper = _getWorker();
   let worker = workerHelper.worker;
 
--- a/testing/marionette/client/marionette/runtests.py
+++ b/testing/marionette/client/marionette/runtests.py
@@ -6,16 +6,17 @@ from datetime import datetime
 import logging
 from optparse import OptionParser
 import os
 import unittest
 import socket
 import sys
 import time
 import traceback
+import random
 import moznetwork
 import xml.dom.minidom as dom
 
 from manifestparser import TestManifest
 from mozhttpd import MozHttpd
 
 from marionette import Marionette
 from marionette_test import MarionetteJSTestCase, MarionetteTestCase
@@ -205,17 +206,17 @@ class MarionetteTestRunner(object):
     textrunnerclass = MarionetteTextTestRunner
 
     def __init__(self, address=None, emulator=None, emulatorBinary=None,
                  emulatorImg=None, emulator_res='480x800', homedir=None,
                  app=None, app_args=None, bin=None, profile=None, autolog=False,
                  revision=None, logger=None, testgroup="marionette", noWindow=False,
                  logcat_dir=None, xml_output=None, repeat=0, gecko_path=None,
                  testvars=None, tree=None, type=None, device_serial=None,
-                 symbols_path=None, timeout=None, es_servers=None, **kwargs):
+                 symbols_path=None, timeout=None, es_servers=None, shuffle=False, **kwargs):
         self.address = address
         self.emulator = emulator
         self.emulatorBinary = emulatorBinary
         self.emulatorImg = emulatorImg
         self.emulator_res = emulator_res
         self.homedir = homedir
         self.app = app
         self.app_args = app_args or []
@@ -239,16 +240,17 @@ class MarionetteTestRunner(object):
         self.type = type
         self.device_serial = device_serial
         self.symbols_path = symbols_path
         self.timeout = timeout
         self._device = None
         self._capabilities = None
         self._appName = None
         self.es_servers = es_servers
+        self.shuffle = shuffle
 
         if testvars:
             if not os.path.exists(testvars):
                 raise Exception('--testvars file does not exist')
 
             import json
             with open(testvars) as f:
                 self.testvars = json.loads(f.read())
@@ -412,16 +414,19 @@ class MarionetteTestRunner(object):
                 testgroup.add_test_failure(test=f[0], text=f[1], status=f[2])
 
             testgroup.submit()
 
     def run_tests(self, tests):
         self.reset_test_stats()
         starttime = datetime.utcnow()
         while self.repeat >=0:
+            self.logger.info('\nROUND %d\n-------' % self.repeat)
+            if self.shuffle:
+                random.shuffle(tests)
             for test in tests:
                 self.run_test(test)
             self.repeat -= 1
         self.logger.info('\nSUMMARY\n-------')
         self.logger.info('passed: %d' % self.passed)
         self.logger.info('failed: %d' % self.failed)
         self.logger.info('todo: %d' % self.todo)
 
@@ -458,16 +463,18 @@ class MarionetteTestRunner(object):
 
         if not self.marionette:
             self.start_marionette()
 
         filepath = os.path.abspath(test)
 
         if os.path.isdir(filepath):
             for root, dirs, files in os.walk(filepath):
+                if self.shuffle:
+                    random.shuffle(files)
                 for filename in files:
                     if ((filename.startswith('test_') or filename.startswith('browser_')) and
                         (filename.endswith('.py') or filename.endswith('.js'))):
                         filepath = os.path.join(root, filename)
                         self.run_test(filepath)
                         if self.marionette.check_for_crash():
                             return
             return
@@ -500,17 +507,20 @@ class MarionetteTestRunner(object):
                               set([x['path'] for x in manifest_tests]))
             for skipped in skip_tests:
                 self.logger.info('TEST-SKIP | %s | device=%s, app=%s' %
                                  (os.path.basename(skipped),
                                   self.device,
                                   self.appName))
                 self.todo += 1
 
-            for i in manifest.get(tests=manifest_tests, **testargs):
+            target_tests = manifest.get(tests=manifest_tests, **testargs)
+            if self.shuffle:
+                random.shuffle(target_tests)
+            for i in target_tests:
                 self.run_test(i["path"])
                 if self.marionette.check_for_crash():
                     return
             return
 
         self.logger.info('TEST-START %s' % os.path.basename(test))
 
         for handler in self.test_handlers:
@@ -738,16 +748,21 @@ class MarionetteTestOptions(OptionParser
         self.add_option('--timeout',
                         dest='timeout',
                         type=int,
                         help='if a --timeout value is given, it will set the default page load timeout, search timeout and script timeout to the given value. If not passed in, it will use the default values of 30000ms for page load, 0ms for search timeout and 10000ms for script timeout')
         self.add_option('--es-server',
                         dest='es_servers',
                         action='append',
                         help='the ElasticSearch server to use for autolog submission')
+        self.add_option('--shuffle',
+                        action='store_true',
+                        dest='shuffle',
+                        default=False,
+                        help='run tests in a random order')
 
     def verify_usage(self, options, tests):
         if not tests:
             print 'must specify one or more test files, manifests, or directories'
             sys.exit(1)
 
         if not options.emulator and not options.address and not options.bin:
             print 'must specify --binary, --emulator or --address'