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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 function run_test() {
5 // setup a profile directory
6 var dir = do_get_profile();
8 // initialize the permission manager service
9 var pm = Cc["@mozilla.org/permissionmanager;1"].
10 getService(Ci.nsIPermissionManager);
12 // get the db file
13 var file = dir.clone();
14 file.append("permissions.sqlite");
15 do_check_true(file.exists());
17 // corrupt the file
18 var ostream = Cc["@mozilla.org/network/file-output-stream;1"].
19 createInstance(Ci.nsIFileOutputStream);
20 ostream.init(file, 0x02, 0666, 0);
21 var conv = Cc["@mozilla.org/intl/converter-output-stream;1"].
22 createInstance(Ci.nsIConverterOutputStream);
23 conv.init(ostream, "UTF-8", 0, 0);
24 for (var i = 0; i < file.fileSize; ++i)
25 conv.writeString("a");
26 conv.close();
28 // prepare an empty hostperm.1 file so that it can be used for importing
29 var hostperm = dir.clone();
30 hostperm.append("hostperm.1");
31 ostream.init(hostperm, 0x02 | 0x08, 0666, 0);
32 ostream.close();
34 // remove all should not throw
35 pm.removeAll();
36 }