[Webkit-unassigned] [Bug 78908] `\u200c` and `\u200d` should be allowed in IdentifierPart, as per ES5

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 23 10:41:21 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=78908





--- Comment #29 from Michael Saboff <msaboff at apple.com>  2012-02-23 10:41:21 PST ---
(From update of attachment 128467)
View in context: https://bugs.webkit.org/attachment.cgi?id=128467&action=review

> Source/JavaScriptCore/parser/Lexer.cpp:384
> +        | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector));

Move the checks for 0x200C and 0x200D to the end as these are not the typical case.

> Source/JavaScriptCore/runtime/LiteralParser.cpp:285
> +    while (m_ptr < m_end && (isASCIIAlphanumeric(*m_ptr) || *m_ptr == '_' || *m_ptr == '$' || *m_ptr == 0x200C || *m_ptr == 0x200D))

Remove the checks for 0x200C and 0x200D here as this explicit template instantiation is only for 8 bit (LChar) characters.

> LayoutTests/fast/js/var-declarations-zero-width.html:29
> +<p>This page tests if U+200C and U+200D are allowed as part of an identifier.
> +<pre id=console></pre>
> +
> +<script>
> +if (window.layoutTestController)
> +    layoutTestController.dumpAsText();
> +    
> +function log(s) {
> +    document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
> +}
> +
> +function shouldBe(a, b) {
> +    var evalA;
> +    try {
> +        evalA = eval(a);
> +    } catch (e) {
> +        evalA = e;
> +    }
> +    
> +    if (evalA === b) {
> +        log("PASS: " + a + " should be " + b + " and is.");
> +    } else {
> +        log("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".");
> +    }
> +}
> +
> +shouldBe("var x\u200c = 42; x\u200c", 42);
> +shouldBe("var x\u200d = 43; x\u200d", 43);
> +</script>

Please move the script part to LayoutTests/fast/js/script-tests/var-declarations-zero-width.js and reference the .js file in the .html.  Also use the provided "js-test-pre.js" and "js-test-post.js" scripts.

The .html should end up something like:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/var-declarations-zero-width.js"></script>
<script src="resources/js-test-post.js"></script>
</body>

And the script-tests/var-declarations-zero-width.js would be something like:
description("This page tests if U+200C and U+200D are allowed as part of an identifier.");

shouldBe("var x\u200c = 42; x\u200c", 42);
shouldBe("var x\u200d = 43; x\u200d", 43);

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list