Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 function run_test() {
6 var cps = new ContentPrefInstance(null);
8 var uri = ContentPrefTest.getURI("http://www.example.com/");
10 do_check_thrown(function () { cps.setPref(uri, null, 8); });
11 do_check_thrown(function () { cps.hasPref(uri, null); });
12 do_check_thrown(function () { cps.getPref(uri, null); });
13 do_check_thrown(function () { cps.removePref(uri, null); });
14 do_check_thrown(function () { cps.getPrefsByName(null); });
15 do_check_thrown(function () { cps.removePrefsByName(null); });
17 do_check_thrown(function () { cps.setPref(uri, "", 21); });
18 do_check_thrown(function () { cps.hasPref(uri, ""); });
19 do_check_thrown(function () { cps.getPref(uri, ""); });
20 do_check_thrown(function () { cps.removePref(uri, ""); });
21 do_check_thrown(function () { cps.getPrefsByName(""); });
22 do_check_thrown(function () { cps.removePrefsByName(""); });
23 }
25 function do_check_thrown (aCallback) {
26 var exThrown = false;
27 try {
28 aCallback();
29 do_throw("NS_ERROR_ILLEGAL_VALUE should have been thrown here");
30 } catch (e) {
31 do_check_eq(e.result, Cr.NS_ERROR_ILLEGAL_VALUE);
32 exThrown = true;
33 }
34 do_check_true(exThrown);
35 }