|
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 |
|
5 var chrome_root = getRootDirectory(gTestPath); |
|
6 const CHROMEROOT = chrome_root; |
|
7 |
|
8 function getImageLoading(doc, id) { |
|
9 var htmlImg = doc.getElementById(id); |
|
10 return htmlImg.QueryInterface(Ci.nsIImageLoadingContent); |
|
11 } |
|
12 |
|
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 } |