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

Unified Diff: LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html

Issue 1047803005: Allow the "img.src='';img.src='.." idiom to clear down images immediately. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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
Index: LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html
diff --git a/LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html b/LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html
new file mode 100644
index 0000000000000000000000000000000000000000..8f3c429d54f439b140717f001f46264c25455c7c
--- /dev/null
+++ b/LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+img = new Image();
+var testImage = 'resources/green.jpg';
+img.onload = function(){
+ img.removeAttribute('src');
+ if (img.naturalWidth > 0) {
+ document.getElementById('result').textContent = "FAIL Natural width is : " + img.naturalWidth;
+ if (window.testRunner)
+ testRunner.notifyDone();
+ return;
+ }
+ document.getElementById('result').textContent = "PASS";
+ if (window.testRunner)
+ testRunner.notifyDone();
+};
+setTimeout("img.src = '" + testImage + "';", 0);
esprehn 2015/04/06 20:29:40 don't use eval, use a closure.
+</script>
+<div id="console">
+ crbug.com/468915: Resetting or removing the src attribute should reset the image immediately, rather than waiting for an asynchronous load to do it.<br>
+</div>
+<div id="result">FAIL</div>
esprehn 2015/04/06 20:29:40 Would it be possible to use js-test.js instead?
+

Powered by Google App Engine
This is Rietveld 408576698