Bug 1228677 - Do not enforce CORS when loading file for MediaResource. r=cpearce
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Sun, 06 Mar 2016 19:17:43 -0800
changeset 323342 30fa1cfd2ec8f5fbde21601f0f5d67406cd625a5
parent 323341 4d005bc5a46268596e25a146dd1c172aaaf1ff60
child 323343 e0fd2136c897db4951017586f87090bd8315122e
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1228677
milestone47.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
Bug 1228677 - Do not enforce CORS when loading file for MediaResource. r=cpearce MozReview-Commit-ID: 4RNWLi1QQC7
dom/media/MediaResource.cpp
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -1282,25 +1282,16 @@ nsresult FileMediaResource::Open(nsIStre
       NS_ENSURE_SUCCESS(rv, rv);
 
       rv = NS_NewLocalFileInputStream(
         getter_AddRefs(mInput), file, -1, -1, nsIFileInputStream::SHARE_DELETE);
     } else if (IsBlobURI(mURI)) {
       rv = NS_GetStreamForBlobURI(mURI, getter_AddRefs(mInput));
     }
   } else {
-
-#ifdef DEBUG
-    {
-      nsCOMPtr<nsILoadInfo> loadInfo = mChannel->GetLoadInfo();
-      MOZ_ASSERT((loadInfo->GetSecurityMode() &
-                 nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS) == 0,
-                 "can not enforce CORS when calling Open2()");
-    }
-#endif
     rv = mChannel->Open2(getter_AddRefs(mInput));
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   mSeekable = do_QueryInterface(mInput);
   if (!mSeekable) {
     // XXX The file may just be a .url or similar
     // shortcut that points to a Web site. We need to fix this by
@@ -1355,32 +1346,28 @@ already_AddRefed<MediaResource> FileMedi
   dom::HTMLMediaElement* element = owner->GetMediaElement();
   if (!element) {
     // The decoder is being shut down, so we can't clone
     return nullptr;
   }
   nsCOMPtr<nsILoadGroup> loadGroup = element->GetDocumentLoadGroup();
   NS_ENSURE_TRUE(loadGroup, nullptr);
 
-  nsSecurityFlags securityFlags = element->ShouldCheckAllowOrigin()
-                                  ? nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS
-                                  : nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS;
-
   MOZ_ASSERT(element->IsAnyOfHTMLElements(nsGkAtoms::audio, nsGkAtoms::video));
   nsContentPolicyType contentPolicyType = element->IsHTMLElement(nsGkAtoms::audio) ?
     nsIContentPolicy::TYPE_INTERNAL_AUDIO : nsIContentPolicy::TYPE_INTERNAL_VIDEO;
 
   nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL | nsIChannel::LOAD_CLASSIFY_URI;
 
   nsCOMPtr<nsIChannel> channel;
   nsresult rv =
     NS_NewChannel(getter_AddRefs(channel),
                   mURI,
                   element,
-                  securityFlags,
+                  nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS,
                   contentPolicyType,
                   loadGroup,
                   nullptr,  // aCallbacks
                   loadFlags);
 
   if (NS_FAILED(rv))
     return nullptr;