Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 2 | SpecialPowers.setAllAppsLaunchable(true); |
michael@0 | 3 | |
michael@0 | 4 | var fileTestOnCurrentOrigin = 'http://example.org/tests/dom/tests/mochitest/webapps/file_bug_779982.html'; |
michael@0 | 5 | |
michael@0 | 6 | var gData = [ |
michael@0 | 7 | // APP 1 |
michael@0 | 8 | { |
michael@0 | 9 | app: 'http://example.org/manifest.webapp', |
michael@0 | 10 | action: 'getSelf', |
michael@0 | 11 | isnull: false, |
michael@0 | 12 | src: fileTestOnCurrentOrigin, |
michael@0 | 13 | message: 'getSelf() for app should return something' |
michael@0 | 14 | }, |
michael@0 | 15 | { |
michael@0 | 16 | app: 'http://example.org/manifest.webapp', |
michael@0 | 17 | action: 'checkInstalled', |
michael@0 | 18 | isnull: false, |
michael@0 | 19 | src: fileTestOnCurrentOrigin, |
michael@0 | 20 | message: 'checkInstalled() for app should return true' |
michael@0 | 21 | }, |
michael@0 | 22 | { |
michael@0 | 23 | app: 'http://example.org/manifest.webapp', |
michael@0 | 24 | action: 'checkInstalledWrong', |
michael@0 | 25 | isnull: true, |
michael@0 | 26 | src: fileTestOnCurrentOrigin, |
michael@0 | 27 | message: 'checkInstalled() for browser should return true' |
michael@0 | 28 | }, |
michael@0 | 29 | // Browser |
michael@0 | 30 | { |
michael@0 | 31 | browser: true, |
michael@0 | 32 | action: 'getSelf', |
michael@0 | 33 | isnull: true, |
michael@0 | 34 | src: fileTestOnCurrentOrigin, |
michael@0 | 35 | message: 'getSelf() for browser should return null' |
michael@0 | 36 | }, |
michael@0 | 37 | { |
michael@0 | 38 | browser: true, |
michael@0 | 39 | action: 'checkInstalled', |
michael@0 | 40 | isnull: false, |
michael@0 | 41 | src: fileTestOnCurrentOrigin, |
michael@0 | 42 | message: 'checkInstalled() for browser should return true' |
michael@0 | 43 | }, |
michael@0 | 44 | { |
michael@0 | 45 | browser: true, |
michael@0 | 46 | action: 'checkInstalledWrong', |
michael@0 | 47 | isnull: true, |
michael@0 | 48 | src: fileTestOnCurrentOrigin, |
michael@0 | 49 | message: 'checkInstalled() for browser should return true' |
michael@0 | 50 | }, |
michael@0 | 51 | ]; |
michael@0 | 52 | |
michael@0 | 53 | function runTest() { |
michael@0 | 54 | for (var i in gData) { |
michael@0 | 55 | var iframe = document.createElement('iframe'); |
michael@0 | 56 | var data = gData[i]; |
michael@0 | 57 | |
michael@0 | 58 | if (data.app) { |
michael@0 | 59 | iframe.setAttribute('mozbrowser', ''); |
michael@0 | 60 | iframe.setAttribute('mozapp', data.app); |
michael@0 | 61 | } else if (data.browser) { |
michael@0 | 62 | iframe.setAttribute('mozbrowser', ''); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | if (data.app || data.browser) { |
michael@0 | 66 | iframe.addEventListener('mozbrowsershowmodalprompt', function(e) { |
michael@0 | 67 | is(e.detail.message, 'success', data.message); |
michael@0 | 68 | |
michael@0 | 69 | i++; |
michael@0 | 70 | if (i >= gData.length) { |
michael@0 | 71 | SimpleTest.finish(); |
michael@0 | 72 | } else { |
michael@0 | 73 | gTestRunner.next(); |
michael@0 | 74 | } |
michael@0 | 75 | }); |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | iframe.src = data.src + '?' + data.action + '&' + data.isnull; |
michael@0 | 79 | document.getElementById('content').appendChild(iframe); |
michael@0 | 80 | |
michael@0 | 81 | yield undefined; |
michael@0 | 82 | } |
michael@0 | 83 | } |
michael@0 | 84 | |
michael@0 | 85 | var gTestRunner = runTest(); |
michael@0 | 86 | |
michael@0 | 87 | SpecialPowers.pushPrefEnv({"set": [["dom.mozBrowserFramesEnabled", true]]}, function() { |
michael@0 | 88 | SpecialPowers.pushPermissions([{'type': 'browser', 'allow': true, 'context': document}, {'type': 'embed-apps', 'allow': true, 'context': document}], function() {gTestRunner.next() }); |
michael@0 | 89 | }); |