Bug 1325053 - Remove media attribute code and set the currentSrc attribute to urlString after type checking in HTMLMediaElement. r?jwwang draft
authorctai <ctai@mozilla.com>
Wed, 21 Dec 2016 20:42:48 +0800
changeset 452276 ebf51fbdd05a2307736d3c9001d3aa15dbe7f804
parent 452275 9a93f41658aa8569cd45b191faae189c040404e7
child 452277 4b24837e8734670ede9f9417bc21d3f9644d2117
push id39369
push userbmo:ctai@mozilla.com
push dateWed, 21 Dec 2016 13:50:22 +0000
reviewersjwwang
bugs1325053
milestone53.0a1
Bug 1325053 - Remove media attribute code and set the currentSrc attribute to urlString after type checking in HTMLMediaElement. r?jwwang According to current WhatWG HTML spec, the checking of media attribute in SourceElement is removed. Fix the Gecko code to reflect current spec. MozReview-Commit-ID: 43d9zL9Fvih
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2158,28 +2158,19 @@ void HTMLMediaElement::LoadFromSourceChi
         OwnerDoc(), type, canPlay != CANPLAY_NO, __func__);
       if (canPlay == CANPLAY_NO) {
         const char16_t* params[] = { type.get(), src.get() };
         ReportLoadError("MediaLoadUnsupportedTypeAttribute", params, ArrayLength(params));
         DealWithFailedElement(child);
         return;
       }
     }
-    nsAutoString media;
     HTMLSourceElement *childSrc = HTMLSourceElement::FromContent(child);
-    MOZ_ASSERT(childSrc, "Expect child to be HTMLSourceElement");
-    if (childSrc && !childSrc->MatchesCurrentMedia()) {
-      const char16_t* params[] = { media.get(), src.get() };
-      ReportLoadError("MediaLoadSourceMediaNotMatched", params, ArrayLength(params));
-      DealWithFailedElement(child);
-      return;
-    }
-    LOG(LogLevel::Debug, ("%p Trying load from <source>=%s type=%s media=%s", this,
-      NS_ConvertUTF16toUTF8(src).get(), NS_ConvertUTF16toUTF8(type).get(),
-      NS_ConvertUTF16toUTF8(media).get()));
+    LOG(LogLevel::Debug, ("%p Trying load from <source>=%s type=%s", this,
+      NS_ConvertUTF16toUTF8(src).get(), NS_ConvertUTF16toUTF8(type).get()));
 
     nsCOMPtr<nsIURI> uri;
     NewURIFromString(src, getter_AddRefs(uri));
     if (!uri) {
       const char16_t* params[] = { src.get() };
       ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
       DealWithFailedElement(child);
       return;