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 | function run_test() { |
michael@0 | 6 | var cps = new ContentPrefInstance(null); |
michael@0 | 7 | |
michael@0 | 8 | var uri = ContentPrefTest.getURI("http://www.example.com/"); |
michael@0 | 9 | |
michael@0 | 10 | do_check_thrown(function () { cps.setPref(uri, null, 8); }); |
michael@0 | 11 | do_check_thrown(function () { cps.hasPref(uri, null); }); |
michael@0 | 12 | do_check_thrown(function () { cps.getPref(uri, null); }); |
michael@0 | 13 | do_check_thrown(function () { cps.removePref(uri, null); }); |
michael@0 | 14 | do_check_thrown(function () { cps.getPrefsByName(null); }); |
michael@0 | 15 | do_check_thrown(function () { cps.removePrefsByName(null); }); |
michael@0 | 16 | |
michael@0 | 17 | do_check_thrown(function () { cps.setPref(uri, "", 21); }); |
michael@0 | 18 | do_check_thrown(function () { cps.hasPref(uri, ""); }); |
michael@0 | 19 | do_check_thrown(function () { cps.getPref(uri, ""); }); |
michael@0 | 20 | do_check_thrown(function () { cps.removePref(uri, ""); }); |
michael@0 | 21 | do_check_thrown(function () { cps.getPrefsByName(""); }); |
michael@0 | 22 | do_check_thrown(function () { cps.removePrefsByName(""); }); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | function do_check_thrown (aCallback) { |
michael@0 | 26 | var exThrown = false; |
michael@0 | 27 | try { |
michael@0 | 28 | aCallback(); |
michael@0 | 29 | do_throw("NS_ERROR_ILLEGAL_VALUE should have been thrown here"); |
michael@0 | 30 | } catch (e) { |
michael@0 | 31 | do_check_eq(e.result, Cr.NS_ERROR_ILLEGAL_VALUE); |
michael@0 | 32 | exThrown = true; |
michael@0 | 33 | } |
michael@0 | 34 | do_check_true(exThrown); |
michael@0 | 35 | } |