image/test/browser/head.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 const RELATIVE_DIR = "image/test/browser/";
     2 const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
     3 const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR;
     5 var chrome_root = getRootDirectory(gTestPath);
     6 const CHROMEROOT = chrome_root;
     8 function getImageLoading(doc, id) {
     9   var htmlImg = doc.getElementById(id);
    10   return htmlImg.QueryInterface(Ci.nsIImageLoadingContent);
    11 }
    13 // Tries to get the Moz debug image, imgIContainerDebug. Only works
    14 // in a debug build. If we succeed, we call func().
    15 function actOnMozImage(doc, id, func) {
    16   var imgContainer = getImageLoading(doc, id).getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST).image;
    17   var mozImage;
    18   try {
    19     mozImage = imgContainer.QueryInterface(Ci.imgIContainerDebug);
    20   }
    21   catch (e) {
    22     return false;
    23   }
    24   func(mozImage);
    25   return true;
    26 }

mercurial