image/test/browser/head.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/image/test/browser/head.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +const RELATIVE_DIR = "image/test/browser/";
     1.5 +const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
     1.6 +const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR;
     1.7 +
     1.8 +var chrome_root = getRootDirectory(gTestPath);
     1.9 +const CHROMEROOT = chrome_root;
    1.10 +
    1.11 +function getImageLoading(doc, id) {
    1.12 +  var htmlImg = doc.getElementById(id);
    1.13 +  return htmlImg.QueryInterface(Ci.nsIImageLoadingContent);
    1.14 +}
    1.15 +
    1.16 +// Tries to get the Moz debug image, imgIContainerDebug. Only works
    1.17 +// in a debug build. If we succeed, we call func().
    1.18 +function actOnMozImage(doc, id, func) {
    1.19 +  var imgContainer = getImageLoading(doc, id).getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST).image;
    1.20 +  var mozImage;
    1.21 +  try {
    1.22 +    mozImage = imgContainer.QueryInterface(Ci.imgIContainerDebug);
    1.23 +  }
    1.24 +  catch (e) {
    1.25 +    return false;
    1.26 +  }
    1.27 +  func(mozImage);
    1.28 +  return true;
    1.29 +}

mercurial