Skip to content

Instantly share code, notes, and snippets.

@neonux
Created May 24, 2011 12:38
Show Gist options
  • Save neonux/988626 to your computer and use it in GitHub Desktop.
Save neonux/988626 to your computer and use it in GitHub Desktop.
[PATCH] Do not perform image read access check when running in privileged context.
commit 85cfc6e739b07e5b4dcc161475f1f777fb2a8fd3
Author: Cedric Vivier <[email protected]>
Date: Tue May 24 19:33:49 2011 +0700
Do not perform image read access check when we running in privileged context.
---
content/canvas/src/WebGLContextGL.cpp | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/content/canvas/src/WebGLContextGL.cpp b/content/canvas/src/WebGLContextGL.cpp
index 2788a60..9d147e9 100644
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -3312,7 +3312,10 @@ WebGLContext::DOMElementToImageSurface(nsIDOMElement *imageOrCanvas,
if (!res.mSurface)
return NS_ERROR_FAILURE;
- CanvasUtils::DoDrawImageSecurityCheck(HTMLCanvasElement(), res.mPrincipal, res.mIsWriteOnly);
+ // check that the canvas has read access to the image bits
+ if (!nsContentUtils::IsCallerTrustedForRead()) {
+ CanvasUtils::DoDrawImageSecurityCheck(HTMLCanvasElement(), res.mPrincipal, res.mIsWriteOnly);
+ }
if (res.mSurface->GetType() != gfxASurface::SurfaceTypeImage) {
// SurfaceFromElement lied!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment