Bug 48630
Summary: | ES5 Strict mode: OctalEscapeSequence in string literals | ||
---|---|---|---|
Product: | WebKit | Reporter: | Asen Bozhilov <asen.bozhilov> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | oliver |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | PC | ||
OS: | Linux |
Asen Bozhilov
I have used the follow test case:
/**
* A conforming implementation, when processing strict mode code (see 10.1.1), may not
* extend the syntax of EscapeSequence to include OctalEscapeSequence as described in B.1.2.
*/
var testDesc = 'EscapeSequence cannot include OctalEscapeSequence: ';
try {
eval('"use strict"; "\101";');
util.printLine(testDesc + 'FALSE');
} catch (e) {
if (e instanceof SyntaxError) {
util.printLine(testDesc + 'TRUE');
}
else {
util.printLine(testDesc + 'UNDEFINED BEHAVIOR');
}
}
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Oliver Hunt
Hahah, i just worked out why this is passing, and why that is correct behaviour.
You have an octal escape in:
eval('"use strict"; "\101";');
The escape is parsed in the context of the function containing eval, so eval sees
"use strict"; "A";
as its input.
The test should be
eval('"use strict"; "\\101";');
Which throws a syntax error as expected.
Thanks for these bug reports by the way :D