[Webkit-unassigned] [Bug 161464] New: const keyword should be allowed in strict mode
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Aug 31 16:30:01 PDT 2016
https://bugs.webkit.org/show_bug.cgi?id=161464
Bug ID: 161464
Summary: const keyword should be allowed in strict mode
Classification: Unclassified
Product: WebKit
Version: Safari 9
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: jamie.pate at gmail.com
The 'const' keyword has 'basic support' from all major browsers according to http://kangax.github.io/compat-table/es6/
```
const foo = 123;
return (foo === 123);
```
Unfortunately, webkit throw an error if the `const` keyword is used in a strict context (via 'use strict'; ).
Steps to Reproduce:
<!DOCTYPE html>
<html>
<head></head>
<body style="white-space: pre-wrap">
<script> window.onerror = function(e) { alert(e);console.log.apply(console, arguments) }; </script>
<script>
/* jshint globalstrict: true */
/* jshint esnext: true */
'use strict';
function x() {
const a = 1;
return a === 1;
}
var result = 'failure';
try {
result = x() ? 'success' : 'failure';
} catch (ex) { }
console.log(result);
alert(result);
</script>
</body>
</html>
Actual Results: "SyntaxError: Unexpected keyword 'const', Const declarations are not supported in strict mode."
Expected Results: "success" (script executed normally)
Platforms: OSX Safari 9.1.2, iOS webkit 602.1, Phantomjs 2.1.1
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160831/0c23f667/attachment.html>
More information about the webkit-unassigned
mailing list