Changeset 254672 in webkit
- Timestamp:
- Jan 16, 2020 4:13:17 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r254669 r254672 1 2020-01-16 Rob Buis <rbuis@igalia.com> 2 3 Fetch: URL parser not always using UTF-8 4 https://bugs.webkit.org/show_bug.cgi?id=178008 5 6 Reviewed by Youenn Fablet. 7 8 Update improved test result. 9 10 * web-platform-tests/fetch/api/request/url-encoding-expected.txt: 11 1 12 2020-01-16 Cathie Chen <cathiechen@igalia.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding-expected.txt
r223441 r254672 1 1 2 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" 3 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" 2 PASS URL encoding and Request 3 PASS URL encoding and fetch() 4 4 -
trunk/Source/WebCore/ChangeLog
r254670 r254672 1 2020-01-16 Rob Buis <rbuis@igalia.com> 2 3 Fetch: URL parser not always using UTF-8 4 https://bugs.webkit.org/show_bug.cgi?id=178008 5 6 Reviewed by Youenn Fablet. 7 8 Make sure fetch requests run the URL parser with a UTF-8 decoder. 9 10 Test: web-platform-tests/fetch/api/request/url-encoding.html 11 12 * Modules/fetch/FetchRequest.cpp: 13 (WebCore::FetchRequest::initializeWith): 14 * dom/Document.cpp: 15 (WebCore::Document::completeURL const): 16 * dom/Document.h: 17 * dom/ScriptExecutionContext.h: 18 * workers/WorkerGlobalScope.cpp: 19 (WebCore::WorkerGlobalScope::completeURL const): 20 * workers/WorkerGlobalScope.h: 21 * worklets/WorkletGlobalScope.cpp: 22 (WebCore::WorkletGlobalScope::completeURL const): 23 * worklets/WorkletGlobalScope.h: 24 1 25 2020-01-16 Alicia Boya García <aboya@igalia.com> 2 26 -
trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp
r252349 r254672 162 162 ASSERT(scriptExecutionContext()); 163 163 // FIXME: Tighten the URL parsing algorithm according https://url.spec.whatwg.org/#concept-url-parser. 164 URL requestURL = scriptExecutionContext()->completeURL(url );164 URL requestURL = scriptExecutionContext()->completeURL(url, ScriptExecutionContext::ForceUTF8::Yes); 165 165 if (!requestURL.isValid() || !requestURL.user().isEmpty() || !requestURL.pass().isEmpty()) 166 166 return Exception { TypeError, "URL is not valid or contains user credentials."_s }; -
trunk/Source/WebCore/dom/Document.cpp
r254652 r254672 5206 5206 } 5207 5207 5208 URL Document::completeURL(const String& url, const URL& baseURLOverride ) const5208 URL Document::completeURL(const String& url, const URL& baseURLOverride, ForceUTF8 forceUTF8) const 5209 5209 { 5210 5210 // Always return a null URL when passed a null string. … … 5214 5214 return URL(); 5215 5215 const URL& baseURL = ((baseURLOverride.isEmpty() || baseURLOverride == WTF::blankURL()) && parentDocument()) ? parentDocument()->baseURL() : baseURLOverride; 5216 if (!m_decoder )5216 if (!m_decoder || forceUTF8 == ForceUTF8::Yes) 5217 5217 return URL(baseURL, url); 5218 5218 return URL(baseURL, url, m_decoder->encodingForURLParsing()); 5219 5219 } 5220 5220 5221 URL Document::completeURL(const String& url ) const5222 { 5223 return completeURL(url, m_baseURL );5221 URL Document::completeURL(const String& url, ForceUTF8 forceUTF8) const 5222 { 5223 return completeURL(url, m_baseURL, forceUTF8); 5224 5224 } 5225 5225 -
trunk/Source/WebCore/dom/Document.h
r254652 r254672 688 688 void processBaseElement(); 689 689 690 WEBCORE_EXPORT URL completeURL(const String& ) const final;691 URL completeURL(const String&, const URL& baseURLOverride ) const;690 WEBCORE_EXPORT URL completeURL(const String&, ForceUTF8 = ForceUTF8::No) const final; 691 URL completeURL(const String&, const URL& baseURLOverride, ForceUTF8 = ForceUTF8::No) const; 692 692 693 693 String userAgent(const URL&) const final; -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r254182 r254672 95 95 96 96 virtual const URL& url() const = 0; 97 virtual URL completeURL(const String& url) const = 0; 97 enum class ForceUTF8 { No, Yes }; 98 virtual URL completeURL(const String& url, ForceUTF8 = ForceUTF8::No) const = 0; 98 99 99 100 virtual String userAgent(const URL&) const = 0; -
trunk/Source/WebCore/workers/WorkerGlobalScope.cpp
r253091 r254672 168 168 } 169 169 170 URL WorkerGlobalScope::completeURL(const String& url ) const170 URL WorkerGlobalScope::completeURL(const String& url, ForceUTF8) const 171 171 { 172 172 // Always return a null URL when passed a null string. -
trunk/Source/WebCore/workers/WorkerGlobalScope.h
r254182 r254672 161 161 162 162 ScriptExecutionContext* scriptExecutionContext() const final { return const_cast<WorkerGlobalScope*>(this); } 163 URL completeURL(const String& ) const final;163 URL completeURL(const String&, ForceUTF8 = ForceUTF8::No) const final; 164 164 String userAgent(const URL&) const final; 165 165 void disableEval(const String& errorMessage) final; -
trunk/Source/WebCore/worklets/WorkletGlobalScope.cpp
r254182 r254672 132 132 } 133 133 134 URL WorkletGlobalScope::completeURL(const String& url ) const134 URL WorkletGlobalScope::completeURL(const String& url, ForceUTF8) const 135 135 { 136 136 if (url.isNull()) -
trunk/Source/WebCore/worklets/WorkletGlobalScope.h
r254182 r254672 121 121 bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) final { RELEASE_ASSERT_NOT_REACHED(); return false; } 122 122 #endif 123 URL completeURL(const String& ) const final;123 URL completeURL(const String&, ForceUTF8 = ForceUTF8::No) const final; 124 124 String userAgent(const URL&) const final; 125 125 void disableEval(const String&) final;
Note: See TracChangeset
for help on using the changeset viewer.