Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 load(libdir + "asserts.js");
3 /*
4 * Throw a TypeError if the enumerable fields of the current descriptor and the
5 * descriptor returned by the trap are the boolean negation of each other
6 */
7 var target = {};
8 Object.defineProperty(target, 'foo', {
9 configurable: false,
10 enumerable: true
11 });
12 var caught = false;
13 assertThrowsInstanceOf(function () {
14 Object.getOwnPropertyDescriptor(new Proxy(target, {
15 getOwnPropertyDescriptor: function (target, name) {
16 return {
17 configurable: false,
18 enumerable: false
19 };
20 }
21 }), 'foo');
22 }, TypeError);
24 var target = {};
25 Object.defineProperty(target, 'foo', {
26 configurable: false,
27 enumerable: false
28 });
29 var caught = false;
30 assertThrowsInstanceOf(function () {
31 Object.getOwnPropertyDescriptor(new Proxy(target, {
32 getOwnPropertyDescriptor: function (target, name) {
33 return {
34 configurable: false,
35 enumerable: true
36 };
37 }
38 }), 'foo');
39 }, TypeError);