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 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <body> |
michael@0 | 4 | foobar! |
michael@0 | 5 | </body> |
michael@0 | 6 | <script> |
michael@0 | 7 | var finished = false; |
michael@0 | 8 | var data = window.location.search.substring(1).split('&'); |
michael@0 | 9 | |
michael@0 | 10 | function finish(value) { |
michael@0 | 11 | value ? alert('success') : alert('failure'); |
michael@0 | 12 | finished = true; |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | switch (data[0]) { |
michael@0 | 16 | case "getSelf": |
michael@0 | 17 | navigator.mozApps.getSelf().onsuccess = function onGetSelf() { |
michael@0 | 18 | if (data[1] == 'true') { |
michael@0 | 19 | finish(this.result == null); |
michael@0 | 20 | } else { |
michael@0 | 21 | finish(this.result != null); |
michael@0 | 22 | } |
michael@0 | 23 | } |
michael@0 | 24 | break; |
michael@0 | 25 | |
michael@0 | 26 | case "checkInstalled": |
michael@0 | 27 | navigator.mozApps.checkInstalled('http://example.org/manifest.webapp').onsuccess = function onCheckInstalled() { |
michael@0 | 28 | if (data[1] == 'true') { |
michael@0 | 29 | finish(!this.result); |
michael@0 | 30 | } else { |
michael@0 | 31 | finish(!!this.result); |
michael@0 | 32 | } |
michael@0 | 33 | } |
michael@0 | 34 | break; |
michael@0 | 35 | |
michael@0 | 36 | case "checkInstalledWrong": |
michael@0 | 37 | try { |
michael@0 | 38 | navigator.mozApps.checkInstalled('http://something.org/manifest.webapp'); |
michael@0 | 39 | finish(false); |
michael@0 | 40 | } catch (e) { |
michael@0 | 41 | finish(true); |
michael@0 | 42 | } |
michael@0 | 43 | break; |
michael@0 | 44 | |
michael@0 | 45 | default: |
michael@0 | 46 | finish(false); |
michael@0 | 47 | break; |
michael@0 | 48 | } |
michael@0 | 49 | </script> |
michael@0 | 50 | </html> |