Bug 1528909 - cross-origin checks in CanvasRenderingContext2D::DrawImage. r=aosmond, a=RyanVM DEVEDITION_66_0b10_BUILD1 DEVEDITION_66_0b10_RELEASE FIREFOX_66_0b10_BUILD1 FIREFOX_66_0b10_RELEASE
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 20 Feb 2019 22:54:04 +0000
changeset 513189 e0a8013cd9c9723b19427ca24e7202e37822e3ad
parent 513188 9013f0783507f41ec8276bdbb57a45926291075f
child 513190 fc516f2d4e9add2c343b34ebd0416440f83debc6
push id10747
push userryanvm@gmail.com
push dateThu, 21 Feb 2019 16:08:54 +0000
treeherdermozilla-beta@e0a8013cd9c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaosmond, RyanVM
bugs1528909
milestone66.0
Bug 1528909 - cross-origin checks in CanvasRenderingContext2D::DrawImage. r=aosmond, a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D20350
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/CanvasRenderingContext2D.h
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -5727,16 +5727,23 @@ bool CanvasRenderingContext2D::IsContext
   return !mIsCapturedFrameInvalid;
 }
 
 bool CanvasRenderingContext2D::ShouldForceInactiveLayer(
     LayerManager* aManager) {
   return !aManager->CanUseCanvasLayerForSize(GetSize());
 }
 
+void CanvasRenderingContext2D::SetWriteOnly() {
+  mWriteOnly = true;
+  if (mCanvasElement) {
+    mCanvasElement->SetWriteOnly();
+  }
+}
+
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CanvasPath, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CanvasPath, Release)
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CanvasPath, mParent)
 
 CanvasPath::CanvasPath(nsISupports* aParent) : mParent(aParent) {
   mPathBuilder = gfxPlatform::GetPlatform()
                      ->ScreenReferenceDrawTarget()
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -1109,17 +1109,17 @@ class CanvasRenderingContext2D final : p
     if (aPerDevPixel) *aPerDevPixel = devPixel;
     if (aPerCSSPixel) *aPerCSSPixel = cssPixel;
   }
 
   friend struct CanvasBidiProcessor;
   friend class CanvasDrawObserver;
   friend class ImageBitmap;
 
-  void SetWriteOnly() { mWriteOnly = true; }
+  void SetWriteOnly();
 
   bool IsWriteOnly() const { return mWriteOnly; }
 
   bool mWriteOnly;
 };
 
 size_t BindingJSObjectMallocBytes(CanvasRenderingContext2D* aContext);