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.
michael@0 | 1 | const RELATIVE_DIR = "image/test/browser/"; |
michael@0 | 2 | const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR; |
michael@0 | 3 | const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR; |
michael@0 | 4 | |
michael@0 | 5 | var chrome_root = getRootDirectory(gTestPath); |
michael@0 | 6 | const CHROMEROOT = chrome_root; |
michael@0 | 7 | |
michael@0 | 8 | function getImageLoading(doc, id) { |
michael@0 | 9 | var htmlImg = doc.getElementById(id); |
michael@0 | 10 | return htmlImg.QueryInterface(Ci.nsIImageLoadingContent); |
michael@0 | 11 | } |
michael@0 | 12 | |
michael@0 | 13 | // Tries to get the Moz debug image, imgIContainerDebug. Only works |
michael@0 | 14 | // in a debug build. If we succeed, we call func(). |
michael@0 | 15 | function actOnMozImage(doc, id, func) { |
michael@0 | 16 | var imgContainer = getImageLoading(doc, id).getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST).image; |
michael@0 | 17 | var mozImage; |
michael@0 | 18 | try { |
michael@0 | 19 | mozImage = imgContainer.QueryInterface(Ci.imgIContainerDebug); |
michael@0 | 20 | } |
michael@0 | 21 | catch (e) { |
michael@0 | 22 | return false; |
michael@0 | 23 | } |
michael@0 | 24 | func(mozImage); |
michael@0 | 25 | return true; |
michael@0 | 26 | } |