Bug 1145057 - Block drawImage() from EME media. r=roc.
authorJW Wang <jwwang@mozilla.com>
Sun, 22 Mar 2015 18:09:18 +0800
changeset 265321 56f07a799bd170e3ad0b48f338bd8b2351809c59
parent 265320 706ee8458ffb6f06da7874cb870d02c3f5696f54
child 265322 a23240479b9b1fb428def556bcedf7045b31da68
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1145057
milestone39.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 1145057 - Block drawImage() from EME media. r=roc.
dom/canvas/CanvasRenderingContext2D.cpp
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -4213,16 +4213,23 @@ CanvasRenderingContext2D::DrawImage(cons
       gfxPlatform::GetPlatform()->GetSkiaGLGlue()) {
     mozilla::gl::GLContext* gl = gfxPlatform::GetPlatform()->GetSkiaGLGlue()->GetGLContext();
 
     HTMLVideoElement* video = &image.GetAsHTMLVideoElement();
     if (!video) {
       return;
     }
 
+#ifdef MOZ_EME
+    if (video->ContainsRestrictedContent()) {
+      error.Throw(NS_ERROR_NOT_AVAILABLE);
+      return;
+    }
+#endif
+
     uint16_t readyState;
     if (NS_SUCCEEDED(video->GetReadyState(&readyState)) &&
         readyState < nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA) {
       // still loading, just return
       return;
     }
 
     // If it doesn't have a principal, just bail