OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 return ScriptPromise(); | 333 return ScriptPromise(); |
334 } | 334 } |
335 if (readyState() <= HTMLMediaElement::HAVE_METADATA) { | 335 if (readyState() <= HTMLMediaElement::HAVE_METADATA) { |
336 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t's player has no current data."); | 336 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t's player has no current data."); |
337 return ScriptPromise(); | 337 return ScriptPromise(); |
338 } | 338 } |
339 if (!sw || !sh) { | 339 if (!sw || !sh) { |
340 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 340 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
341 return ScriptPromise(); | 341 return ScriptPromise(); |
342 } | 342 } |
343 if (!hasSingleSecurityOrigin()) { | 343 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toDOMWindow()->document())); |
344 exceptionState.throwSecurityError("The source video contains image data
from multiple origins."); | |
345 return ScriptPromise(); | |
346 } | |
347 if (!webMediaPlayer()->didPassCORSAccessCheck() | |
348 && eventTarget.toDOMWindow()->document()->securityOrigin()->taintsCanvas
(currentSrc())) { | |
349 exceptionState.throwSecurityError("Cross-origin access to the source vid
eo is denied."); | |
350 return ScriptPromise(); | |
351 } | |
352 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh))); | |
353 } | 344 } |
354 | 345 |
355 } // namespace blink | 346 } // namespace blink |
OLD | NEW |