Bug 1356514 - remove the usage of nsContentUtils::IsInPrivateBrowsing() in HTMLMediaElement.cpp. draft
authorJW Wang <jwwang@mozilla.com>
Tue, 18 Apr 2017 14:26:32 +0800
changeset 563990 1f733ead1d5a5b4a9112587b14920fcdf35d416f
parent 563979 985c719f43896aa845069b0a13a4ad606b3e17c1
child 624644 5827086909690cdf3e77ea69b220b47ec4441927
push id54494
push userjwwang@mozilla.com
push dateTue, 18 Apr 2017 07:02:51 +0000
bugs1356514, 1194891
milestone55.0a1
Bug 1356514 - remove the usage of nsContentUtils::IsInPrivateBrowsing() in HTMLMediaElement.cpp. Per bug 1194891 comment 35, use |NodePrincipal()->GetPrivateBrowsingId() > 0| instead. MozReview-Commit-ID: Cu6geuTWhGz
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4662,17 +4662,17 @@ nsresult HTMLMediaElement::InitializeDec
     NS_ConvertUTF8toUTF16 mimeUTF16(mimeType);
     const char16_t* params[] = { mimeUTF16.get(), src.get() };
     ReportLoadError("MediaLoadUnsupportedMimeType", params, ArrayLength(params));
     return NS_ERROR_FAILURE;
   }
 
   LOG(LogLevel::Debug, ("%p Created decoder %p for type %s", this, decoder.get(), mimeType.get()));
 
-  bool isPrivateBrowsing = nsContentUtils::IsInPrivateBrowsing(OwnerDoc());
+  bool isPrivateBrowsing = NodePrincipal()->GetPrivateBrowsingId() > 0;
   RefPtr<MediaResource> resource = MediaResource::Create(
     decoder->GetResourceCallback(), aChannel, isPrivateBrowsing);
 
   if (!resource) {
     decoder->Shutdown();
     return NS_ERROR_OUT_OF_MEMORY;
   }