1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_bug517902.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +/* Make sure that "View Image Info" loads the correct image data */ 1.5 + 1.6 +function test() { 1.7 + waitForExplicitFinish(); 1.8 + 1.9 + gBrowser.selectedTab = gBrowser.addTab(); 1.10 + 1.11 + gBrowser.selectedBrowser.addEventListener("load", function () { 1.12 + gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); 1.13 + 1.14 + var doc = gBrowser.contentDocument; 1.15 + var testImg = doc.getElementById("test-image"); 1.16 + var pageInfo = BrowserPageInfo(doc, "mediaTab", testImg); 1.17 + 1.18 + pageInfo.addEventListener("load", function () { 1.19 + pageInfo.removeEventListener("load", arguments.callee, true); 1.20 + pageInfo.onImagePreviewShown.push(function () { 1.21 + executeSoon(function () { 1.22 + var pageInfoImg = pageInfo.document.getElementById("thepreviewimage"); 1.23 + 1.24 + is(pageInfoImg.src, testImg.src, "selected image has the correct source"); 1.25 + is(pageInfoImg.width, testImg.width, "selected image has the correct width"); 1.26 + is(pageInfoImg.height, testImg.height, "selected image has the correct height"); 1.27 + 1.28 + pageInfo.close(); 1.29 + gBrowser.removeCurrentTab(); 1.30 + finish(); 1.31 + }); 1.32 + }); 1.33 + }, true); 1.34 + }, true); 1.35 + 1.36 + content.location = 1.37 + "data:text/html," + 1.38 + "<style type='text/css'>%23test-image,%23not-test-image {background-image: url('about:logo?c');}</style>" + 1.39 + "<img src='about:logo?b' height=300 width=350 alt=2 id='not-test-image'>" + 1.40 + "<img src='about:logo?b' height=300 width=350 alt=2>" + 1.41 + "<img src='about:logo?a' height=200 width=250>" + 1.42 + "<img src='about:logo?b' height=200 width=250 alt=1>" + 1.43 + "<img src='about:logo?b' height=100 width=150 alt=2 id='test-image'>"; 1.44 +}