Fetch: URL parser not always using UTF-8 |
||||||
Issue descriptionSee https://github.com/w3c/web-platform-tests/pull/7604 for tests. fetch() and Request should really not pass the document encoding on toward the URL parser.
,
Oct 6 2017
,
Oct 6 2017
yhirano/tyoshino: the difference in behavior essentially boils down to our DOMURL constructor doing url_ = KURL(base, url); while Request::CreateRequestWithRequestOrString() does KURL parsed_url = ExecutionContext::From(script_state)->CompleteURL(input_string); which resolves to Document::CompleteURLWithOverride() that does return KURL(base_url_override, url, Encoding()); do we really need to go through ExecutionContext instead of just creating a KURL like DOMURL does?
,
Oct 10 2017
ExecutionContext doesn't expose the API base URL and that's the problem, right?
,
Oct 10 2017
It doesn't expose a base URL directly, but can't we just use either Url() or ContextURL() there? Something like
KURL parsed_url = KURL(ExecutionContext::From(script_state)->Url(),
input_string);
,
Oct 10 2017
Document::VirtualURL returns url_ but what we need is base_url_, I think.
,
Oct 10 2017
(I assume Document::url_ is not updated by base elements. Please let me know if I'm wrong.)
,
Oct 10 2017
+hayato > (I assume Document::url_ is not updated by base elements. Please let me know if I'm wrong.) I think you're right. I wonder if the core/dom/ OWNERS would be open to extending the ExecutionContext API with a CompleteURL() overload that allowed one to specify an encoding.
,
Oct 12 2017
,
Oct 13 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/78b3d64eebceed5d2a78988262f2ebe899badf51 commit 78b3d64eebceed5d2a78988262f2ebe899badf51 Author: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> Date: Fri Oct 13 12:58:21 2017 ExecutionContext: Add BaseURL() and use it in Fetch's Request constructor. See https://github.com/w3c/web-platform-tests/pull/7604. We were previously relying on ExecutionContext::CompleteURL() in order to parse a given URL with the execution context's base URL. This works most of the time, but Document's implementation takes the document's encoding into account, whereas Fetch expects UTF-8 to be used in all cases. We now expose a BaseURL() method in ExecutionContext and use it to parse URLs in Fetch's Request constructor directly. Incidentally, this also allows us to make sure referrer parsing is done in UTF-8. Bug: 772390 Change-Id: I2926b483709799fc4f5110a2ec101394d0766678 Reviewed-on: https://chromium-review.googlesource.com/712576 Commit-Queue: Raphael Kubo da Costa (rakuco) <raphael.kubo.da.costa@intel.com> Reviewed-by: Takeshi Yoshino <tyoshino@chromium.org> Reviewed-by: Hayato Ito <hayato@chromium.org> Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Cr-Commit-Position: refs/heads/master@{#508682} [delete] https://crrev.com/a1fd27d04932e92f2a31f085da04724e707f8a26/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/url-encoding-expected.txt [delete] https://crrev.com/a1fd27d04932e92f2a31f085da04724e707f8a26/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-blobs/external/wpt/fetch/api/request/url-encoding-expected.txt [delete] https://crrev.com/a1fd27d04932e92f2a31f085da04724e707f8a26/third_party/WebKit/LayoutTests/platform/linux/virtual/outofblink-cors/external/wpt/fetch/api/request/url-encoding-expected.txt [delete] https://crrev.com/a1fd27d04932e92f2a31f085da04724e707f8a26/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-blobs/external/wpt/fetch/api/request/url-encoding-expected.txt [delete] https://crrev.com/a1fd27d04932e92f2a31f085da04724e707f8a26/third_party/WebKit/LayoutTests/platform/mac/virtual/outofblink-cors/external/wpt/fetch/api/request/url-encoding-expected.txt [modify] https://crrev.com/78b3d64eebceed5d2a78988262f2ebe899badf51/third_party/WebKit/Source/core/dom/Document.h [modify] https://crrev.com/78b3d64eebceed5d2a78988262f2ebe899badf51/third_party/WebKit/Source/core/dom/ExecutionContext.h [modify] https://crrev.com/78b3d64eebceed5d2a78988262f2ebe899badf51/third_party/WebKit/Source/core/testing/NullExecutionContext.h [modify] https://crrev.com/78b3d64eebceed5d2a78988262f2ebe899badf51/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp [modify] https://crrev.com/78b3d64eebceed5d2a78988262f2ebe899badf51/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h [modify] https://crrev.com/78b3d64eebceed5d2a78988262f2ebe899badf51/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp [modify] https://crrev.com/78b3d64eebceed5d2a78988262f2ebe899badf51/third_party/WebKit/Source/core/workers/WorkletGlobalScope.h [modify] https://crrev.com/78b3d64eebceed5d2a78988262f2ebe899badf51/third_party/WebKit/Source/modules/fetch/Request.cpp
,
Oct 13 2017
We've probably missed the M63 cut, so I guess this will be M64 material. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by raphael....@intel.com
, Oct 6 2017Labels: -OS-Mac
Status: Available (was: Unconfirmed)