Backed out changeset 7210dfe7ad78 (Bug 1147668) for test failure
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 15 Jun 2015 23:20:02 -0400
changeset 281380 09bc59954db83980b50c88fef9c72b2613c5cca3
parent 281379 6fc0cc353d2487581d56d86da43c67b9735caf7c
child 281381 e59b299a669db1ab50087931e5acd453d7d1f541
push id897
push userjlund@mozilla.com
push dateMon, 14 Sep 2015 18:56:12 +0000
treeherdermozilla-release@9411e2d2b214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1147668
milestone41.0a1
backs out7210dfe7ad781fd39aedea2e78be669c76532c33
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
Backed out changeset 7210dfe7ad78 (Bug 1147668) for test failure
dom/fetch/InternalRequest.cpp
dom/fetch/InternalRequest.h
dom/html/HTMLMediaElement.cpp
dom/html/HTMLTrackElement.cpp
dom/media/MediaResource.cpp
dom/workers/test/serviceworkers/fetch/context/context_test.js
dom/workers/test/serviceworkers/fetch/context/index.html
--- a/dom/fetch/InternalRequest.cpp
+++ b/dom/fetch/InternalRequest.cpp
@@ -147,25 +147,19 @@ InternalRequest::MapContentPolicyTypeToR
     context = RequestContext::Plugin;
     break;
   case nsIContentPolicy::TYPE_DTD:
     context = RequestContext::Internal;
     break;
   case nsIContentPolicy::TYPE_FONT:
     context = RequestContext::Font;
     break;
-  case nsIContentPolicy::TYPE_INTERNAL_AUDIO:
+  case nsIContentPolicy::TYPE_MEDIA:
     context = RequestContext::Audio;
     break;
-  case nsIContentPolicy::TYPE_INTERNAL_VIDEO:
-    context = RequestContext::Video;
-    break;
-  case nsIContentPolicy::TYPE_INTERNAL_TRACK:
-    context = RequestContext::Track;
-    break;
   case nsIContentPolicy::TYPE_WEBSOCKET:
     context = RequestContext::Internal;
     break;
   case nsIContentPolicy::TYPE_CSP_REPORT:
     context = RequestContext::Cspreport;
     break;
   case nsIContentPolicy::TYPE_XSLT:
     context = RequestContext::Xslt;
--- a/dom/fetch/InternalRequest.h
+++ b/dom/fetch/InternalRequest.h
@@ -25,17 +25,17 @@ namespace dom {
 
 /*
  * The mapping of RequestContext and nsContentPolicyType is currently as the
  * following.  Note that this mapping is not perfect yet (see the TODO comments
  * below for examples).
  *
  * RequestContext    | nsContentPolicyType
  * ------------------+--------------------
- * audio             | TYPE_INTERNAL_AUDIO
+ * audio             | TYPE_MEDIA
  * beacon            | TYPE_BEACON
  * cspreport         | TYPE_CSP_REPORT
  * download          |
  * embed             | TYPE_OBJECT
  * eventsource       |
  * favicon           |
  * fetch             | TYPE_FETCH
  * font              | TYPE_FONT
@@ -52,24 +52,25 @@ namespace dom {
  * object            | TYPE_OBJECT
  * ping              | TYPE_PING
  * plugin            | TYPE_OBJECT_SUBREQUEST
  * prefetch          |
  * script            | TYPE_SCRIPT
  * sharedworker      |
  * subresource       | Not supported by Gecko
  * style             | TYPE_STYLESHEET
- * track             | TYPE_INTERNAL_TRACK
- * video             | TYPE_INTERNAL_VIDEO
+ * track             | TYPE_MEDIA
+ * video             | TYPE_MEDIA
  * worker            |
  * xmlhttprequest    | TYPE_XMLHTTPREQUEST
  * xslt              | TYPE_XSLT
  *
  * TODO: Figure out if TYPE_REFRESH maps to anything useful
  * TODO: Figure out if TYPE_DTD maps to anything useful
+ * TODO: Split TYPE_MEDIA into TYPE_AUDIO, TYPE_VIDEO and TYPE_TRACK
  * TODO: Split TYPE_XMLHTTPREQUEST and TYPE_DATAREQUEST for EventSource
  * TODO: Figure out if TYPE_WEBSOCKET maps to anything useful
  * TODO: Differentiate between frame and iframe
  * TODO: Add content types for different kinds of workers
  * TODO: Add a content type for prefetch
  * TODO: Use the content type for manifest when it becomes available
  * TODO: Add a content type for location
  * TODO: Add a content type for hyperlink
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1145,22 +1145,18 @@ nsresult HTMLMediaElement::LoadResource(
   }
 
   // Check if media is allowed for the docshell.
   nsCOMPtr<nsIDocShell> docShell = OwnerDoc()->GetDocShell();
   if (docShell && !docShell->GetAllowMedia()) {
     return NS_ERROR_FAILURE;
   }
 
-  MOZ_ASSERT(IsAnyOfHTMLElements(nsGkAtoms::audio, nsGkAtoms::video));
-  nsContentPolicyType contentPolicyType = IsHTMLElement(nsGkAtoms::audio) ?
-    nsIContentPolicy::TYPE_INTERNAL_AUDIO : nsIContentPolicy::TYPE_INTERNAL_VIDEO;
-
   int16_t shouldLoad = nsIContentPolicy::ACCEPT;
-  nsresult rv = NS_CheckContentLoadPolicy(contentPolicyType,
+  nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_MEDIA,
                                           mLoadingSrc,
                                           NodePrincipal(),
                                           static_cast<Element*>(this),
                                           EmptyCString(), // mime type
                                           nullptr, // extra
                                           &shouldLoad,
                                           nsContentUtils::GetContentPolicy(),
                                           nsContentUtils::GetSecurityManager());
@@ -1228,17 +1224,17 @@ nsresult HTMLMediaElement::LoadResource(
   }
 
   nsCOMPtr<nsILoadGroup> loadGroup = GetDocumentLoadGroup();
   nsCOMPtr<nsIChannel> channel;
   rv = NS_NewChannel(getter_AddRefs(channel),
                      mLoadingSrc,
                      static_cast<Element*>(this),
                      securityFlags,
-                     contentPolicyType,
+                     nsIContentPolicy::TYPE_MEDIA,
                      loadGroup,
                      nullptr,   // aCallbacks
                      nsICachingChannel::LOAD_BYPASS_LOCAL_CACHE_IF_BUSY |
                      nsIChannel::LOAD_MEDIA_SNIFFER_OVERRIDES_CONTENT_TYPE |
                      nsIChannel::LOAD_CALL_CONTENT_SNIFFERS);
 
   NS_ENSURE_SUCCESS(rv,rv);
 
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -204,17 +204,17 @@ HTMLTrackElement::LoadResource()
   }
 
   rv = nsContentUtils::GetSecurityManager()->
     CheckLoadURIWithPrincipal(NodePrincipal(), uri,
                               nsIScriptSecurityManager::STANDARD);
   NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
 
   int16_t shouldLoad = nsIContentPolicy::ACCEPT;
-  rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_INTERNAL_TRACK,
+  rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_MEDIA,
                                  uri,
                                  NodePrincipal(),
                                  static_cast<Element*>(this),
                                  NS_LITERAL_CSTRING("text/vtt"), // mime type
                                  nullptr, // extra
                                  &shouldLoad,
                                  nsContentUtils::GetContentPolicy(),
                                  nsContentUtils::GetSecurityManager());
@@ -231,17 +231,17 @@ HTMLTrackElement::LoadResource()
   }
 
   nsCOMPtr<nsIChannel> channel;
   nsCOMPtr<nsILoadGroup> loadGroup = OwnerDoc()->GetDocumentLoadGroup();
   rv = NS_NewChannel(getter_AddRefs(channel),
                      uri,
                      static_cast<Element*>(this),
                      nsILoadInfo::SEC_NORMAL,
-                     nsIContentPolicy::TYPE_INTERNAL_TRACK,
+                     nsIContentPolicy::TYPE_MEDIA,
                      loadGroup);
 
   NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
 
   mListener = new WebVTTListener(this);
   rv = mListener->LoadResource();
   NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
   channel->SetNotificationCallbacks(mListener);
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -886,25 +886,21 @@ ChannelMediaResource::RecreateChannel()
   if (nsContentUtils::ChannelShouldInheritPrincipal(element->NodePrincipal(),
                                                     mURI,
                                                     false, // aInheritForAboutBlank
                                                     false // aForceInherit
                                                     )) {
     securityFlags = nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
   }
 
-  MOZ_ASSERT(element->IsAnyOfHTMLElements(nsGkAtoms::audio, nsGkAtoms::video));
-  nsContentPolicyType contentPolicyType = element->IsHTMLElement(nsGkAtoms::audio) ?
-    nsIContentPolicy::TYPE_INTERNAL_AUDIO : nsIContentPolicy::TYPE_INTERNAL_VIDEO;
-
   nsresult rv = NS_NewChannel(getter_AddRefs(mChannel),
                               mURI,
                               element,
                               securityFlags,
-                              contentPolicyType,
+                              nsIContentPolicy::TYPE_MEDIA,
                               loadGroup,
                               nullptr,  // aCallbacks
                               loadFlags);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // We have cached the Content-Type, which should not change. Give a hint to
   // the channel to avoid a sniffing failure, which would be expected because we
   // are probably seeking in the middle of the bitstream, and sniffing relies
@@ -1417,27 +1413,23 @@ already_AddRefed<MediaResource> FileMedi
   if (nsContentUtils::ChannelShouldInheritPrincipal(element->NodePrincipal(),
                                                     mURI,
                                                     false, // aInheritForAboutBlank
                                                     false // aForceInherit
                                                     )) {
     securityFlags = nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
   }
 
-  MOZ_ASSERT(element->IsAnyOfHTMLElements(nsGkAtoms::audio, nsGkAtoms::video));
-  nsContentPolicyType contentPolicyType = element->IsHTMLElement(nsGkAtoms::audio) ?
-    nsIContentPolicy::TYPE_INTERNAL_AUDIO : nsIContentPolicy::TYPE_INTERNAL_VIDEO;
-
   nsCOMPtr<nsIChannel> channel;
   nsresult rv =
     NS_NewChannel(getter_AddRefs(channel),
                   mURI,
                   element,
                   securityFlags,
-                  contentPolicyType,
+                  nsIContentPolicy::TYPE_MEDIA,
                   loadGroup);
 
   if (NS_FAILED(rv))
     return nullptr;
 
   nsRefPtr<MediaResource> resource(new FileMediaResource(aDecoder, channel, mURI, GetContentType()));
   return resource.forget();
 }
--- a/dom/workers/test/serviceworkers/fetch/context/context_test.js
+++ b/dom/workers/test/serviceworkers/fetch/context/context_test.js
@@ -19,17 +19,18 @@ self.addEventListener("fetch", function(
     if (event.request.context == "imageset") {
       event.respondWith(fetch("realimg.jpg"));
     }
   } else if (event.request.url.indexOf("audio.ogg") >= 0) {
     if (event.request.context == "audio") {
       event.respondWith(fetch("realaudio.ogg"));
     }
   } else if (event.request.url.indexOf("video.ogg") >= 0) {
-    if (event.request.context == "video") {
+    // FIXME: Bug 1147668: This should be "video".
+    if (event.request.context == "audio") {
       event.respondWith(fetch("realaudio.ogg"));
     }
   } else if (event.request.url.indexOf("beacon.sjs") >= 0) {
     if (event.request.url.indexOf("queryContext") == -1) {
       event.respondWith(fetch("beacon.sjs?" + event.request.context));
     } else {
       event.respondWith(fetch(event.request));
     }
--- a/dom/workers/test/serviceworkers/fetch/context/index.html
+++ b/dom/workers/test/serviceworkers/fetch/context/index.html
@@ -298,17 +298,18 @@
     return new Promise(function(resolve, reject) {
       var video = document.createElement("video");
       var track = document.createElement("track");
       track.src = "track";
       video.appendChild(track);
       document.documentElement.appendChild(video);
       navigator.serviceWorker.addEventListener("message", function onMessage(e) {
         if (e.data.data == "track") {
-          is(e.data.context, "track", "Expected the track context on a request coming from a track");
+          // FIXME: Bug 1147668: This should be "track".
+          is(e.data.context, "audio", "Expected the audio context on a request coming from a track");
           navigator.serviceWorker.removeEventListener("message", onMessage);
           resolve();
         }
       }, false);
     });
   }
 
   function testXHR() {