browser/base/content/test/general/browser_bug517902.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Make sure that "View Image Info" loads the correct image data */
     3 function test() {
     4   waitForExplicitFinish();
     6   gBrowser.selectedTab = gBrowser.addTab();
     8   gBrowser.selectedBrowser.addEventListener("load", function () {
     9     gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
    11     var doc = gBrowser.contentDocument;
    12     var testImg = doc.getElementById("test-image");
    13     var pageInfo = BrowserPageInfo(doc, "mediaTab", testImg);
    15     pageInfo.addEventListener("load", function () {
    16       pageInfo.removeEventListener("load", arguments.callee, true);
    17       pageInfo.onImagePreviewShown.push(function () {
    18         executeSoon(function () {
    19           var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
    21           is(pageInfoImg.src, testImg.src, "selected image has the correct source");
    22           is(pageInfoImg.width, testImg.width, "selected image has the correct width");
    23           is(pageInfoImg.height, testImg.height, "selected image has the correct height");
    25           pageInfo.close();
    26           gBrowser.removeCurrentTab();
    27           finish();
    28         });
    29       });
    30     }, true);
    31   }, true);
    33   content.location =
    34     "data:text/html," +
    35     "<style type='text/css'>%23test-image,%23not-test-image {background-image: url('about:logo?c');}</style>" +
    36     "<img src='about:logo?b' height=300 width=350 alt=2 id='not-test-image'>" +
    37     "<img src='about:logo?b' height=300 width=350 alt=2>" +
    38     "<img src='about:logo?a' height=200 width=250>" +
    39     "<img src='about:logo?b' height=200 width=250 alt=1>" +
    40     "<img src='about:logo?b' height=100 width=150 alt=2 id='test-image'>";
    41 }

mercurial