RESOLVED INVALID 48630
ES5 Strict mode: OctalEscapeSequence in string literals
https://bugs.webkit.org/show_bug.cgi?id=48630
Summary ES5 Strict mode: OctalEscapeSequence in string literals
Asen Bozhilov
Reported 2010-10-29 06:46:16 PDT
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
Oliver Hunt
Comment 1 2010-10-29 10:37:19 PDT
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
Note You need to log in before you can comment on or make changes to this bug.