1 // Test for bug 592641 - Image document doesn't show dimensions of cached images
4 var testPath = "http://mochi.test:8888/browser/dom/html/test/";
5 var ctx = { loadsDone: 0 };
7 // Entry point from Mochikit
9 waitForExplicitFinish();
11 ctx.tab1 = BrowserTestUtils.addTab(gBrowser, testPath + "bug592641_img.jpg");
12 ctx.tab1Browser = gBrowser.getBrowserForTab(ctx.tab1);
13 BrowserTestUtils.browserLoaded(ctx.tab1Browser).then(load1Soon);
16 function checkTitle(title) {
19 /^bug592641_img\.jpg \(JPEG Image, 1500\u00A0\u00D7\u00A01500 pixels\)/.test(
22 "Title should be correct on load #" + ctx.loadsDone + ", was: " + title
26 function load1Soon() {
27 // onload is fired in OnStopDecode, so let's use executeSoon() to make sure
28 // that any other OnStopDecode event handlers get the chance to fire first.
29 executeSoon(load1Done);
32 function load1Done() {
34 var title = ctx.tab1Browser.contentTitle;
37 // Try loading the same image in a new tab to make sure things work in
39 ctx.tab2 = BrowserTestUtils.addTab(gBrowser, testPath + "bug592641_img.jpg");
40 ctx.tab2Browser = gBrowser.getBrowserForTab(ctx.tab2);
41 BrowserTestUtils.browserLoaded(ctx.tab2Browser).then(load2Soon);
44 function load2Soon() {
45 // onload is fired in OnStopDecode, so let's use executeSoon() to make sure
46 // that any other OnStopDecode event handlers get the chance to fire first.
47 executeSoon(load2Done);
50 function load2Done() {
52 var title = ctx.tab2Browser.contentTitle;
56 gBrowser.removeTab(ctx.tab1);
57 gBrowser.removeTab(ctx.tab2);