head.js 824 B

123456789101112131415161718192021222324252627
  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;
  4. var chrome_root = getRootDirectory(gTestPath);
  5. const CHROMEROOT = chrome_root;
  6. function getImageLoading(doc, id) {
  7. var htmlImg = doc.getElementById(id);
  8. return htmlImg.QueryInterface(Ci.nsIImageLoadingContent);
  9. }
  10. // Tries to get the Moz debug image, imgIContainerDebug. Only works
  11. // in a debug build. If we succeed, we call func().
  12. function actOnMozImage(doc, id, func) {
  13. var imgContainer = getImageLoading(doc, id).getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST).image;
  14. var mozImage;
  15. try {
  16. mozImage = imgContainer.QueryInterface(Ci.imgIContainerDebug);
  17. }
  18. catch (e) {
  19. return false;
  20. }
  21. func(mozImage);
  22. return true;
  23. }