Bug 1349459 part 1 - mark element as tainted when CreateImageBitmap() is used; r?jwwang,mattwoodrow
In this patch, we simply modify the ImageBitmap::createInternal(..., HTMLMediaElement&, ...) method to use
HTMLMediaElement::GetCurrentImage() utility and HTMLMediaElement::GetCurrentImage() marks the
videl element as tainted.
MozReview-Commit-ID: KyN2xRqKVrr
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -822,25 +822,17 @@ ImageBitmap::CreateInternal(nsIGlobalObj
nsCOMPtr<nsIPrincipal> principal = aVideoEl.GetCurrentVideoPrincipal();
bool CORSUsed = aVideoEl.GetCORSMode() != CORS_NONE;
if (!CheckSecurityForHTMLElements(false, CORSUsed, principal)) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
// Create ImageBitmap.
- ImageContainer *container = aVideoEl.GetImageContainer();
-
- if (!container) {
- aRv.Throw(NS_ERROR_NOT_AVAILABLE);
- return nullptr;
- }
-
- AutoLockImage lockImage(container);
- layers::Image* data = lockImage.GetImage();
+ RefPtr<layers::Image> data = aVideoEl.GetCurrentImage();
if (!data) {
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
RefPtr<ImageBitmap> ret = new ImageBitmap(aGlobal, data);
// Set the picture rectangle.
if (ret && aCropRect.isSome()) {