New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 772390 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
OoO until Feb 4th
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Fetch: URL parser not always using UTF-8

Project Member Reported by annevank...@gmail.com, Oct 6 2017

Issue description

See 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.
 
Cc: raphael....@intel.com
Labels: -OS-Mac
Status: Available (was: Unconfirmed)
Components: Blink>Network
Cc: tyoshino@chromium.org yhirano@chromium.org
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?
ExecutionContext doesn't expose the API base URL and that's the problem, right?
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);

Document::VirtualURL returns url_ but what we need is base_url_, I think.
(I assume Document::url_ is not updated by base elements. Please let me know if I'm wrong.)
Cc: hayato@chromium.org
+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.
Owner: raphael....@intel.com
Status: Started (was: Available)
Project Member

Comment 10 by bugdroid1@chromium.org, 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

Labels: M-64
Status: Fixed (was: Started)
We've probably missed the M63 cut, so I guess this will be M64 material.

Sign in to add a comment