Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate DeprecatedEqual to EqualASCII for HTML attribute values #22064

Merged
merged 1 commit into from Mar 17, 2020

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Mar 3, 2020

DeprecatedEqualIgnoringCase (“DeprecatedEqual”) returns true iff the
two given strings are equal under non-Turkic case folding (full iff
both strings are 16-bit, simple otherwise).

DeprecatedEqual was deprecated in favour of EqualIgnoringASCIICase or
EqualIgnoringUnicodeCase [1]. The former is usually the appropriate
choice for web platform features that need to check for equality with
a constant keyword.

This CL migrates a significant subset of DeprecatedEqual calls: those
where one of the arguments is an 8-bit literal, containing only ASCII,
defined (or ought to be defined) somewhere in the HTML specification.

Unlike the last three patches against the same bug, these changes come
with web platform tests. This is because they’re author-facing and the
values contain the letter “s”, one of the four ASCII characters whose
equivalence class would change when switching from simple non-Turkic
case folding to ASCII insensitivity [2].

The engine changes are a curated subset of the following replacement
under Sublime Text 2 (PCRE):

Find: (?x-i)
(?<escape>\['"?\abfnrtv]){0}
(?<literal>"(?:(?=[ -~])[^"]|(?&escape))"){0}
(?<any>(?:[^(),]|(((?:[^()]
|(?-1)))))+){0}
DeprecatedEqualIgnoringCase
(\s
(\s*+(?:
(?&literal)\s*,\s*+(?&any)
|(?&any)\s*,\s*+(?&literal)
)\s*))
Where: .cc,-/path/to/src/out/,-/path/to/src/.clangd/*
Replace: EqualIgnoringASCIICase$5

[1] https://codereview.chromium.org/2811793004/patch/1/10109
[2] https://www.unicode.org/Public/UCD/latest/ucd/CaseFolding.txt

Bug: 627682
Change-Id: I5f4279a3f6957d3604357df5da7c67ff2bdcdb1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032655
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Reviewed-by: Frédéric Wang <fwang@igalia.com>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Mason Freed <masonfreed@chromium.org>
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750965}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-2032655 branch 10 times, most recently from 0a803a4 to 7d684c7 Compare Mar 13, 2020
DeprecatedEqualIgnoringCase (“DeprecatedEqual”) returns true iff the
two given strings are equal under non-Turkic case folding (full iff
both strings are 16-bit, simple otherwise).

DeprecatedEqual was deprecated in favour of EqualIgnoringASCIICase or
EqualIgnoringUnicodeCase [1]. The former is usually the appropriate
choice for web platform features that need to check for equality with
a constant keyword.

This CL migrates a significant subset of DeprecatedEqual calls: those
where one of the arguments is an 8-bit literal, containing only ASCII,
defined (or ought to be defined) somewhere in the HTML specification.

Unlike the last three patches against the same bug, these changes come
with web platform tests. This is because they’re author-facing and the
values contain the letter “s”, one of the four ASCII characters whose
equivalence class would change when switching from simple non-Turkic
case folding to ASCII insensitivity [2].

The engine changes are a curated subset of the following replacement
under Sublime Text 2 (PCRE):

Find:           (?x-i)
                (?<escape>\\['"?\\abfnrtv]){0}
                (?<literal>"(?:(?=[ -~])[^"]|(?&escape))*"){0}
                (?<any>(?:[^(),]|(\((?:[^()]*|(?-1))\)))*+){0}
                DeprecatedEqualIgnoringCase
                (\s*\(\s*+(?:
                    (?&literal)\s*,\s*+(?&any)
                    |(?&any)\s*,\s*+(?&literal)
                )\s*\))
Where:          *.cc,-/path/to/src/out/*,-/path/to/src/.clangd/*
Replace:        EqualIgnoringASCIICase$5

[1] https://codereview.chromium.org/2811793004/patch/1/10109
[2] https://www.unicode.org/Public/UCD/latest/ucd/CaseFolding.txt

Bug: 627682
Change-Id: I5f4279a3f6957d3604357df5da7c67ff2bdcdb1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032655
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Reviewed-by: Frédéric Wang <fwang@igalia.com>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Mason Freed <masonfreed@chromium.org>
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750965}
@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 4d00984 into master Mar 17, 2020
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-2032655 branch Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants