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; })()"); | |
101 shouldThrow("(function f(){'use strict'; f.arguments; })()"); | 100 shouldThrow("(function f(){'use strict'; f.arguments; })()"); |
102 shouldThrow("(function f(){'use strict'; f.caller; })()"); | 101 shouldThrow("(function f(){'use strict'; f.caller; })()"); |
103 shouldThrow("(function f(){'use strict'; f.arguments=5; })()"); | 102 shouldThrow("(function f(){'use strict'; f.arguments=5; })()"); |
104 shouldThrow("(function f(){'use strict'; f.caller=5; })()"); | 103 shouldThrow("(function f(){'use strict'; f.caller=5; })()"); |
105 shouldThrow("(function (arg){'use strict'; arguments.callee; })()"); | 104 shouldThrow("(function (arg){'use strict'; arguments.callee; })()"); |
106 shouldThrow("(function (arg){'use strict'; arguments.caller; })()"); | |
107 shouldThrow("(function f(arg){'use strict'; f.arguments; })()"); | 105 shouldThrow("(function f(arg){'use strict'; f.arguments; })()"); |
108 shouldThrow("(function f(arg){'use strict'; f.caller; })()"); | 106 shouldThrow("(function f(arg){'use strict'; f.caller; })()"); |
109 shouldThrow("(function f(arg){'use strict'; f.arguments=5; })()"); | 107 shouldThrow("(function f(arg){'use strict'; f.arguments=5; })()"); |
110 shouldThrow("(function f(arg){'use strict'; f.caller=5; })()"); | 108 shouldThrow("(function f(arg){'use strict'; f.caller=5; })()"); |
111 | 109 |
112 // arguments/caller poisoning should be visible on the intrinsic %FunctionProtot
ype%, but not throw with 'in' & 'hasOwnProperty'. | 110 // arguments/caller poisoning should be visible on the intrinsic %FunctionProtot
ype%, but not throw with 'in' & 'hasOwnProperty'. |
113 shouldBeTrue('"caller" in function(){"use strict"}'); | 111 shouldBeTrue('"caller" in function(){"use strict"}'); |
114 shouldBeFalse('(function(){"use strict";}).hasOwnProperty("caller")'); | 112 shouldBeFalse('(function(){"use strict";}).hasOwnProperty("caller")'); |
115 shouldBeTrue('(function(){"use strict";}).__proto__.hasOwnProperty("caller")'); | 113 shouldBeTrue('(function(){"use strict";}).__proto__.hasOwnProperty("caller")'); |
116 shouldBeTrue('"arguments" in function(){"use strict"}'); | 114 shouldBeTrue('"arguments" in function(){"use strict"}'); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 shouldBeTrue("(function () {'use strict'; try { throw 1; } catch (e) { aGlobal
= true; }})(); aGlobal;"); | 222 shouldBeTrue("(function () {'use strict'; try { throw 1; } catch (e) { aGlobal
= true; }})(); aGlobal;"); |
225 aGlobal = false; | 223 aGlobal = false; |
226 shouldBeTrue("try { throw 1; } catch (e) { aGlobal = true; }"); | 224 shouldBeTrue("try { throw 1; } catch (e) { aGlobal = true; }"); |
227 aGlobal = false; | 225 aGlobal = false; |
228 shouldBeTrue("(function () { try { throw 1; } catch (e) { aGlobal = true; }})();
aGlobal;"); | 226 shouldBeTrue("(function () { try { throw 1; } catch (e) { aGlobal = true; }})();
aGlobal;"); |
229 aGlobal = false; | 227 aGlobal = false; |
230 shouldBeTrue("(function () {try { throw 1; } catch (e) { aGlobal = true; }})();
aGlobal;"); | 228 shouldBeTrue("(function () {try { throw 1; } catch (e) { aGlobal = true; }})();
aGlobal;"); |
231 | 229 |
232 // Make sure this doesn't crash! | 230 // Make sure this doesn't crash! |
233 shouldBe('String(Object.getOwnPropertyDescriptor((function() { "use strict"; }).
__proto__, "caller").get)', "'function () {\\n [native code]\\n}'"); | 231 shouldBe('String(Object.getOwnPropertyDescriptor((function() { "use strict"; }).
__proto__, "caller").get)', "'function () {\\n [native code]\\n}'"); |
OLD | NEW |