-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 466586 - Test to ensure that we don't have to reload an image tha…
…t exists in a document.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<!-- | ||
https://bugzilla.mozilla.org/show_bug.cgi?id=466586 | ||
--> | ||
<head> | ||
<title>Test for Bug 466586</title> | ||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script> | ||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> | ||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> | ||
</head> | ||
<body onload="loadSmall()"> | ||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=89419">Mozilla Bug 466586</a> | ||
<p id="display"></p> | ||
<div id="content" style="display: none"> | ||
<img src="big.png" width="100" height="100" id="big" /> | ||
</div> | ||
<pre id="test"> | ||
<script type="application/javascript"> | ||
|
||
SimpleTest.waitForExplicitFinish(); | ||
|
||
// We have loaded the large png with id "big". We want to test if it'll be | ||
// kicked out of the cache and thus have to be reloaded, but to ensure that, we | ||
// need to get the cache to look at what's there. So we load another image, | ||
// this one small. | ||
function loadSmall() | ||
{ | ||
var small = new Image(); | ||
|
||
small.onload = smallLoaded; | ||
small.src="red.png"; | ||
} | ||
|
||
function smallLoaded() | ||
{ | ||
// Make sure that we don't need another load. | ||
var big = document.getElementById('big'); | ||
var img = new Image(); | ||
img.src = big.src; | ||
ok(img.width != 0); | ||
|
||
SimpleTest.finish(); | ||
} | ||
</script> | ||
</pre> | ||
</body> | ||
</html> |