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 function checkConstruct(thing, buggy) {
7 try {
8 new thing();
9 assertEq(0, 1, "not reached " + thing);
10 } catch (e) {
11 if (buggy)
12 assertEq(String(e.message).indexOf("is not a constructor") === -1, false);
13 else
14 assertEq(String(e.message).indexOf("thing is not a constructor") === -1, false);
15 }
16 }
18 var re = /aaa/
19 checkConstruct(re, false);
21 var boundFunctionPrototype = Function.prototype.bind();
22 checkConstruct(boundFunctionPrototype, true);
24 var boundBuiltin = Math.sin.bind();
25 checkConstruct(boundBuiltin, true);
27 /* We set the proxies construct trap to undefined,
28 * so the call trap is used as constructor.
29 */
31 var proxiedFunctionPrototype = Proxy.create({}, Function.prototype, undefined);
32 checkConstruct(proxiedFunctionPrototype, false);
34 var proxiedBuiltin = Proxy.create({}, parseInt, undefined);
35 checkConstruct(proxiedBuiltin, false);
38 if (typeof reportCompare == 'function')
39 reportCompare(0, 0, "ok");