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 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 */
6 var hitCount;
7 function watcher(p,o,n) { hitCount++; return n; }
9 var a = [1];
10 a.watch('length', watcher);
11 hitCount = 0;
12 a.length = 0;
13 reportCompare(1, hitCount, "lenient; configurable: watchpoint hit");
15 var b = Object.defineProperty([1],'0',{configurable:false});
16 b.watch('length', watcher);
17 hitCount = 0;
18 var result;
19 try {
20 b.length = 0;
21 result = "no error";
22 } catch (x) {
23 result = x.toString();
24 }
25 reportCompare(1, hitCount, "lenient; non-configurable: watchpoint hit");
26 reportCompare(1, b.length, "lenient; non-configurable: length unchanged");
27 reportCompare("no error", result, "lenient; non-configurable: no error thrown");
29 var c = Object.defineProperty([1],'0',{configurable:false});
30 c.watch('length', watcher);
31 hitCount = 0;
32 var threwTypeError;
33 try {
34 (function(){'use strict'; c.length = 0;})();
35 threwTypeError = false;
36 } catch (x) {
37 threwTypeError = x instanceof TypeError;
38 }
39 reportCompare(1, hitCount, "strict; non-configurable: watchpoint hit");
40 reportCompare(1, c.length, "strict; non-configurable: length unchanged");
41 reportCompare(true, threwTypeError, "strict; non-configurable: TypeError thrown");