Bug 1688832: part 5) Add `static` `AccessibleCaretManager::GetSelection`, `::GetFrame...
[gecko.git] / xpcom / tests / TestWinReg.js
blob5558cf69c983d3046b62017ae9d0c3005ac75e36
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 /*
6  * This script is intended to be run using xpcshell
7  */
9 const nsIWindowsRegKey = Ci.nsIWindowsRegKey;
10 const BASE_PATH = "SOFTWARE\\Mozilla\\Firefox";
12 function idump(indent, str) {
13   for (var j = 0; j < indent; ++j) {
14     dump(" ");
15   }
16   dump(str);
19 function list_values(indent, key) {
20   idump(indent, "{\n");
21   var count = key.valueCount;
22   for (var i = 0; i < count; ++i) {
23     var vn = key.getValueName(i);
24     var val = "";
25     if (key.getValueType(vn) == nsIWindowsRegKey.TYPE_STRING) {
26       val = key.readStringValue(vn);
27     }
28     if (vn == "") {
29       idump(indent + 1, '(Default): "' + val + '"\n');
30     } else {
31       idump(indent + 1, vn + ': "' + val + '"\n');
32     }
33   }
34   idump(indent, "}\n");
37 function list_children(indent, key) {
38   list_values(indent, key);
40   var count = key.childCount;
41   for (var i = 0; i < count; ++i) {
42     var cn = key.getChildName(i);
43     idump(indent, "[" + cn + "]\n");
44     list_children(indent + 1, key.openChild(cn, nsIWindowsRegKey.ACCESS_READ));
45   }
48 // enumerate everything under BASE_PATH
49 var key = Cc["@mozilla.org/windows-registry-key;1"].createInstance(
50   nsIWindowsRegKey
52 key.open(
53   nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE,
54   BASE_PATH,
55   nsIWindowsRegKey.ACCESS_READ
57 list_children(1, key);
59 key.close();
60 key.open(
61   nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
62   BASE_PATH,
63   nsIWindowsRegKey.ACCESS_READ
65 list_children(1, key);