Merge mozilla-central and fx-team
authorEd Morley <emorley@mozilla.com>
Thu, 07 Aug 2014 15:30:17 +0100
changeset 198377 bdab9531e0ac570e8555ea53f387f9c4eba41484
parent 198320 aa1617678a90dabd3179cc1e36d48c4304827cc6 (current diff)
parent 198376 01e2fbcd6455eeceac93360591f3ad034159dd68 (diff)
child 198378 a29e8343c897746656c5fd7c7eb798ba28325d27
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone34.0a1
Merge mozilla-central and fx-team
--- a/browser/base/content/test/general/browser_urlbarSearchSingleWordNotification.js
+++ b/browser/base/content/test/general/browser_urlbarSearchSingleWordNotification.js
@@ -1,23 +1,37 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
+let notificationObserver;
 registerCleanupFunction(function() {
   Services.prefs.clearUserPref("browser.fixup.domainwhitelist.localhost");
+  if (notificationObserver) {
+    notificationObserver.disconnect();
+  }
 });
 
 function promiseNotificationForTab(value, expected, tab=gBrowser.selectedTab) {
   let deferred = Promise.defer();
   let notificationBox = gBrowser.getNotificationBox(tab.linkedBrowser);
   if (expected) {
-    waitForCondition(() => notificationBox.getNotificationWithValue(value) !== null,
-                     deferred.resolve, "Were expecting to get a notification");
+    let checkForNotification = function() {
+      if (notificationBox.getNotificationWithValue(value)) {
+        notificationObserver.disconnect();
+        notificationObserver = null;
+        deferred.resolve();
+      }
+    }
+    if (notificationObserver) {
+      notificationObserver.disconnect();
+    }
+    notificationObserver = new MutationObserver(checkForNotification);
+    notificationObserver.observe(notificationBox, {childList: true});
   } else {
     setTimeout(() => {
       is(notificationBox.getNotificationWithValue(value), null, "We are expecting to not get a notification");
       deferred.resolve();
     }, 1000);
   }
   return deferred.promise;
 }
--- a/toolkit/components/feeds/FeedProcessor.js
+++ b/toolkit/components/feeds/FeedProcessor.js
@@ -539,20 +539,26 @@ Entry.prototype = {
 
     if (!(enc.getProperty("url")))
       return;
 
     this._addToEnclosures(enc);
   },
 
   _mediaToEnclosures: function Entry_mediaToEnclosures(mediaType, contentType) {
-    var content = this.fields.getPropertyAsInterface(mediaType, Ci.nsIArray);
+    var content;
 
-    if (contentType)
-      content = content.getPropertyAsInterface(contentType, Ci.nsIArray);
+    // If a contentType is specified, the mediaType is a simple propertybag,
+    // and the contentType is an array inside it.
+    if (contentType) {
+      var group = this.fields.getPropertyAsInterface(mediaType, Ci.nsIPropertyBag2);
+      content = group.getPropertyAsInterface(contentType, Ci.nsIArray);
+    } else {
+      content = this.fields.getPropertyAsInterface(mediaType, Ci.nsIArray);
+    }
 
     for (var i = 0; i < content.length; ++i) {
       var contentElement = content.queryElementAt(i, Ci.nsIWritablePropertyBag2);
 
       // media:content don't require url, but if it's not there, we should
       // skip it.
       if (!bagHasKey(contentElement, "url"))
         continue;