michael@0: const RELATIVE_DIR = "image/test/browser/"; michael@0: const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR; michael@0: const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR; michael@0: michael@0: var chrome_root = getRootDirectory(gTestPath); michael@0: const CHROMEROOT = chrome_root; michael@0: michael@0: function getImageLoading(doc, id) { michael@0: var htmlImg = doc.getElementById(id); michael@0: return htmlImg.QueryInterface(Ci.nsIImageLoadingContent); michael@0: } michael@0: michael@0: // Tries to get the Moz debug image, imgIContainerDebug. Only works michael@0: // in a debug build. If we succeed, we call func(). michael@0: function actOnMozImage(doc, id, func) { michael@0: var imgContainer = getImageLoading(doc, id).getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST).image; michael@0: var mozImage; michael@0: try { michael@0: mozImage = imgContainer.QueryInterface(Ci.imgIContainerDebug); michael@0: } michael@0: catch (e) { michael@0: return false; michael@0: } michael@0: func(mozImage); michael@0: return true; michael@0: }