Created
October 13, 2010 17:17
-
-
Save cms/624473 to your computer and use it in GitHub Desktop.
WebKit strict mode bugs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WebKit strict mode bugs | |
// Eval code should be "strict eval code" if the call to eval is a direct call (15.1.2.1.1) to | |
// the eval function that is contained in strict mode code: | |
(function () { | |
"use strict"; | |
return eval('(function() { return !this; })()'); | |
})(); | |
// Function code that is supplied as the last argument to the built-in Function constructor is | |
// "strict function code" if the last argument is a String that when processed as a FunctionBody | |
// begins with a Directive Prologue that contains a Use Strict Directive: | |
Function('"use strict"; return !this;')(); | |
// The `this` value should be set to `undefined`, not to `null`, when a function call is made to | |
// a "not reference" or to a "non-property reference" (11.2.3): | |
(function(){"use strict"; return this === undefined; })(); | |
// WebKit r69618 (running on Windows 7 x64) completely crashes, while a TypeError exception | |
// would be expected: | |
try { | |
(function () {"use strict"; this.foo;})(); | |
} catch (e) { | |
alert(e instanceof TypeError); | |
} | |
// This should be a ReferenceError, not an early reported SyntaxError: | |
(function () {"use strict"; foo = "bar";})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment