Title: [279391] trunk
- Revision
- 279391
- Author
- [email protected]
- Date
- 2021-06-29 15:25:29 -0700 (Tue, 29 Jun 2021)
Log Message
Encoding specified in the 'charset' attribute should have precedence over 'content' attribute
https://bugs.webkit.org/show_bug.cgi?id=227464
Patch by Johnson Zhou <[email protected]> on 2021-06-29
LayoutTests/imported/w3c:
Reviewed by Geoffrey Garen.
* web-platform-tests/html/syntax/parsing/meta-inhead-insertion-mode-expected.txt:
Source/WebCore:
Reviewed by Geoffrey Garen.
Puts precedence on 'charset' attribute by breaking out of the parsing process.
This test passes Firefox and Chrome. Tested using
http://wpt.live/html/syntax/parsing/meta-inhead-insertion-mode.html
* html/parser/HTMLMetaCharsetParser.cpp:
(WebCore::HTMLMetaCharsetParser::encodingFromMetaAttributes):
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (279390 => 279391)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-06-29 22:17:52 UTC (rev 279390)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-06-29 22:25:29 UTC (rev 279391)
@@ -1,3 +1,12 @@
+2021-06-29 Johnson Zhou <[email protected]>
+
+ Encoding specified in the 'charset' attribute should have precedence over 'content' attribute
+ https://bugs.webkit.org/show_bug.cgi?id=227464
+
+ Reviewed by Geoffrey Garen.
+
+ * web-platform-tests/html/syntax/parsing/meta-inhead-insertion-mode-expected.txt:
+
2021-06-29 Chris Dumez <[email protected]>
Resync service-worker WPT tests from upstream
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/meta-inhead-insertion-mode-expected.txt (279390 => 279391)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/meta-inhead-insertion-mode-expected.txt 2021-06-29 22:17:52 UTC (rev 279390)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/meta-inhead-insertion-mode-expected.txt 2021-06-29 22:25:29 UTC (rev 279391)
@@ -1,3 +1,3 @@
-FAIL Encoding specified in the 'charset' attribute should have precedence over 'content' attribute. assert_equals: expected "ISO-8859-15" but got "KOI8-R"
+PASS Encoding specified in the 'charset' attribute should have precedence over 'content' attribute.
Modified: trunk/Source/WebCore/ChangeLog (279390 => 279391)
--- trunk/Source/WebCore/ChangeLog 2021-06-29 22:17:52 UTC (rev 279390)
+++ trunk/Source/WebCore/ChangeLog 2021-06-29 22:25:29 UTC (rev 279391)
@@ -1,3 +1,19 @@
+2021-06-29 Johnson Zhou <[email protected]>
+
+ Encoding specified in the 'charset' attribute should have precedence over 'content' attribute
+ https://bugs.webkit.org/show_bug.cgi?id=227464
+
+ Reviewed by Geoffrey Garen.
+
+ Puts precedence on 'charset' attribute by breaking out of the parsing process.
+
+ This test passes Firefox and Chrome. Tested using
+ http://wpt.live/html/syntax/parsing/meta-inhead-insertion-mode.html
+
+ * html/parser/HTMLMetaCharsetParser.cpp:
+ (WebCore::HTMLMetaCharsetParser::encodingFromMetaAttributes):
+
+
2021-06-29 Darin Adler <[email protected]>
CSS style sheets loaded by HTMLLinkElement do not fall back correctly when charset is an invalid encoding name
Modified: trunk/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp (279390 => 279391)
--- trunk/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp 2021-06-29 22:17:52 UTC (rev 279390)
+++ trunk/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp 2021-06-29 22:25:29 UTC (rev 279391)
@@ -109,15 +109,15 @@
if (attributeName == http_equivAttr) {
if (equalLettersIgnoringASCIICase(attributeValue, "content-type"))
gotPragma = true;
- } else if (charset.isEmpty()) {
- if (attributeName == charsetAttr) {
- charset = attributeValue;
- mode = Charset;
- } else if (attributeName == contentAttr) {
- charset = extractCharset(attributeValue);
- if (charset.length())
- mode = Pragma;
- }
+ } else if (attributeName == charsetAttr) {
+ charset = attributeValue;
+ mode = Charset;
+ // Charset attribute takes precedence
+ break;
+ } else if (attributeName == contentAttr) {
+ charset = extractCharset(attributeValue);
+ if (charset.length())
+ mode = Pragma;
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes