Merge the last green birch cset to m-c.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 10 Jul 2013 13:49:16 -0400
changeset 138005 dde4dcd6fa4678032cad2b65ae364f4f56d2b9e5
parent 137975 468b35185c44a32fdb61d97c02cbdb4dc04731de (current diff)
parent 138004 550938053ef00c5897eac36f87272fe62a6b2c10 (diff)
child 138006 04c6e713648e0a71723628971898239304f8e419
child 138098 3fc610532baf20310494c840e3650c8168798eb9
child 138100 35c5a0f94b65c51857e61ad50f249b433846643a
child 138111 985ec1e6179f9f503b0fad60287ab790ae887f6d
push id30781
push userryanvm@gmail.com
push dateWed, 10 Jul 2013 17:52:11 +0000
treeherdermozilla-inbound@04c6e713648e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone25.0a1
first release with
nightly linux32
dde4dcd6fa46 / 25.0a1 / 20130711030204 / files
nightly linux64
dde4dcd6fa46 / 25.0a1 / 20130711030204 / files
nightly mac
dde4dcd6fa46 / 25.0a1 / 20130711030204 / files
nightly win32
dde4dcd6fa46 / 25.0a1 / 20130711030204 / files
nightly win64
dde4dcd6fa46 / 25.0a1 / 20130711030204 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge the last green birch cset to m-c.
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "5e60cb6fc0e09cefe242a6fb0159fbd09360cc1a", 
+    "revision": "9093c20568e0b754c5e288290ba68836d5f397f1", 
     "repo_path": "/integration/gaia-central"
 }
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -2039,18 +2039,21 @@ void MediaDecoderStateMachine::DecodeSee
           nsCOMPtr<nsIRunnable> event =
             NS_NewRunnableMethod(mDecoder, &MediaDecoder::Invalidate);
           NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
         }
       }
     }
   }
   mDecoder->StartProgressUpdates();
-  if (mState == DECODER_STATE_DORMANT || mState == DECODER_STATE_SHUTDOWN)
+  if (mState == DECODER_STATE_DECODING_METADATA ||
+      mState == DECODER_STATE_DORMANT ||
+      mState == DECODER_STATE_SHUTDOWN) {
     return;
+  }
 
   // Try to decode another frame to detect if we're at the end...
   LOG(PR_LOG_DEBUG, ("%p Seek completed, mCurrentFrameTime=%lld\n",
       mDecoder.get(), mCurrentFrameTime));
 
   // Change state to DECODING or COMPLETED now. SeekingStopped will
   // call MediaDecoderStateMachine::Seek to reset our state to SEEKING
   // if we need to seek again.
--- a/dom/browser-element/BrowserElementChildPreload.js
+++ b/dom/browser-element/BrowserElementChildPreload.js
@@ -578,24 +578,28 @@ BrowserElementChild.prototype = {
     } else {
       this._ctxHandlers = {};
     }
   },
 
   _getSystemCtxMenuData: function(elem) {
     if ((elem instanceof Ci.nsIDOMHTMLAnchorElement && elem.href) ||
         (elem instanceof Ci.nsIDOMHTMLAreaElement && elem.href)) {
-      return elem.href;
+      return {uri: elem.href};
     }
     if (elem instanceof Ci.nsIImageLoadingContent && elem.currentURI) {
-      return elem.currentURI.spec;
+      return {uri: elem.currentURI.spec};
+    }
+    if (elem instanceof Ci.nsIDOMHTMLImageElement) {
+      return {uri: elem.src};
     }
-    if ((elem instanceof Ci.nsIDOMHTMLMediaElement) ||
-        (elem instanceof Ci.nsIDOMHTMLImageElement)) {
-      return elem.currentSrc || elem.src;
+    if (elem instanceof Ci.nsIDOMHTMLMediaElement) {
+      let hasVideo = !(elem.readyState >= elem.HAVE_METADATA &&
+                       (elem.videoWidth == 0 || elem.videoHeight == 0));
+      return {uri: elem.currentSrc || elem.src, hasVideo: hasVideo};
     }
     return false;
   },
 
   _scrollEventHandler: function(e) {
     let win = e.target.defaultView;
     if (win != content) {
       return;
--- a/dom/browser-element/mochitest/Makefile.in
+++ b/dom/browser-element/mochitest/Makefile.in
@@ -11,16 +11,18 @@ relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # Note: browserElementTestHelpers.js looks at the test's filename to determine
 # whether the test should be OOP.  "_oop_" signals OOP, "_inproc_" signals in
 # process.  Default is OOP.
 
 MOCHITEST_FILES = \
+                $(topsrcdir)/browser/base/content/test/audio.ogg \
+                $(topsrcdir)/content/media/test/short-video.ogv \
 		file_empty_script.js \
 		file_empty.html \
 		file_focus.html \
 		browserElementTestHelpers.js \
 		test_browserElement_NoAttr.html \
 		test_browserElement_NoPref.html \
 		test_browserElement_NoWhitelist.html \
 		browserElement_LoadEvents.js \
--- a/dom/browser-element/mochitest/browserElement_ContextmenuEvents.js
+++ b/dom/browser-element/mochitest/browserElement_ContextmenuEvents.js
@@ -1,14 +1,17 @@
 'use strict';
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
 browserElementTestHelpers.addPermission();
 
+let audioUrl = 'http://mochi.test:8888/tests/dom/browser-element/mochitest/audio.ogg';
+let videoUrl = 'http://mochi.test:8888/tests/dom/browser-element/mochitest/short-video.ogv';
+
 function runTests() {
   createIframe(function onIframeLoaded() {
     checkEmptyContextMenu();
   });
 }
 
 function checkEmptyContextMenu() {
   sendContextMenuTo('body', function onContextMenu(detail) {
@@ -109,27 +112,78 @@ function checkCallbackWithPreventDefault
 }
 
 function checkCallbackWithoutPreventDefault() {
   sendContextMenuTo('#menu1-trigger', function onContextMenu(detail) {
     var id = detail.contextmenu.items[0].id;
     checkContextMenuCallbackForId(detail, id, function onCallbackFired(label) {
       is(label, null, 'Callback label should be null');
 
-      SimpleTest.finish();
+      checkImageContextMenu();
     });
   }, /* ignorePreventDefault */ true);
 }
 
+function checkImageContextMenu() {
+  sendContextMenuTo('#menu3-trigger', function onContextMenu(detail) {
+    var target = detail.systemTargets[0];
+    is(target.nodeName, 'IMG', 'Reports correct nodeName');
+    is(target.data.uri, 'example.png', 'Reports correct uri');
+
+    checkVideoContextMenu();
+  }, /* ignorePreventDefault */ true);
+}
+
+function checkVideoContextMenu() {
+  sendContextMenuTo('#menu4-trigger', function onContextMenu(detail) {
+    var target = detail.systemTargets[0];
+    is(target.nodeName, 'VIDEO', 'Reports correct nodeName');
+    is(target.data.uri, videoUrl, 'Reports uri correctly in data');
+    is(target.data.hasVideo, true, 'Video data in video tag does "hasVideo"');
+
+    checkAudioContextMenu();
+  }, /* ignorePreventDefault */ true);
+}
+
+function checkAudioContextMenu() {
+  sendContextMenuTo('#menu6-trigger', function onContextMenu(detail) {
+    var target = detail.systemTargets[0];
+    is(target.nodeName, 'AUDIO', 'Reports correct nodeName');
+    is(target.data.uri, audioUrl, 'Reports uri correctly in data');
+
+    checkAudioinVideoContextMenu();
+  }, /* ignorePreventDefault */ true);
+}
+
+function checkAudioinVideoContextMenu() {
+  sendSrcTo('#menu5-trigger', audioUrl, function onSrcSet() {
+    sendContextMenuTo('#menu5-trigger', function onContextMenu(detail) {
+      var target = detail.systemTargets[0];
+      is(target.nodeName, 'VIDEO', 'Reports correct nodeName');
+      is(target.data.uri, audioUrl, 'Reports uri correctly in data');
+      is(target.data.hasVideo, false, 'Audio data in video tag reports no "hasVideo"');
+
+      SimpleTest.finish();
+    }, /* ignorePreventDefault */ true);
+  });
+}
 
 /* Helpers */
 var mm = null;
 var previousContextMenuDetail = null;
 var currentContextMenuDetail = null;
 
+function sendSrcTo(selector, src, callback) {
+  mm.sendAsyncMessage('setsrc', { 'selector': selector, 'src': src });
+  mm.addMessageListener('test:srcset', function onSrcSet(msg) {
+    mm.removeMessageListener('test:srcset', onSrcSet);
+    callback();
+  });
+}
+
 function sendContextMenuTo(selector, callback, ignorePreventDefault) {
   iframe.addEventListener('mozbrowsercontextmenu', function oncontextmenu(e) {
     iframe.removeEventListener(e.type, oncontextmenu);
 
     // The embedder should call preventDefault() on the event if it will handle
     // it. Not calling preventDefault() means it won't handle the event and 
     // should not be able to deal with context menu callbacks.
     if (ignorePreventDefault !== true) {
@@ -173,29 +227,42 @@ function createIframe(callback) {
       '<menuitem label="outer" onclick="window.onContextMenuCallbackFired(event)"></menuitem>' +
       '<menu>' +
         '<menuitem label="inner 1"></menuitem>' +
         '<menuitem label="inner 2" onclick="window.onContextMenuCallbackFired(event)"></menuitem>' +
       '</menu>' +
     '</menu>' +
     '<div id="menu1-trigger" contextmenu="menu1"><a id="inner-link" href="foo.html">Menu 1</a></div>' +
     '<a href="bar.html" contextmenu="menu2"><img id="menu2-trigger" src="example.png" /></a>' +
+    '<img id="menu3-trigger" src="example.png" />' +
+    '<video id="menu4-trigger" src="' + videoUrl + '"></video>' +
+    '<video id="menu5-trigger" preload="metadata"></video>' +
+    '<audio id="menu6-trigger" src="' + audioUrl + '"></audio>' +
     '</body></html>';
   document.body.appendChild(iframe);
 
   // The following code will be included in the child
   // =========================================================================
   function iframeScript() {
     addMessageListener('contextmenu', function onContextMenu(msg) {
       var document = content.document;
       var evt = document.createEvent('HTMLEvents');
       evt.initEvent('contextmenu', true, true);
       document.querySelector(msg.data.selector).dispatchEvent(evt);
     });
 
+    addMessageListener('setsrc', function onContextMenu(msg) {
+      var wrappedTarget = content.document.querySelector(msg.data.selector);
+      var target = XPCNativeWrapper.unwrap(wrappedTarget);
+      target.addEventListener('loadedmetadata', function() {
+        sendAsyncMessage('test:srcset');
+      });
+      target.src = msg.data.src;
+    });
+
     addMessageListener('browser-element-api:call', function onCallback(msg) {
       if (msg.data.msg_name != 'fire-ctx-callback')
         return;
 
       /* Use setTimeout in order to react *after* the platform */
       content.setTimeout(function() {
         sendAsyncMessage('test:callbackfired', { label: label });
         label = null;
--- a/hal/gonk/GonkHal.cpp
+++ b/hal/gonk/GonkHal.cpp
@@ -430,17 +430,17 @@ GetCurrentBatteryInformation(hal::Batter
   int charging;
 
   if (GetCurrentBatteryCharging(&charging)) {
     aBatteryInfo->charging() = charging;
   } else {
     aBatteryInfo->charging() = true;
   }
 
-  if (aBatteryInfo->charging() && (aBatteryInfo->level() < 1.0)) {
+  if (!aBatteryInfo->charging() || (aBatteryInfo->level() < 1.0)) {
     aBatteryInfo->remainingTime() = dom::battery::kUnknownRemainingTime;
   } else {
     aBatteryInfo->remainingTime() = dom::battery::kDefaultRemainingTime;
   }
 }
 
 namespace {