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

Unified Diff: Source/modules/imagebitmap/ImageBitmapFactories.cpp

Issue 320843002: Safeguard for webMediaPlayer() access (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/imagebitmap/ImageBitmapFactories.cpp
diff --git a/Source/modules/imagebitmap/ImageBitmapFactories.cpp b/Source/modules/imagebitmap/ImageBitmapFactories.cpp
index 38be61725f830648ec68dc7202287b4fd8b0fae4..c7ebf2dffab69ab52542a92b2dc9382861ba971d 100644
--- a/Source/modules/imagebitmap/ImageBitmapFactories.cpp
+++ b/Source/modules/imagebitmap/ImageBitmapFactories.cpp
@@ -124,6 +124,10 @@ ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState,
// This variant does not work in worker threads.
ASSERT(eventTarget.toDOMWindow());
+ if (!video->webMediaPlayer()) {
+ exceptionState.throwDOMException(InvalidStateError, "No player can be retrieved from the provided video element.");
+ return ScriptPromise();
+ }
if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) {
exceptionState.throwDOMException(InvalidStateError, "The provided element has not retrieved data.");
return ScriptPromise();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698