Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContext.cpp

Issue 96203003: Switch HTMLCanvasElement over to new-style ExceptionState. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Capitalize the 'tainted' error messages Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 5128 matching lines...) Expand 10 before | Expand all | Expand 10 after
5139 if (!image || !image->cachedImage()) { 5139 if (!image || !image->cachedImage()) {
5140 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no im age"); 5140 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no im age");
5141 return false; 5141 return false;
5142 } 5142 }
5143 const KURL& url = image->cachedImage()->response().url(); 5143 const KURL& url = image->cachedImage()->response().url();
5144 if (url.isNull() || url.isEmpty() || !url.isValid()) { 5144 if (url.isNull() || url.isEmpty() || !url.isValid()) {
5145 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "inval id image"); 5145 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "inval id image");
5146 return false; 5146 return false;
5147 } 5147 }
5148 if (wouldTaintOrigin(image)) { 5148 if (wouldTaintOrigin(image)) {
5149 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute(fun ctionName, "WebGLRenderingContext", "the cross-origin image at " + url.elidedStr ing() + " may not be loaded.")); 5149 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute(fun ctionName, "WebGLRenderingContext", "The cross-origin image at " + url.elidedStr ing() + " may not be loaded."));
5150 return false; 5150 return false;
5151 } 5151 }
5152 return true; 5152 return true;
5153 } 5153 }
5154 5154
5155 bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionState& exceptionState) 5155 bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionState& exceptionState)
5156 { 5156 {
5157 if (!canvas || !canvas->buffer()) { 5157 if (!canvas || !canvas->buffer()) {
5158 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no ca nvas"); 5158 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no ca nvas");
5159 return false; 5159 return false;
5160 } 5160 }
5161 if (wouldTaintOrigin(canvas)) { 5161 if (wouldTaintOrigin(canvas)) {
5162 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute(fun ctionName, "WebGLRenderingContext", "tainted canvases may not be loaded.")); 5162 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute(fun ctionName, "WebGLRenderingContext", "Tainted canvases may not be loaded."));
5163 return false; 5163 return false;
5164 } 5164 }
5165 return true; 5165 return true;
5166 } 5166 }
5167 5167
5168 bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, H TMLVideoElement* video, ExceptionState& exceptionState) 5168 bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, H TMLVideoElement* video, ExceptionState& exceptionState)
5169 { 5169 {
5170 if (!video || !video->videoWidth() || !video->videoHeight()) { 5170 if (!video || !video->videoWidth() || !video->videoHeight()) {
5171 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no vi deo"); 5171 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no vi deo");
5172 return false; 5172 return false;
5173 } 5173 }
5174 if (wouldTaintOrigin(video)) { 5174 if (wouldTaintOrigin(video)) {
5175 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute(fun ctionName, "WebGLRenderingContext", "the video element contains cross-origin dat a, and may not be loaded.")); 5175 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute(fun ctionName, "WebGLRenderingContext", "The video element contains cross-origin dat a, and may not be loaded."));
5176 return false; 5176 return false;
5177 } 5177 }
5178 return true; 5178 return true;
5179 } 5179 }
5180 5180
5181 bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GC3Denu m mode, GC3Dint first, GC3Dsizei count) 5181 bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GC3Denu m mode, GC3Dint first, GC3Dsizei count)
5182 { 5182 {
5183 if (isContextLost() || !validateDrawMode(functionName, mode)) 5183 if (isContextLost() || !validateDrawMode(functionName, mode))
5184 return false; 5184 return false;
5185 5185
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
5613 if (m_textureUnits[i].m_texture2DBinding 5613 if (m_textureUnits[i].m_texture2DBinding
5614 || m_textureUnits[i].m_textureCubeMapBinding) { 5614 || m_textureUnits[i].m_textureCubeMapBinding) {
5615 m_onePlusMaxNonDefaultTextureUnit = i + 1; 5615 m_onePlusMaxNonDefaultTextureUnit = i + 1;
5616 return; 5616 return;
5617 } 5617 }
5618 } 5618 }
5619 m_onePlusMaxNonDefaultTextureUnit = 0; 5619 m_onePlusMaxNonDefaultTextureUnit = 0;
5620 } 5620 }
5621 5621
5622 } // namespace WebCore 5622 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698