Title: [208909] trunk
- Revision
- 208909
- Author
- [email protected]
- Date
- 2016-11-18 16:58:54 -0800 (Fri, 18 Nov 2016)
Log Message
TextDecoder constructor should not accept replacement encodings
https://bugs.webkit.org/show_bug.cgi?id=164903
Reviewed by Chris Dumez.
LayoutTests/imported/w3c:
* web-platform-tests/encoding/api-replacement-encodings-expected.txt:
Source/WebCore:
Covered by newly passing web platform tests.
* dom/TextDecoder.cpp:
(WebCore::TextDecoder::create):
https://encoding.spec.whatwg.org/#textdecoder says about the constructor:
"If label is either not a label or is a label for replacement, throws a RangeError."
See https://bugs.webkit.org/show_bug.cgi?id=159180 for the mapping of the replacement
codec names to "replacement".
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (208908 => 208909)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-11-19 00:38:43 UTC (rev 208908)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-11-19 00:58:54 UTC (rev 208909)
@@ -1,3 +1,12 @@
+2016-11-18 Alex Christensen <[email protected]>
+
+ TextDecoder constructor should not accept replacement encodings
+ https://bugs.webkit.org/show_bug.cgi?id=164903
+
+ Reviewed by Chris Dumez.
+
+ * web-platform-tests/encoding/api-replacement-encodings-expected.txt:
+
2016-11-17 Jiewen Tan <[email protected]>
Update SubtleCrypto::encrypt to match the latest spec
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/api-replacement-encodings-expected.txt (208908 => 208909)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/api-replacement-encodings-expected.txt 2016-11-19 00:38:43 UTC (rev 208908)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/api-replacement-encodings-expected.txt 2016-11-19 00:58:54 UTC (rev 208909)
@@ -1,8 +1,8 @@
PASS The "replacement" label should not be a known encoding.
-FAIL Label for "replacement" should be rejected by API: csiso2022kr assert_throws: function "function () { new TextDecoder(label); }" did not throw
-FAIL Label for "replacement" should be rejected by API: hz-gb-2312 assert_throws: function "function () { new TextDecoder(label); }" did not throw
-FAIL Label for "replacement" should be rejected by API: iso-2022-cn assert_throws: function "function () { new TextDecoder(label); }" did not throw
-FAIL Label for "replacement" should be rejected by API: iso-2022-cn-ext assert_throws: function "function () { new TextDecoder(label); }" did not throw
-FAIL Label for "replacement" should be rejected by API: iso-2022-kr assert_throws: function "function () { new TextDecoder(label); }" did not throw
+PASS Label for "replacement" should be rejected by API: csiso2022kr
+PASS Label for "replacement" should be rejected by API: hz-gb-2312
+PASS Label for "replacement" should be rejected by API: iso-2022-cn
+PASS Label for "replacement" should be rejected by API: iso-2022-cn-ext
+PASS Label for "replacement" should be rejected by API: iso-2022-kr
Modified: trunk/Source/WebCore/ChangeLog (208908 => 208909)
--- trunk/Source/WebCore/ChangeLog 2016-11-19 00:38:43 UTC (rev 208908)
+++ trunk/Source/WebCore/ChangeLog 2016-11-19 00:58:54 UTC (rev 208909)
@@ -1,3 +1,19 @@
+2016-11-18 Alex Christensen <[email protected]>
+
+ TextDecoder constructor should not accept replacement encodings
+ https://bugs.webkit.org/show_bug.cgi?id=164903
+
+ Reviewed by Chris Dumez.
+
+ Covered by newly passing web platform tests.
+
+ * dom/TextDecoder.cpp:
+ (WebCore::TextDecoder::create):
+ https://encoding.spec.whatwg.org/#textdecoder says about the constructor:
+ "If label is either not a label or is a label for replacement, throws a RangeError."
+ See https://bugs.webkit.org/show_bug.cgi?id=159180 for the mapping of the replacement
+ codec names to "replacement".
+
2016-11-18 Chris Dumez <[email protected]>
Assertion failures in ActiveDOMObject::~ActiveDOMObject under Database destructor
Modified: trunk/Source/WebCore/dom/TextDecoder.cpp (208908 => 208909)
--- trunk/Source/WebCore/dom/TextDecoder.cpp 2016-11-19 00:38:43 UTC (rev 208908)
+++ trunk/Source/WebCore/dom/TextDecoder.cpp 2016-11-19 00:58:54 UTC (rev 208909)
@@ -37,7 +37,7 @@
if (strippedLabel.contains(nullCharacter))
return Exception { RangeError };
auto decoder = adoptRef(*new TextDecoder(strippedLabel.utf8().data(), options));
- if (!decoder->m_textEncoding.isValid())
+ if (!decoder->m_textEncoding.isValid() || !strcmp(decoder->m_textEncoding.name(), "replacement"))
return Exception { RangeError };
return WTFMove(decoder);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes