Bug 608261. Set img.complete to false while the image has a pending request. r=sicking

This commit is contained in:
Boris Zbarsky 2015-02-04 21:05:17 -05:00
Родитель e525b7de36
Коммит 013f9a6875
3 изменённых файлов: 42 добавлений и 0 удалений

Просмотреть файл

@ -207,6 +207,10 @@ HTMLImageElement::Complete()
return true;
}
if (mPendingRequest) {
return false;
}
uint32_t status;
mCurrentRequest->GetImageStatus(&status);
return

Просмотреть файл

@ -583,3 +583,4 @@ support-files = file_bug871161-1.html file_bug871161-2.html
[test_bug1081037.html]
[test_window_open_close.html]
skip-if = buildapp == 'b2g' # bug 1129014
[test_img_complete.html]

Просмотреть файл

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=608261
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 608261</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 608261 **/
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=608261">Mozilla Bug 608261</a>
<p id="display"><img src="image.png"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
addLoadEvent(function() {
var img = document.querySelector("img");
ok(img.complete, "By onload, image should have loaded");
img.src = "image.png?cachebust";
ok(!img.complete, "Now that we're loading we should no longer be complete");
img.onload = function() {
ok(img.complete, "The new thing should have loaded.");
SimpleTest.finish();
}
});
</script>
</pre>
</body>
</html>