Commit 4ab993c6 authored by Delan Azabani's avatar Delan Azabani Committed by Commit Bot

Migrate DeprecatedEqual to EqualASCII for all other ASCII literals

This CL migrates the remaining comparisons involving an ASCII literal
from DeprecatedEqualIgnoringCase to EqualIgnoringASCIICase (except the
comparisons being reviewed under <https://crrev.com/c/2106983>).

These changes are potentially author-facing, but I’ve optimistically
made them without any additional tests based on Rick Byers’ reasoning
on blink-dev [1]. Please let me know if that’s not sufficient here.

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://groups.google.com/a/chromium.org/d/msg/blink-dev/sFOpNuQ91UU/3u1HxbnQCQAJ

Change-Id: If6e1963da8128e3044df38f1924d98089e7d215a
Bug: 627682
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108441
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751346}
parent d89c7870
......@@ -572,16 +572,15 @@ void HTMLConstructionSite::SetCompatibilityModeFromDoctype(
"-//W3C//DTD HTML Experimental 970421//") ||
public_id.StartsWithIgnoringASCIICase("-//W3C//DTD W3 HTML//") ||
public_id.StartsWithIgnoringASCIICase("-//W3O//DTD W3 HTML 3.0//") ||
DeprecatedEqualIgnoringCase(public_id,
"-//W3O//DTD W3 HTML Strict 3.0//EN//") ||
EqualIgnoringASCIICase(public_id,
"-//W3O//DTD W3 HTML Strict 3.0//EN//") ||
public_id.StartsWithIgnoringASCIICase(
"-//WebTechs//DTD Mozilla HTML 2.0//") ||
public_id.StartsWithIgnoringASCIICase(
"-//WebTechs//DTD Mozilla HTML//") ||
DeprecatedEqualIgnoringCase(public_id,
"-/W3C/DTD HTML 4.0 Transitional/EN") ||
EqualIgnoringASCIICase(public_id, "-/W3C/DTD HTML 4.0 Transitional/EN") ||
EqualIgnoringASCIICase(public_id, "HTML") ||
DeprecatedEqualIgnoringCase(
EqualIgnoringASCIICase(
system_id,
"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") ||
(system_id.IsEmpty() && public_id.StartsWithIgnoringASCIICase(
......
......@@ -541,7 +541,7 @@ void DocumentLoader::SetHistoryItemStateForCommit(
history_item_->SetURL(UrlForHistory());
history_item_->SetReferrer(SecurityPolicy::GenerateReferrer(
referrer_.referrer_policy, history_item_->Url(), referrer_.referrer));
if (DeprecatedEqualIgnoringCase(http_method_, "POST")) {
if (EqualIgnoringASCIICase(http_method_, "POST")) {
// FIXME: Eventually we have to make this smart enough to handle the case
// where we have a stream for the body to handle the "data interspersed with
// files" feature.
......@@ -1255,7 +1255,7 @@ void DocumentLoader::StartLoadingInternal() {
loading_mhtml_archive_ =
EqualIgnoringASCIICase("multipart/related", response_.MimeType()) ||
DeprecatedEqualIgnoringCase("message/rfc822", response_.MimeType());
EqualIgnoringASCIICase("message/rfc822", response_.MimeType());
if (loading_mhtml_archive_) {
// To commit an mhtml archive synchronously we have to load the whole body
// synchronously and parse it, and it's already loaded in a buffer usually.
......
......@@ -108,7 +108,7 @@ void FormSubmission::Attributes::UpdateEncodingType(const String& type) {
FormSubmission::SubmitMethod FormSubmission::Attributes::ParseMethodType(
const String& type) {
if (DeprecatedEqualIgnoringCase(type, "post"))
if (EqualIgnoringASCIICase(type, "post"))
return FormSubmission::kPostMethod;
if (EqualIgnoringASCIICase(type, "dialog"))
return FormSubmission::kDialogMethod;
......
......@@ -207,9 +207,9 @@ bool CSSStyleSheetResource::CanUseSheet(const CSSParserContext* parser_context,
return true;
AtomicString content_type = HttpContentType();
return content_type.IsEmpty() ||
DeprecatedEqualIgnoringCase(content_type, "text/css") ||
DeprecatedEqualIgnoringCase(content_type,
"application/x-unknown-content-type");
EqualIgnoringASCIICase(content_type, "text/css") ||
EqualIgnoringASCIICase(content_type,
"application/x-unknown-content-type");
}
StyleSheetContents* CSSStyleSheetResource::CreateParsedStyleSheetFromCache(
......
......@@ -91,7 +91,7 @@ static const WTF::TextEncoding GetEncodingFromDomain(const KURL& url) {
TextResourceDecoderOptions::ContentType DetermineContentType(
const String& mime_type) {
if (DeprecatedEqualIgnoringCase(mime_type, "text/css"))
if (EqualIgnoringASCIICase(mime_type, "text/css"))
return TextResourceDecoderOptions::kCSSContent;
if (EqualIgnoringASCIICase(mime_type, "text/html"))
return TextResourceDecoderOptions::kHTMLContent;
......
This is a testharness.js-based test.
Found 8087 tests; 8081 PASS, 6 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS form.title: 38 tests
PASS form.lang: 38 tests
PASS form.dir: 68 tests
PASS form.className (<form class>): 38 tests
PASS form.autofocus: 39 tests
PASS form.hidden: 39 tests
PASS form.accessKey: 38 tests
PASS form.tabIndex: 26 tests
PASS form.acceptCharset (<form accept-charset>): 38 tests
PASS form.action: 44 tests
PASS form.autocomplete: 58 tests
PASS form.enctype: 68 tests
PASS form.encoding (<form enctype>): 68 tests
PASS form.method: 30 tests
FAIL form.method: setAttribute() to "poſt" assert_equals: IDL get expected "get" but got "post"
PASS form.method: 33 tests
FAIL form.method: IDL set to "poſt" assert_equals: IDL get expected "get" but got "post"
PASS form.method: 5 tests
PASS form.name: 38 tests
PASS form.noValidate: 39 tests
PASS form.target: 38 tests
PASS fieldset.title: 38 tests
PASS fieldset.lang: 38 tests
PASS fieldset.dir: 68 tests
PASS fieldset.className (<fieldset class>): 38 tests
PASS fieldset.autofocus: 39 tests
PASS fieldset.hidden: 39 tests
PASS fieldset.accessKey: 38 tests
PASS fieldset.tabIndex: 26 tests
PASS fieldset.disabled: 39 tests
PASS fieldset.name: 38 tests
PASS legend.title: 38 tests
PASS legend.lang: 38 tests
PASS legend.dir: 68 tests
PASS legend.className (<legend class>): 38 tests
PASS legend.autofocus: 39 tests
PASS legend.hidden: 39 tests
PASS legend.accessKey: 38 tests
PASS legend.tabIndex: 26 tests
PASS legend.align: 38 tests
PASS label.title: 38 tests
PASS label.lang: 38 tests
PASS label.dir: 68 tests
PASS label.className (<label class>): 38 tests
PASS label.autofocus: 39 tests
PASS label.hidden: 39 tests
PASS label.accessKey: 38 tests
PASS label.tabIndex: 26 tests
PASS label.htmlFor (<label for>): 38 tests
PASS input.title: 38 tests
PASS input.lang: 38 tests
PASS input.dir: 68 tests
PASS input.className (<input class>): 38 tests
PASS input.autofocus: 39 tests
PASS input.hidden: 39 tests
PASS input.accessKey: 38 tests
PASS input.tabIndex: 26 tests
PASS input.accept: 38 tests
PASS input.alt: 38 tests
PASS input.autocomplete: 19 tests
PASS input.defaultChecked (<input checked>): 39 tests
PASS input.dirName: 38 tests
PASS input.disabled: 39 tests
PASS input.formAction: 44 tests
PASS input.formEnctype: 68 tests
PASS input.formMethod: 30 tests
FAIL input.formMethod: setAttribute() to "poſt" assert_equals: IDL get expected "get" but got "post"
PASS input.formMethod: 28 tests
FAIL input.formMethod: IDL set to "poſt" assert_equals: IDL get expected "get" but got "post"
PASS input.formNoValidate: 39 tests
PASS input.formTarget: 38 tests
PASS input.height: 8 tests
PASS input.max: 38 tests
PASS input.maxLength: 64 tests
PASS input.min: 38 tests
PASS input.minLength: 64 tests
PASS input.multiple: 39 tests
PASS input.name: 38 tests
PASS input.pattern: 38 tests
PASS input.placeholder: 38 tests
PASS input.readOnly: 39 tests
PASS input.required: 39 tests
PASS input.size: 62 tests
PASS input.src: 44 tests
PASS input.step: 38 tests
PASS input.type: 270 tests
PASS input.width: 8 tests
PASS input.defaultValue (<input value>): 38 tests
PASS input.align: 38 tests
PASS input.useMap: 38 tests
PASS button.title: 38 tests
PASS button.lang: 38 tests
PASS button.dir: 68 tests
PASS button.className (<button class>): 38 tests
PASS button.autofocus: 39 tests
PASS button.hidden: 39 tests
PASS button.accessKey: 38 tests
PASS button.tabIndex: 26 tests
PASS button.disabled: 39 tests
PASS button.formAction: 44 tests
PASS button.formEnctype: 68 tests
PASS button.formMethod: 30 tests
FAIL button.formMethod: setAttribute() to "poſt" assert_equals: IDL get expected "get" but got "post"
PASS button.formMethod: 33 tests
FAIL button.formMethod: IDL set to "poſt" assert_equals: IDL get expected "get" but got "post"
PASS button.formMethod: 5 tests
PASS button.formNoValidate: 39 tests
PASS button.formTarget: 38 tests
PASS button.name: 38 tests
PASS button.type: 72 tests
PASS button.value: 38 tests
PASS select.title: 38 tests
PASS select.lang: 38 tests
PASS select.dir: 68 tests
PASS select.className (<select class>): 38 tests
PASS select.autofocus: 39 tests
PASS select.hidden: 39 tests
PASS select.accessKey: 38 tests
PASS select.tabIndex: 26 tests
PASS select.autocomplete: 19 tests
PASS select.disabled: 39 tests
PASS select.multiple: 39 tests
PASS select.name: 38 tests
PASS select.required: 39 tests
PASS select.size: 65 tests
PASS datalist.title: 38 tests
PASS datalist.lang: 38 tests
PASS datalist.dir: 68 tests
PASS datalist.className (<datalist class>): 38 tests
PASS datalist.autofocus: 39 tests
PASS datalist.hidden: 39 tests
PASS datalist.accessKey: 38 tests
PASS datalist.tabIndex: 26 tests
PASS optgroup.title: 38 tests
PASS optgroup.lang: 38 tests
PASS optgroup.dir: 68 tests
PASS optgroup.className (<optgroup class>): 38 tests
PASS optgroup.autofocus: 39 tests
PASS optgroup.hidden: 39 tests
PASS optgroup.accessKey: 38 tests
PASS optgroup.tabIndex: 26 tests
PASS optgroup.disabled: 39 tests
PASS optgroup.label: 38 tests
PASS option.title: 38 tests
PASS option.lang: 38 tests
PASS option.dir: 68 tests
PASS option.className (<option class>): 38 tests
PASS option.autofocus: 39 tests
PASS option.hidden: 39 tests
PASS option.accessKey: 38 tests
PASS option.tabIndex: 26 tests
PASS option.disabled: 39 tests
PASS option.label: 19 tests
PASS option.defaultSelected (<option selected>): 39 tests
PASS option.value: 19 tests
PASS textarea.title: 38 tests
PASS textarea.lang: 38 tests
PASS textarea.dir: 68 tests
PASS textarea.className (<textarea class>): 38 tests
PASS textarea.autofocus: 39 tests
PASS textarea.hidden: 39 tests
PASS textarea.accessKey: 38 tests
PASS textarea.tabIndex: 26 tests
PASS textarea.autocomplete: 19 tests
PASS textarea.cols: 62 tests
PASS textarea.dirName: 38 tests
PASS textarea.disabled: 39 tests
PASS textarea.maxLength: 64 tests
PASS textarea.minLength: 64 tests
PASS textarea.name: 38 tests
PASS textarea.placeholder: 38 tests
PASS textarea.readOnly: 39 tests
PASS textarea.required: 39 tests
PASS textarea.rows: 62 tests
PASS textarea.wrap: 38 tests
PASS output.title: 38 tests
PASS output.lang: 38 tests
PASS output.dir: 68 tests
PASS output.className (<output class>): 38 tests
PASS output.autofocus: 39 tests
PASS output.hidden: 39 tests
PASS output.accessKey: 38 tests
PASS output.tabIndex: 26 tests
PASS output.name: 38 tests
PASS progress.title: 38 tests
PASS progress.lang: 38 tests
PASS progress.dir: 68 tests
PASS progress.className (<progress class>): 38 tests
PASS progress.autofocus: 39 tests
PASS progress.hidden: 39 tests
PASS progress.accessKey: 38 tests
PASS progress.tabIndex: 26 tests
PASS meter.title: 38 tests
PASS meter.lang: 38 tests
PASS meter.dir: 68 tests
PASS meter.className (<meter class>): 38 tests
PASS meter.autofocus: 39 tests
PASS meter.hidden: 39 tests
PASS meter.accessKey: 38 tests
PASS meter.tabIndex: 26 tests
PASS meter.value: 7 tests
PASS meter.min: 7 tests
PASS meter.max: 7 tests
PASS meter.low: 7 tests
PASS meter.high: 7 tests
PASS meter.optimum: 7 tests
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment