Commit d1e8bc18 authored by Eriko Kurimoto's avatar Eriko Kurimoto Committed by Commit Bot

ServiceWorker: Remove outgoing_referrer value settings

This CL removes codes for setting script_url value to outgoing_referrer
when it is an empty string.
Setting script_url value here instead of an empty string is wrong
according to the spec, but we are doing so to pass DCHECK in security_policy.cc.
(DCHECK: https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/weborigin/security_policy.cc;l=114;drc=a1e88003b410ca2c3927e17be60a97ed8fedefab?originalUrl=https:%2F%2Fcs.chromium.org%2F)
The reason why we were using script_url and not String() was to make
the behavior same to the original code.
It is discussed here:
https://chromium-review.googlesource.com/c/chromium/src/+/1861294/8/third_party/blink/renderer/modules/service_worker/service_worker_container.cc

However, now we change the constructor of WebFetchClientSettingObject
to prevent outgoing_referrer from taking invalid values.
(See https://chromium-review.googlesource.com/c/chromium/src/+/2033004)

This CL changes the behavior when outgoing_referrer is empty,
which occurs in some rare cases like extensions, and doesn't add tests
because it's hard to test.

Bug: 1047612
Change-Id: Ie4a1a5a784019706fcad156e1668f7f2236bb2f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032691
Commit-Queue: Eriko Kurimoto <elkurin@google.com>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738144}
parent 3c31a8e5
......@@ -355,11 +355,6 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(
execution_context->Fetcher()
->GetProperties()
.GetFetchClientSettingsObject());
// The outgoing referrer is a required parameter. Use |script_url| if the
// ResourceFetcher doesn't provide it.
if (fetch_client_settings_object.outgoing_referrer.IsEmpty()) {
fetch_client_settings_object.outgoing_referrer = script_url;
}
provider_->RegisterServiceWorker(
scope_url, script_url, *script_type, update_via_cache,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment