Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (254671 => 254672)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-01-16 12:13:17 UTC (rev 254672)
@@ -1,3 +1,14 @@
+2020-01-16 Rob Buis <[email protected]>
+
+ Fetch: URL parser not always using UTF-8
+ https://bugs.webkit.org/show_bug.cgi?id=178008
+
+ Reviewed by Youenn Fablet.
+
+ Update improved test result.
+
+ * web-platform-tests/fetch/api/request/url-encoding-expected.txt:
+
2020-01-16 Cathie Chen <[email protected]>
Mapping HTML attributes width/height to the default aspect ratio of <img>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding-expected.txt (254671 => 254672)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding-expected.txt 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding-expected.txt 2020-01-16 12:13:17 UTC (rev 254672)
@@ -1,4 +1,4 @@
-FAIL URL encoding and Request assert_equals: expected "http://localhost:8800/fetch/api/request/url-encoding.html?%C3%9F" but got "http://localhost:8800/fetch/api/request/url-encoding.html?%DF"
-FAIL URL encoding and fetch() assert_equals: expected "http://localhost:8800/fetch/api/request/url-encoding.html?%C3%9F" but got "http://localhost:8800/fetch/api/request/url-encoding.html?%DF"
+PASS URL encoding and Request
+PASS URL encoding and fetch()
Modified: trunk/Source/WebCore/ChangeLog (254671 => 254672)
--- trunk/Source/WebCore/ChangeLog 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/Source/WebCore/ChangeLog 2020-01-16 12:13:17 UTC (rev 254672)
@@ -1,3 +1,27 @@
+2020-01-16 Rob Buis <[email protected]>
+
+ Fetch: URL parser not always using UTF-8
+ https://bugs.webkit.org/show_bug.cgi?id=178008
+
+ Reviewed by Youenn Fablet.
+
+ Make sure fetch requests run the URL parser with a UTF-8 decoder.
+
+ Test: web-platform-tests/fetch/api/request/url-encoding.html
+
+ * Modules/fetch/FetchRequest.cpp:
+ (WebCore::FetchRequest::initializeWith):
+ * dom/Document.cpp:
+ (WebCore::Document::completeURL const):
+ * dom/Document.h:
+ * dom/ScriptExecutionContext.h:
+ * workers/WorkerGlobalScope.cpp:
+ (WebCore::WorkerGlobalScope::completeURL const):
+ * workers/WorkerGlobalScope.h:
+ * worklets/WorkletGlobalScope.cpp:
+ (WebCore::WorkletGlobalScope::completeURL const):
+ * worklets/WorkletGlobalScope.h:
+
2020-01-16 Alicia Boya GarcĂa <[email protected]>
[MSE] Don't enqueue samples that start at a big discontinuity
Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp (254671 => 254672)
--- trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp 2020-01-16 12:13:17 UTC (rev 254672)
@@ -161,7 +161,7 @@
{
ASSERT(scriptExecutionContext());
// FIXME: Tighten the URL parsing algorithm according https://url.spec.whatwg.org/#concept-url-parser.
- URL requestURL = scriptExecutionContext()->completeURL(url);
+ URL requestURL = scriptExecutionContext()->completeURL(url, ScriptExecutionContext::ForceUTF8::Yes);
if (!requestURL.isValid() || !requestURL.user().isEmpty() || !requestURL.pass().isEmpty())
return Exception { TypeError, "URL is not valid or contains user credentials."_s };
Modified: trunk/Source/WebCore/dom/Document.cpp (254671 => 254672)
--- trunk/Source/WebCore/dom/Document.cpp 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/Source/WebCore/dom/Document.cpp 2020-01-16 12:13:17 UTC (rev 254672)
@@ -5205,7 +5205,7 @@
m_decoder = WTFMove(decoder);
}
-URL Document::completeURL(const String& url, const URL& baseURLOverride) const
+URL Document::completeURL(const String& url, const URL& baseURLOverride, ForceUTF8 forceUTF8) const
{
// Always return a null URL when passed a null string.
// FIXME: Should we change the URL constructor to have this behavior?
@@ -5213,14 +5213,14 @@
if (url.isNull())
return URL();
const URL& baseURL = ((baseURLOverride.isEmpty() || baseURLOverride == WTF::blankURL()) && parentDocument()) ? parentDocument()->baseURL() : baseURLOverride;
- if (!m_decoder)
+ if (!m_decoder || forceUTF8 == ForceUTF8::Yes)
return URL(baseURL, url);
return URL(baseURL, url, m_decoder->encodingForURLParsing());
}
-URL Document::completeURL(const String& url) const
+URL Document::completeURL(const String& url, ForceUTF8 forceUTF8) const
{
- return completeURL(url, m_baseURL);
+ return completeURL(url, m_baseURL, forceUTF8);
}
void Document::setBackForwardCacheState(BackForwardCacheState state)
Modified: trunk/Source/WebCore/dom/Document.h (254671 => 254672)
--- trunk/Source/WebCore/dom/Document.h 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/Source/WebCore/dom/Document.h 2020-01-16 12:13:17 UTC (rev 254672)
@@ -687,8 +687,8 @@
const String& baseTarget() const { return m_baseTarget; }
void processBaseElement();
- WEBCORE_EXPORT URL completeURL(const String&) const final;
- URL completeURL(const String&, const URL& baseURLOverride) const;
+ WEBCORE_EXPORT URL completeURL(const String&, ForceUTF8 = ForceUTF8::No) const final;
+ URL completeURL(const String&, const URL& baseURLOverride, ForceUTF8 = ForceUTF8::No) const;
String userAgent(const URL&) const final;
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (254671 => 254672)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.h 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h 2020-01-16 12:13:17 UTC (rev 254672)
@@ -94,7 +94,8 @@
virtual EventLoopTaskGroup& eventLoop() = 0;
virtual const URL& url() const = 0;
- virtual URL completeURL(const String& url) const = 0;
+ enum class ForceUTF8 { No, Yes };
+ virtual URL completeURL(const String& url, ForceUTF8 = ForceUTF8::No) const = 0;
virtual String userAgent(const URL&) const = 0;
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (254671 => 254672)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2020-01-16 12:13:17 UTC (rev 254672)
@@ -167,7 +167,7 @@
contentSecurityPolicy()->didReceiveHeaders(contentSecurityPolicyResponseHeaders, String { });
}
-URL WorkerGlobalScope::completeURL(const String& url) const
+URL WorkerGlobalScope::completeURL(const String& url, ForceUTF8) const
{
// Always return a null URL when passed a null string.
// FIXME: Should we change the URL constructor to have this behavior?
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (254671 => 254672)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.h 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h 2020-01-16 12:13:17 UTC (rev 254672)
@@ -160,7 +160,7 @@
bool isWorkerGlobalScope() const final { return true; }
ScriptExecutionContext* scriptExecutionContext() const final { return const_cast<WorkerGlobalScope*>(this); }
- URL completeURL(const String&) const final;
+ URL completeURL(const String&, ForceUTF8 = ForceUTF8::No) const final;
String userAgent(const URL&) const final;
void disableEval(const String& errorMessage) final;
void disableWebAssembly(const String& errorMessage) final;
Modified: trunk/Source/WebCore/worklets/WorkletGlobalScope.cpp (254671 => 254672)
--- trunk/Source/WebCore/worklets/WorkletGlobalScope.cpp 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/Source/WebCore/worklets/WorkletGlobalScope.cpp 2020-01-16 12:13:17 UTC (rev 254672)
@@ -131,7 +131,7 @@
m_script->disableWebAssembly(errorMessage);
}
-URL WorkletGlobalScope::completeURL(const String& url) const
+URL WorkletGlobalScope::completeURL(const String& url, ForceUTF8) const
{
if (url.isNull())
return URL();
Modified: trunk/Source/WebCore/worklets/WorkletGlobalScope.h (254671 => 254672)
--- trunk/Source/WebCore/worklets/WorkletGlobalScope.h 2020-01-16 11:36:10 UTC (rev 254671)
+++ trunk/Source/WebCore/worklets/WorkletGlobalScope.h 2020-01-16 12:13:17 UTC (rev 254672)
@@ -120,7 +120,7 @@
bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) final { RELEASE_ASSERT_NOT_REACHED(); return false; }
bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) final { RELEASE_ASSERT_NOT_REACHED(); return false; }
#endif
- URL completeURL(const String&) const final;
+ URL completeURL(const String&, ForceUTF8 = ForceUTF8::No) const final;
String userAgent(const URL&) const final;
void disableEval(const String&) final;
void disableWebAssembly(const String&) final;