Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | const NS_APP_USER_PROFILE_50_DIR = "ProfD"; |
michael@0 | 6 | |
michael@0 | 7 | const Ci = Components.interfaces; |
michael@0 | 8 | const Cc = Components.classes; |
michael@0 | 9 | const Cr = Components.results; |
michael@0 | 10 | const Cu = Components.utils; |
michael@0 | 11 | |
michael@0 | 12 | function do_check_throws(f, result, stack) |
michael@0 | 13 | { |
michael@0 | 14 | if (!stack) |
michael@0 | 15 | stack = Components.stack.caller; |
michael@0 | 16 | |
michael@0 | 17 | try { |
michael@0 | 18 | f(); |
michael@0 | 19 | } catch (exc) { |
michael@0 | 20 | if (exc.result == result) |
michael@0 | 21 | return; |
michael@0 | 22 | do_throw("expected result " + result + ", caught " + exc, stack); |
michael@0 | 23 | } |
michael@0 | 24 | do_throw("expected result " + result + ", none thrown", stack); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties); |
michael@0 | 28 | |
michael@0 | 29 | // Register current test directory as provider for the profile directory. |
michael@0 | 30 | var provider = { |
michael@0 | 31 | getFile: function(prop, persistent) { |
michael@0 | 32 | persistent.value = true; |
michael@0 | 33 | if (prop == NS_APP_USER_PROFILE_50_DIR) |
michael@0 | 34 | return dirSvc.get("CurProcD", Ci.nsIFile); |
michael@0 | 35 | throw Cr.NS_ERROR_FAILURE; |
michael@0 | 36 | }, |
michael@0 | 37 | QueryInterface: function(iid) { |
michael@0 | 38 | if (iid.equals(Ci.nsIDirectoryServiceProvider) || |
michael@0 | 39 | iid.equals(Ci.nsISupports)) { |
michael@0 | 40 | return this; |
michael@0 | 41 | } |
michael@0 | 42 | throw Cr.NS_ERROR_NO_INTERFACE; |
michael@0 | 43 | } |
michael@0 | 44 | }; |
michael@0 | 45 | dirSvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider); |