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 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | //Basic tests to verify that MacWebAppUtils works |
michael@0 | 7 | |
michael@0 | 8 | let Ci = Components.interfaces; |
michael@0 | 9 | let Cc = Components.classes; |
michael@0 | 10 | let Cu = Components.utils; |
michael@0 | 11 | let Cr = Components.results; |
michael@0 | 12 | |
michael@0 | 13 | Cu.import("resource://gre/modules/Services.jsm"); |
michael@0 | 14 | Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
michael@0 | 15 | |
michael@0 | 16 | function test_find_app() |
michael@0 | 17 | { |
michael@0 | 18 | var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. |
michael@0 | 19 | createInstance(Ci.nsIMacWebAppUtils); |
michael@0 | 20 | let sig = "com.apple.TextEdit"; |
michael@0 | 21 | |
michael@0 | 22 | let path; |
michael@0 | 23 | path = mwaUtils.pathForAppWithIdentifier(sig); |
michael@0 | 24 | do_print("TextEdit path: " + path + "\n"); |
michael@0 | 25 | do_check_neq(path, ""); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function test_dont_find_fake_app() |
michael@0 | 29 | { |
michael@0 | 30 | var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. |
michael@0 | 31 | createInstance(Ci.nsIMacWebAppUtils); |
michael@0 | 32 | let sig = "calliope.penitentiary.dramamine"; |
michael@0 | 33 | |
michael@0 | 34 | let path; |
michael@0 | 35 | path = mwaUtils.pathForAppWithIdentifier(sig); |
michael@0 | 36 | do_check_eq(path, ""); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | |
michael@0 | 40 | function run_test() |
michael@0 | 41 | { |
michael@0 | 42 | test_find_app(); |
michael@0 | 43 | test_dont_find_fake_app(); |
michael@0 | 44 | } |