Bug 1145057 - Block drawImage() from EME media. r=roc
☠☠ backed out by acf6c6ddfbb1 ☠ ☠
authorJW Wang <jwwang@mozilla.com>
Thu, 19 Mar 2015 19:08:00 -0400
changeset 252051 9a5f8a7ad4791df6f6bdbbcbbcd0776098303527
parent 252050 1eb641d3b68e8e6f2f2c9b60e0e105902bf5974c
child 252052 3b5b22189fcf35c0342190f4fcd289084b000c45
push id1174
push usernsm.nikhil@gmail.com
push dateSun, 22 Mar 2015 01:24:25 +0000
reviewersroc
bugs1145057
milestone39.0a1
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,21 @@ CanvasRenderingContext2D::DrawImage(cons
       gfxPlatform::GetPlatform()->GetSkiaGLGlue()) {
     mozilla::gl::GLContext* gl = gfxPlatform::GetPlatform()->GetSkiaGLGlue()->GetGLContext();
 
     HTMLVideoElement* video = &image.GetAsHTMLVideoElement();
     if (!video) {
       return;
     }
 
+    if (video->ContainsRestrictedContent()) {
+      error.Throw(NS_ERROR_NOT_AVAILABLE);
+      return;
+    }
+
     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