content/html/document/test/browser_bug592641.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 // Test for bug 592641 - Image document doesn't show dimensions of cached images
michael@0 2
michael@0 3 // Globals
michael@0 4 var testPath = "http://mochi.test:8888/browser/content/html/document/test/";
michael@0 5 var ctx = {loadsDone : 0};
michael@0 6
michael@0 7 // Entry point from Mochikit
michael@0 8 function test() {
michael@0 9
michael@0 10 waitForExplicitFinish();
michael@0 11
michael@0 12 ctx.tab1 = gBrowser.addTab(testPath + "bug592641_img.jpg");
michael@0 13 ctx.tab1Browser = gBrowser.getBrowserForTab(ctx.tab1);
michael@0 14 ctx.tab1Browser.addEventListener("load", load1Soon, true);
michael@0 15 }
michael@0 16
michael@0 17 function checkTitle(title) {
michael@0 18
michael@0 19 ctx.loadsDone++;
michael@0 20 ok(/^bug592641_img\.jpg \(JPEG Image, 1500\u00A0\u00D7\u00A01500 pixels\)/.test(title),
michael@0 21 "Title should be correct on load #" + ctx.loadsDone);
michael@0 22 }
michael@0 23
michael@0 24 function load1Soon() {
michael@0 25 ctx.tab1Browser.removeEventListener("load", load1Soon, true);
michael@0 26 // onload is fired in OnStopDecode, so let's use executeSoon() to make sure
michael@0 27 // that any other OnStopDecode event handlers get the chance to fire first.
michael@0 28 executeSoon(load1Done);
michael@0 29 }
michael@0 30
michael@0 31 function load1Done() {
michael@0 32 // Check the title
michael@0 33 var title = ctx.tab1Browser.contentWindow.document.title;
michael@0 34 checkTitle(title);
michael@0 35
michael@0 36 // Try loading the same image in a new tab to make sure things work in
michael@0 37 // the cached case.
michael@0 38 ctx.tab2 = gBrowser.addTab(testPath + "bug592641_img.jpg");
michael@0 39 ctx.tab2Browser = gBrowser.getBrowserForTab(ctx.tab2);
michael@0 40 ctx.tab2Browser.addEventListener("load", load2Soon, true);
michael@0 41 }
michael@0 42
michael@0 43 function load2Soon() {
michael@0 44 ctx.tab2Browser.removeEventListener("load", load2Soon, true);
michael@0 45 // onload is fired in OnStopDecode, so let's use executeSoon() to make sure
michael@0 46 // that any other OnStopDecode event handlers get the chance to fire first.
michael@0 47 executeSoon(load2Done);
michael@0 48 }
michael@0 49
michael@0 50 function load2Done() {
michael@0 51 // Check the title
michael@0 52 var title = ctx.tab2Browser.contentWindow.document.title;
michael@0 53 checkTitle(title);
michael@0 54
michael@0 55 // Clean up
michael@0 56 gBrowser.removeTab(ctx.tab1);
michael@0 57 gBrowser.removeTab(ctx.tab2);
michael@0 58
michael@0 59 // Test done
michael@0 60 finish();
michael@0 61 }

mercurial