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 file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | const Cc = Components.classes; |
michael@0 | 6 | const Ci = Components.interfaces; |
michael@0 | 7 | |
michael@0 | 8 | Components.utils.import("resource://gre/modules/Services.jsm"); |
michael@0 | 9 | |
michael@0 | 10 | const manifest = do_get_file('bug725015.manifest'); |
michael@0 | 11 | const contract = "@bug725015.test.contract"; |
michael@0 | 12 | const observerTopic = "xpcom-category-entry-added"; |
michael@0 | 13 | const category = "bug725015-test-category"; |
michael@0 | 14 | const entry = "bug725015-category-entry"; |
michael@0 | 15 | const cid = Components.ID("{05070380-6e6e-42ba-aaa5-3289fc55ca5a}"); |
michael@0 | 16 | |
michael@0 | 17 | function observe_category(subj, topic, data) { |
michael@0 | 18 | try { |
michael@0 | 19 | do_check_eq(topic, observerTopic); |
michael@0 | 20 | if (data != category) |
michael@0 | 21 | return; |
michael@0 | 22 | |
michael@0 | 23 | var thisentry = subj.QueryInterface(Ci.nsISupportsCString).data; |
michael@0 | 24 | do_check_eq(thisentry, entry); |
michael@0 | 25 | |
michael@0 | 26 | do_check_eq(Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager).getCategoryEntry(category, entry), contract); |
michael@0 | 27 | do_check_true(Cc[contract].equals(cid)); |
michael@0 | 28 | } |
michael@0 | 29 | catch (e) { |
michael@0 | 30 | do_throw(e); |
michael@0 | 31 | } |
michael@0 | 32 | do_test_finished(); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | function run_test() { |
michael@0 | 36 | do_test_pending(); |
michael@0 | 37 | Services.obs.addObserver(observe_category, observerTopic, false); |
michael@0 | 38 | Components.manager.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(manifest); |
michael@0 | 39 | } |