Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
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 }