mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 938772. Don't give the anonymous poster <img> an empty 'src' attribute if we don't have a 'poster' attribute. r=cpearce
--HG-- extra : rebase_source : 22b84f86e54cac3304345586ecfab0037633cc36
This commit is contained in:
parent
811e91f1d5
commit
b60d603e72
@ -92,8 +92,7 @@ nsVideoFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
// And now have it update its internal state
|
||||
element->UpdateState(false);
|
||||
|
||||
nsresult res = UpdatePosterSource(false);
|
||||
NS_ENSURE_SUCCESS(res,res);
|
||||
UpdatePosterSource(false);
|
||||
|
||||
if (!aElements.AppendElement(mPosterImage))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -592,20 +591,22 @@ nsVideoFrame::GetVideoIntrinsicSize(nsRenderingContext *aRenderingContext)
|
||||
nsPresContext::CSSPixelsToAppUnits(size.height));
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
nsVideoFrame::UpdatePosterSource(bool aNotify)
|
||||
{
|
||||
NS_ASSERTION(HasVideoElement(), "Only call this on <video> elements.");
|
||||
HTMLVideoElement* element = static_cast<HTMLVideoElement*>(GetContent());
|
||||
|
||||
nsAutoString posterStr;
|
||||
element->GetPoster(posterStr);
|
||||
nsresult res = mPosterImage->SetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::src,
|
||||
posterStr,
|
||||
aNotify);
|
||||
NS_ENSURE_SUCCESS(res,res);
|
||||
return NS_OK;
|
||||
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::poster)) {
|
||||
nsAutoString posterStr;
|
||||
element->GetPoster(posterStr);
|
||||
mPosterImage->SetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::src,
|
||||
posterStr,
|
||||
aNotify);
|
||||
} else {
|
||||
mPosterImage->UnsetAttr(kNameSpaceID_None, nsGkAtoms::poster, aNotify);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -614,8 +615,7 @@ nsVideoFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
int32_t aModType)
|
||||
{
|
||||
if (aAttribute == nsGkAtoms::poster && HasVideoElement()) {
|
||||
nsresult res = UpdatePosterSource(true);
|
||||
NS_ENSURE_SUCCESS(res,res);
|
||||
UpdatePosterSource(true);
|
||||
}
|
||||
return nsContainerFrame::AttributeChanged(aNameSpaceID,
|
||||
aAttribute,
|
||||
|
@ -112,7 +112,7 @@ protected:
|
||||
// Sets the mPosterImage's src attribute to be the video's poster attribute,
|
||||
// if we're the frame for a video element. Only call on frames for video
|
||||
// elements, not for frames for audio elements.
|
||||
nsresult UpdatePosterSource(bool aNotify);
|
||||
void UpdatePosterSource(bool aNotify);
|
||||
|
||||
virtual ~nsVideoFrame();
|
||||
|
||||
|
@ -79,6 +79,7 @@ support-files = bug633762_iframe.html
|
||||
[test_bug831780.html]
|
||||
[test_bug841361.html]
|
||||
[test_bug904810.html]
|
||||
[test_bug938772.html]
|
||||
[test_contained_plugin_transplant.html]
|
||||
[test_image_selection.html]
|
||||
[test_image_selection_2.html]
|
||||
|
23
layout/generic/test/test_bug938772.html
Normal file
23
layout/generic/test/test_bug938772.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=938772
|
||||
-->
|
||||
<title>Test for Bug 938772</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=938772">Mozilla Bug 938772</a>
|
||||
<p id="display"></p>
|
||||
<iframe id="i"
|
||||
src="data:text/html,<base href='http://basetag/basetag'><video id='v' onerror='v.failed=true'></video>"></iframe>
|
||||
<pre id="test">
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
i.onload = function() {
|
||||
ok(!i.contentDocument.getElementById("v").failed,
|
||||
"Check whether an error was reported");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user