Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (284933 => 284934)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-27 18:30:29 UTC (rev 284933)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-27 19:05:46 UTC (rev 284934)
@@ -1,3 +1,15 @@
+2021-10-27 Chris Dumez <[email protected]>
+
+ _javascript_ URL result should be treated as UTF-8 bytes
+ https://bugs.webkit.org/show_bug.cgi?id=232380
+
+ Reviewed by Darin Adler.
+
+ Rebaseline WPT test now that more checks are passing. The remaining failures are due to the fact that we ignore the _javascript_ URL result
+ when the URL is set as href on an anchor (as opposed to the src of an iframe). This will be addressed separately.
+
+ * web-platform-tests/html/browsers/browsing-the-web/navigating-across-documents/_javascript_-url-return-value-handling-dynamic-expected.txt:
+
2021-10-26 Chris Dumez <[email protected]>
Changing the src attribute of the <img> element inside an ImageDocument does not trigger a load
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/navigating-across-documents/_javascript_-url-return-value-handling-dynamic-expected.txt (284933 => 284934)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/navigating-across-documents/_javascript_-url-return-value-handling-dynamic-expected.txt 2021-10-27 18:30:29 UTC (rev 284933)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/navigating-across-documents/_javascript_-url-return-value-handling-dynamic-expected.txt 2021-10-27 19:05:46 UTC (rev 284934)
@@ -1,12 +1,12 @@
-FAIL 0041 set in src="" assert_equals: expected "UTF-8" but got "windows-1252"
+PASS 0041 set in src=""
FAIL 0041 set in href="" targeting a frame and clicked assert_equals: expected "A" but got ""
-FAIL 0080 00FF set in src="" assert_equals: expected "UTF-8" but got "windows-1252"
+PASS 0080 00FF set in src=""
FAIL 0080 00FF set in href="" targeting a frame and clicked assert_equals: expected "ÿ" but got ""
-FAIL 0080 00FF 0100 set in src="" assert_equals: expected "UTF-8" but got "windows-1252"
+PASS 0080 00FF 0100 set in src=""
FAIL 0080 00FF 0100 set in href="" targeting a frame and clicked assert_equals: expected "ÿĀ" but got ""
-FAIL D83D DE0D set in src="" assert_equals: expected "UTF-8" but got "windows-1252"
+PASS D83D DE0D set in src=""
FAIL D83D DE0D set in href="" targeting a frame and clicked assert_equals: expected "😍" but got ""
-FAIL DE0D 0041 set in src="" assert_equals: expected "\ufffdA" but got "U+de0dA"
+PASS DE0D 0041 set in src=""
FAIL DE0D 0041 set in href="" targeting a frame and clicked assert_equals: expected "\ufffdA" but got ""
Modified: trunk/Source/WebCore/ChangeLog (284933 => 284934)
--- trunk/Source/WebCore/ChangeLog 2021-10-27 18:30:29 UTC (rev 284933)
+++ trunk/Source/WebCore/ChangeLog 2021-10-27 19:05:46 UTC (rev 284934)
@@ -1,3 +1,18 @@
+2021-10-27 Chris Dumez <[email protected]>
+
+ _javascript_ URL result should be treated as UTF-8 bytes
+ https://bugs.webkit.org/show_bug.cgi?id=232380
+
+ Reviewed by Darin Adler.
+
+ _javascript_ URL result should be treated as UTF-8 bytes:
+ - https://github.com/whatwg/html/pull/6781
+
+ No new tests, rebaselined existing test.
+
+ * loader/DocumentWriter.cpp:
+ (WebCore::DocumentWriter::replaceDocumentWithResultOfExecutingJavascriptURL):
+
2021-10-27 Martin Robinson <[email protected]>
Eliminate duplicated platform-specific code in ScrollingTreeStickyNode
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (284933 => 284934)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2021-10-27 18:30:29 UTC (rev 284933)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2021-10-27 19:05:46 UTC (rev 284934)
@@ -1280,10 +1280,10 @@
}
}
- bool userChosen;
+ DocumentWriter::IsEncodingUserChosen userChosen;
String encoding;
if (overrideEncoding().isNull()) {
- userChosen = false;
+ userChosen = DocumentWriter::IsEncodingUserChosen::No;
encoding = response().textEncodingName();
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
if (m_archive && m_archive->shouldUseMainResourceEncoding())
@@ -1290,7 +1290,7 @@
encoding = m_archive->mainResource()->textEncoding();
#endif
} else {
- userChosen = true;
+ userChosen = DocumentWriter::IsEncodingUserChosen::Yes;
encoding = overrideEncoding();
}
Modified: trunk/Source/WebCore/loader/DocumentWriter.cpp (284933 => 284934)
--- trunk/Source/WebCore/loader/DocumentWriter.cpp 2021-10-27 18:30:29 UTC (rev 284933)
+++ trunk/Source/WebCore/loader/DocumentWriter.cpp 2021-10-27 19:05:46 UTC (rev 284934)
@@ -77,6 +77,8 @@
begin(m_frame->document()->url(), true, ownerDocument);
+ setEncoding("UTF-8"_s, IsEncodingUserChosen::No);
+
// begin() might fire an unload event, which will result in a situation where no new document has been attached,
// and the old document has been detached. Therefore, bail out if no document is attached.
if (!m_frame->document())
@@ -88,10 +90,10 @@
m_frame->document()->setCompatibilityMode(DocumentCompatibilityMode::NoQuirksMode);
}
- // FIXME: This should call DocumentParser::appendBytes instead of append
- // to support RawDataDocumentParsers.
- if (DocumentParser* parser = m_frame->document()->parser())
- parser->append(source.impl());
+ if (DocumentParser* parser = m_frame->document()->parser()) {
+ auto utf8Source = source.utf8();
+ parser->appendBytes(*this, reinterpret_cast<const uint8_t*>(utf8Source.data()), utf8Source.length());
+ }
}
end();
@@ -306,10 +308,10 @@
m_parser = nullptr;
}
-void DocumentWriter::setEncoding(const String& name, bool userChosen)
+void DocumentWriter::setEncoding(const String& name, IsEncodingUserChosen isUserChosen)
{
m_encoding = name;
- m_encodingWasChosenByUser = userChosen;
+ m_encodingWasChosenByUser = isUserChosen == IsEncodingUserChosen::Yes;
}
void DocumentWriter::setFrame(Frame& frame)
Modified: trunk/Source/WebCore/loader/DocumentWriter.h (284933 => 284934)
--- trunk/Source/WebCore/loader/DocumentWriter.h 2021-10-27 18:30:29 UTC (rev 284933)
+++ trunk/Source/WebCore/loader/DocumentWriter.h 2021-10-27 19:05:46 UTC (rev 284934)
@@ -53,7 +53,8 @@
void setFrame(Frame&);
- WEBCORE_EXPORT void setEncoding(const String& encoding, bool userChosen);
+ enum class IsEncodingUserChosen : bool { No, Yes };
+ WEBCORE_EXPORT void setEncoding(const String& encoding, IsEncodingUserChosen);
const String& mimeType() const { return m_mimeType; }
void setMIMEType(const String& type) { m_mimeType = type; }