OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // 1. Redistributions of source code must retain the above copyright | 7 // 1. Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // 2. Redistributions in binary form must reproduce the above copyright | 9 // 2. Redistributions in binary form must reproduce the above copyright |
10 // notice, this list of conditions and the following disclaimer in the | 10 // notice, this list of conditions and the following disclaimer in the |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 shouldBeSyntaxError("(function (){'use strict'; var eval;})"); | 90 shouldBeSyntaxError("(function (){'use strict'; var eval;})"); |
91 shouldBeSyntaxError("(function (){'use strict'; var arguments;})"); | 91 shouldBeSyntaxError("(function (){'use strict'; var arguments;})"); |
92 shouldBeSyntaxError("(function (){'use strict'; try{}catch(eval){}})"); | 92 shouldBeSyntaxError("(function (){'use strict'; try{}catch(eval){}})"); |
93 shouldBeSyntaxError("(function (){'use strict'; try{}catch(arguments){}})"); | 93 shouldBeSyntaxError("(function (){'use strict'; try{}catch(arguments){}})"); |
94 shouldBeSyntaxError("(function (a, a){'use strict';})"); | 94 shouldBeSyntaxError("(function (a, a){'use strict';})"); |
95 shouldBeSyntaxError("(function (a){'use strict'; delete a;})()"); | 95 shouldBeSyntaxError("(function (a){'use strict'; delete a;})()"); |
96 shouldBeSyntaxError("(function (){'use strict'; var a; delete a;})()"); | 96 shouldBeSyntaxError("(function (){'use strict'; var a; delete a;})()"); |
97 shouldBeSyntaxError("(function (){var a; function f() {'use strict'; delete a;}
})()"); | 97 shouldBeSyntaxError("(function (){var a; function f() {'use strict'; delete a;}
})()"); |
98 shouldBeSyntaxError("(function (){'use strict'; with(1){};})"); | 98 shouldBeSyntaxError("(function (){'use strict'; with(1){};})"); |
99 shouldThrow("(function (){'use strict'; arguments.callee; })()"); | 99 shouldThrow("(function (){'use strict'; arguments.callee; })()"); |
100 shouldThrow("(function (){'use strict'; arguments.caller; })()"); | 100 shouldBeUndefined("(function (){'use strict'; arguments.caller; })()"); |
101 shouldThrow("(function f(){'use strict'; f.arguments; })()"); | 101 shouldThrow("(function f(){'use strict'; f.arguments; })()"); |
102 shouldThrow("(function f(){'use strict'; f.caller; })()"); | 102 shouldThrow("(function f(){'use strict'; f.caller; })()"); |
103 shouldThrow("(function f(){'use strict'; f.arguments=5; })()"); | 103 shouldThrow("(function f(){'use strict'; f.arguments=5; })()"); |
104 shouldThrow("(function f(){'use strict'; f.caller=5; })()"); | 104 shouldThrow("(function f(){'use strict'; f.caller=5; })()"); |
105 shouldThrow("(function (arg){'use strict'; arguments.callee; })()"); | 105 shouldThrow("(function (arg){'use strict'; arguments.callee; })()"); |
106 shouldThrow("(function (arg){'use strict'; arguments.caller; })()"); | 106 shouldBeUndefined("(function (arg){'use strict'; arguments.caller; })()"); |
107 shouldThrow("(function f(arg){'use strict'; f.arguments; })()"); | 107 shouldThrow("(function f(arg){'use strict'; f.arguments; })()"); |
108 shouldThrow("(function f(arg){'use strict'; f.caller; })()"); | 108 shouldThrow("(function f(arg){'use strict'; f.caller; })()"); |
109 shouldThrow("(function f(arg){'use strict'; f.arguments=5; })()"); | 109 shouldThrow("(function f(arg){'use strict'; f.arguments=5; })()"); |
110 shouldThrow("(function f(arg){'use strict'; f.caller=5; })()"); | 110 shouldThrow("(function f(arg){'use strict'; f.caller=5; })()"); |
111 | 111 |
112 // arguments/caller poisoning should be visible on the intrinsic %FunctionProtot
ype%, but not throw with 'in' & 'hasOwnProperty'. | 112 // arguments/caller poisoning should be visible on the intrinsic %FunctionProtot
ype%, but not throw with 'in' & 'hasOwnProperty'. |
113 shouldBeTrue('"caller" in function(){"use strict"}'); | 113 shouldBeTrue('"caller" in function(){"use strict"}'); |
114 shouldBeFalse('(function(){"use strict";}).hasOwnProperty("caller")'); | 114 shouldBeFalse('(function(){"use strict";}).hasOwnProperty("caller")'); |
115 shouldBeTrue('(function(){"use strict";}).__proto__.hasOwnProperty("caller")'); | 115 shouldBeTrue('(function(){"use strict";}).__proto__.hasOwnProperty("caller")'); |
116 shouldBeTrue('"arguments" in function(){"use strict"}'); | 116 shouldBeTrue('"arguments" in function(){"use strict"}'); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 shouldBeTrue("(function (a){'use strict'; var local; (function (){local;})(); ar
guments[0]=true; return arguments; })()[0]"); | 192 shouldBeTrue("(function (a){'use strict'; var local; (function (){local;})(); ar
guments[0]=true; return arguments; })()[0]"); |
193 shouldBeTrue("(function (a){'use strict'; var local; (function (){local;})(); ar
guments[0]=false; a=true; return a; })()"); | 193 shouldBeTrue("(function (a){'use strict'; var local; (function (){local;})(); ar
guments[0]=false; a=true; return a; })()"); |
194 shouldBeTrue("(function (){'use strict'; var local; (function (){local;})(); ar
guments[0]=true; return arguments; })()[0]"); | 194 shouldBeTrue("(function (){'use strict'; var local; (function (){local;})(); ar
guments[0]=true; return arguments; })()[0]"); |
195 | 195 |
196 shouldBeTrue("'use strict'; (function (){var a = true; eval('var a = false'); re
turn a; })()"); | 196 shouldBeTrue("'use strict'; (function (){var a = true; eval('var a = false'); re
turn a; })()"); |
197 shouldBeTrue("(function (){var a = true; eval('\"use strict\"; var a = false');
return a; })()"); | 197 shouldBeTrue("(function (){var a = true; eval('\"use strict\"; var a = false');
return a; })()"); |
198 | 198 |
199 shouldBeUndefined("(function f(arg){'use strict'; return Object.getOwnPropertyDe
scriptor(f.__proto__, 'arguments').value; })()"); | 199 shouldBeUndefined("(function f(arg){'use strict'; return Object.getOwnPropertyDe
scriptor(f.__proto__, 'arguments').value; })()"); |
200 shouldBeUndefined("(function f(arg){'use strict'; return Object.getOwnPropertyDe
scriptor(f.__proto__, 'caller').value; })()"); | 200 shouldBeUndefined("(function f(arg){'use strict'; return Object.getOwnPropertyDe
scriptor(f.__proto__, 'caller').value; })()"); |
201 shouldBeUndefined("(function f(arg){'use strict'; return Object.getOwnPropertyDe
scriptor(arguments, 'callee').value; })()"); | 201 shouldBeUndefined("(function f(arg){'use strict'; return Object.getOwnPropertyDe
scriptor(arguments, 'callee').value; })()"); |
202 shouldBeUndefined("(function f(arg){'use strict'; return Object.getOwnPropertyDe
scriptor(arguments, 'caller').value; })()"); | 202 shouldBeUndefined("(function f(arg){'use strict'; return Object.getOwnPropertyDe
scriptor(arguments, 'caller'); })()"); |
203 shouldBeTrue("(function f(arg){'use strict'; var descriptor = Object.getOwnPrope
rtyDescriptor(arguments, 'caller'); return descriptor.get === descriptor.set; })
()"); | |
204 shouldBeTrue("(function f(arg){'use strict'; var descriptor = Object.getOwnPrope
rtyDescriptor(arguments, 'callee'); return descriptor.get === descriptor.set; })
()"); | 203 shouldBeTrue("(function f(arg){'use strict'; var descriptor = Object.getOwnPrope
rtyDescriptor(arguments, 'callee'); return descriptor.get === descriptor.set; })
()"); |
205 shouldBeTrue("(function f(arg){'use strict'; var descriptor = Object.getOwnPrope
rtyDescriptor(f.__proto__, 'caller'); return descriptor.get === descriptor.set;
})()"); | 204 shouldBeTrue("(function f(arg){'use strict'; var descriptor = Object.getOwnPrope
rtyDescriptor(f.__proto__, 'caller'); return descriptor.get === descriptor.set;
})()"); |
206 shouldBeTrue("(function f(arg){'use strict'; var descriptor = Object.getOwnPrope
rtyDescriptor(f.__proto__, 'arguments'); return descriptor.get === descriptor.se
t; })()"); | 205 shouldBeTrue("(function f(arg){'use strict'; var descriptor = Object.getOwnPrope
rtyDescriptor(f.__proto__, 'arguments'); return descriptor.get === descriptor.se
t; })()"); |
207 shouldBeTrue("'use strict'; (function f() { for(var i in this); })(); true;") | 206 shouldBeTrue("'use strict'; (function f() { for(var i in this); })(); true;") |
208 | 207 |
209 shouldBeSyntaxError("'use strict'\u033b"); | 208 shouldBeSyntaxError("'use strict'\u033b"); |
210 shouldBeSyntaxError("'use strict'5.f"); | 209 shouldBeSyntaxError("'use strict'5.f"); |
211 shouldBeSyntaxError("'use strict';\u033b"); | 210 shouldBeSyntaxError("'use strict';\u033b"); |
212 shouldBeSyntaxError("'use strict';5.f"); | 211 shouldBeSyntaxError("'use strict';5.f"); |
213 shouldBeSyntaxError("'use strict';1-(eval=1);"); | 212 shouldBeSyntaxError("'use strict';1-(eval=1);"); |
(...skipping 10 matching lines...) Expand all Loading... |
224 shouldBeTrue("(function () {'use strict'; try { throw 1; } catch (e) { aGlobal
= true; }})(); aGlobal;"); | 223 shouldBeTrue("(function () {'use strict'; try { throw 1; } catch (e) { aGlobal
= true; }})(); aGlobal;"); |
225 aGlobal = false; | 224 aGlobal = false; |
226 shouldBeTrue("try { throw 1; } catch (e) { aGlobal = true; }"); | 225 shouldBeTrue("try { throw 1; } catch (e) { aGlobal = true; }"); |
227 aGlobal = false; | 226 aGlobal = false; |
228 shouldBeTrue("(function () { try { throw 1; } catch (e) { aGlobal = true; }})();
aGlobal;"); | 227 shouldBeTrue("(function () { try { throw 1; } catch (e) { aGlobal = true; }})();
aGlobal;"); |
229 aGlobal = false; | 228 aGlobal = false; |
230 shouldBeTrue("(function () {try { throw 1; } catch (e) { aGlobal = true; }})();
aGlobal;"); | 229 shouldBeTrue("(function () {try { throw 1; } catch (e) { aGlobal = true; }})();
aGlobal;"); |
231 | 230 |
232 // Make sure this doesn't crash! | 231 // Make sure this doesn't crash! |
233 shouldBe('String(Object.getOwnPropertyDescriptor((function() { "use strict"; }).
__proto__, "caller").get)', "'function () {\\n [native code]\\n}'"); | 232 shouldBe('String(Object.getOwnPropertyDescriptor((function() { "use strict"; }).
__proto__, "caller").get)', "'function () {\\n [native code]\\n}'"); |
OLD | NEW |