<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - const keyword should be allowed in strict mode"
href="https://bugs.webkit.org/show_bug.cgi?id=161464">161464</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>const keyword should be allowed in strict mode
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>Safari 9
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jamie.pate@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>The 'const' keyword has 'basic support' from all major browsers according to <a href="http://kangax.github.io/compat-table/es6/">http://kangax.github.io/compat-table/es6/</a>
```
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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>