[tbb-commits] [tor-browser] 170/311: Bug 1759527 - Ensure ImageBitmapRenderingContext checks for null surfaces. r=gfx-reviewers, jnicol a=dmeehan

gitolite role git at cupani.torproject.org
Tue Apr 26 15:29:30 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit f0f61286bb2f8b7697b454ae2b97b4d03c575b3c
Author: Andrew Osmond <aosmond at mozilla.com>
AuthorDate: Tue Mar 15 12:41:02 2022 +0000

    Bug 1759527 - Ensure ImageBitmapRenderingContext checks for null surfaces. r=gfx-reviewers,jnicol a=dmeehan
    
    This could happen when the content process cannot access the underlying
    surface directly for example.
    
    Differential Revision: https://phabricator.services.mozilla.com/D141098
---
 dom/canvas/ImageBitmapRenderingContext.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dom/canvas/ImageBitmapRenderingContext.cpp b/dom/canvas/ImageBitmapRenderingContext.cpp
index abbe989922564..35ef39e4623a8 100644
--- a/dom/canvas/ImageBitmapRenderingContext.cpp
+++ b/dom/canvas/ImageBitmapRenderingContext.cpp
@@ -102,6 +102,9 @@ ImageBitmapRenderingContext::InitializeWithDrawTarget(
 already_AddRefed<gfx::DataSourceSurface>
 ImageBitmapRenderingContext::MatchWithIntrinsicSize() {
   RefPtr<gfx::SourceSurface> surface = mImage->GetAsSourceSurface();
+  if (!surface) {
+    return nullptr;
+  }
   RefPtr<gfx::DataSourceSurface> temp = gfx::Factory::CreateDataSourceSurface(
       gfx::IntSize(mWidth, mHeight), surface->GetFormat());
   if (!temp) {
@@ -195,6 +198,10 @@ ImageBitmapRenderingContext::GetSurfaceSnapshot(
   }
 
   RefPtr<gfx::SourceSurface> surface = mImage->GetAsSourceSurface();
+  if (!surface) {
+    return nullptr;
+  }
+
   if (surface->GetSize() != gfx::IntSize(mWidth, mHeight)) {
     return MatchWithIntrinsicSize();
   }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list