Bug 1430215 - Check on the principal in mozilla::dom::CheckSecurityForHTMLElements in case SurfaceFromElement returns an incomplete result, r=aosmond
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 20 Apr 2018 07:29:12 +0200
changeset 785500 8bcaeaf2a5a02a28e88a932c50fef64cd09df8b2
parent 785499 36f208401c8766b95e3b3f5a6bfdf733c0a796bf
child 785501 096da0066db8e6b4c825e82024491c69762a4ae7
push id107236
push userbmo:emilio@crisal.io
push dateFri, 20 Apr 2018 08:31:50 +0000
reviewersaosmond
bugs1430215
milestone61.0a1
Bug 1430215 - Check on the principal in mozilla::dom::CheckSecurityForHTMLElements in case SurfaceFromElement returns an incomplete result, r=aosmond
dom/canvas/ImageBitmap.cpp
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -431,19 +431,17 @@ private:
   gfx::SurfaceFormat mFormat;
   gfx::IntSize mSize;
   const Maybe<IntRect>& mCropRect;
 };
 
 static bool
 CheckSecurityForHTMLElements(bool aIsWriteOnly, bool aCORSUsed, nsIPrincipal* aPrincipal)
 {
-  MOZ_ASSERT(aPrincipal);
-
-  if (aIsWriteOnly) {
+  if (aIsWriteOnly || !aPrincipal) {
     return false;
   }
 
   if (!aCORSUsed) {
     nsIGlobalObject* incumbentSettingsObject = GetIncumbentGlobal();
     if (NS_WARN_IF(!incumbentSettingsObject)) {
       return false;
     }