Commit 2806ca5d authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Use response URL for classic shared worker global scope's URL

Bug: 861564
Change-Id: Ia41cf740fc405269307a8c92c85d8aaf4b54c9d1
Reviewed-on: https://chromium-review.googlesource.com/1128541
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578778}
parent 9c4e41b1
...@@ -96,7 +96,7 @@ chrome.test.getConfig(function(config) { ...@@ -96,7 +96,7 @@ chrome.test.getConfig(function(config) {
sameOriginRedirectTest.bind( sameOriginRedirectTest.bind(
undefined, undefined,
() => { return new SharedWorker(redirectedSharedWorkerUrl) }, () => { return new SharedWorker(redirectedSharedWorkerUrl) },
redirectedSharedWorkerUrl), sharedWorkerUrl),
crossOriginRedirectTest.bind( crossOriginRedirectTest.bind(
undefined, undefined,
......
...@@ -3601,14 +3601,6 @@ crbug.com/762017 external/wpt/html/semantics/embedded-content/media-elements/vid ...@@ -3601,14 +3601,6 @@ crbug.com/762017 external/wpt/html/semantics/embedded-content/media-elements/vid
crbug.com/850662 external/wpt/workers/baseurl/alpha/worker-in-worker.html [ Failure ] crbug.com/850662 external/wpt/workers/baseurl/alpha/worker-in-worker.html [ Failure ]
crbug.com/850662 external/wpt/workers/baseurl/alpha/sharedworker-in-worker.html [ Failure ] crbug.com/850662 external/wpt/workers/baseurl/alpha/sharedworker-in-worker.html [ Failure ]
# crbug.com/861564 is ongoing for classic shared workers.
crbug.com/861564 external/wpt/workers/baseurl/alpha/importScripts-in-sharedworker.html [ Failure ]
crbug.com/861564 external/wpt/workers/baseurl/alpha/xhr-in-sharedworker.html [ Failure ]
crbug.com/861564 external/wpt/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html [ Failure ]
crbug.com/861564 external/wpt/xhr/open-url-redirected-sharedworker-origin.htm [ Failure ]
crbug.com/861564 virtual/outofblink-cors/external/wpt/xhr/open-url-redirected-sharedworker-origin.htm [ Failure ]
crbug.com/861564 virtual/outofblink-cors-ns/external/wpt/xhr/open-url-redirected-sharedworker-origin.htm [ Failure ]
# crbug.com/861564 is ongoing for module dedicated workers. # crbug.com/861564 is ongoing for module dedicated workers.
crbug.com/861564 external/wpt/workers/baseurl/alpha/xhr-in-moduleworker.html [ Failure ] crbug.com/861564 external/wpt/workers/baseurl/alpha/xhr-in-moduleworker.html [ Failure ]
crbug.com/861564 external/wpt/workers/interfaces/WorkerGlobalScope/location/redirect-module.html [ Failure ] crbug.com/861564 external/wpt/workers/interfaces/WorkerGlobalScope/location/redirect-module.html [ Failure ]
......
...@@ -128,13 +128,13 @@ void WebSharedWorkerImpl::OnShadowPageInitialized() { ...@@ -128,13 +128,13 @@ void WebSharedWorkerImpl::OnShadowPageInitialized() {
network::mojom::FetchRequestMode::kSameOrigin; network::mojom::FetchRequestMode::kSameOrigin;
network::mojom::FetchCredentialsMode fetch_credentials_mode = network::mojom::FetchCredentialsMode fetch_credentials_mode =
network::mojom::FetchCredentialsMode::kSameOrigin; network::mojom::FetchCredentialsMode::kSameOrigin;
if ((static_cast<KURL>(url_)).ProtocolIsData()) { if ((static_cast<KURL>(script_request_url_)).ProtocolIsData()) {
fetch_request_mode = network::mojom::FetchRequestMode::kNoCORS; fetch_request_mode = network::mojom::FetchRequestMode::kNoCORS;
fetch_credentials_mode = network::mojom::FetchCredentialsMode::kInclude; fetch_credentials_mode = network::mojom::FetchCredentialsMode::kInclude;
} }
main_script_loader_->LoadTopLevelScriptAsynchronously( main_script_loader_->LoadTopLevelScriptAsynchronously(
*shadow_page_->GetDocument(), url_, *shadow_page_->GetDocument(), script_request_url_,
WebURLRequest::kRequestContextSharedWorker, fetch_request_mode, WebURLRequest::kRequestContextSharedWorker, fetch_request_mode,
fetch_credentials_mode, creation_address_space_, fetch_credentials_mode, creation_address_space_,
Bind(&WebSharedWorkerImpl::DidReceiveScriptLoaderResponse, Bind(&WebSharedWorkerImpl::DidReceiveScriptLoaderResponse,
...@@ -151,7 +151,7 @@ void WebSharedWorkerImpl::ResumeStartup() { ...@@ -151,7 +151,7 @@ void WebSharedWorkerImpl::ResumeStartup() {
is_paused_on_start_ = false; is_paused_on_start_ = false;
if (is_paused_on_start) { if (is_paused_on_start) {
// We'll continue in OnShadowPageInitialized(). // We'll continue in OnShadowPageInitialized().
shadow_page_->Initialize(url_); shadow_page_->Initialize(script_request_url_);
} }
} }
...@@ -208,7 +208,7 @@ void WebSharedWorkerImpl::ConnectTaskOnWorkerThread( ...@@ -208,7 +208,7 @@ void WebSharedWorkerImpl::ConnectTaskOnWorkerThread(
} }
void WebSharedWorkerImpl::StartWorkerContext( void WebSharedWorkerImpl::StartWorkerContext(
const WebURL& url, const WebURL& script_request_url,
const WebString& name, const WebString& name,
const WebString& content_security_policy, const WebString& content_security_policy,
WebContentSecurityPolicyType policy_type, WebContentSecurityPolicyType policy_type,
...@@ -218,7 +218,7 @@ void WebSharedWorkerImpl::StartWorkerContext( ...@@ -218,7 +218,7 @@ void WebSharedWorkerImpl::StartWorkerContext(
mojo::ScopedMessagePipeHandle content_settings_handle, mojo::ScopedMessagePipeHandle content_settings_handle,
mojo::ScopedMessagePipeHandle interface_provider) { mojo::ScopedMessagePipeHandle interface_provider) {
DCHECK(IsMainThread()); DCHECK(IsMainThread());
url_ = url; script_request_url_ = script_request_url;
name_ = name; name_ = name;
creation_address_space_ = creation_address_space; creation_address_space_ = creation_address_space;
// Chrome doesn't use interface versioning. // Chrome doesn't use interface versioning.
...@@ -242,7 +242,7 @@ void WebSharedWorkerImpl::StartWorkerContext( ...@@ -242,7 +242,7 @@ void WebSharedWorkerImpl::StartWorkerContext(
} }
// We'll continue in OnShadowPageInitialized(). // We'll continue in OnShadowPageInitialized().
shadow_page_->Initialize(url_); shadow_page_->Initialize(script_request_url_);
} }
void WebSharedWorkerImpl::DidReceiveScriptLoaderResponse() { void WebSharedWorkerImpl::DidReceiveScriptLoaderResponse() {
...@@ -331,9 +331,14 @@ void WebSharedWorkerImpl::ContinueOnScriptLoaderFinished() { ...@@ -331,9 +331,14 @@ void WebSharedWorkerImpl::ContinueOnScriptLoaderFinished() {
// (https://crbug.com/824646) // (https://crbug.com/824646)
ScriptType script_type = ScriptType::kClassic; ScriptType script_type = ScriptType::kClassic;
const KURL script_response_url = main_script_loader_->ResponseURL();
DCHECK(static_cast<KURL>(script_request_url_) == script_response_url ||
SecurityOrigin::AreSameSchemeHostPort(script_request_url_,
script_response_url));
auto global_scope_creation_params = auto global_scope_creation_params =
std::make_unique<GlobalScopeCreationParams>( std::make_unique<GlobalScopeCreationParams>(
url_, script_type, document->UserAgent(), script_response_url, script_type, document->UserAgent(),
content_security_policy ? content_security_policy->Headers() content_security_policy ? content_security_policy->Headers()
: Vector<CSPHeaderAndType>(), : Vector<CSPHeaderAndType>(),
referrer_policy, starter_origin, starter_secure_context, referrer_policy, starter_origin, starter_secure_context,
...@@ -361,9 +366,9 @@ void WebSharedWorkerImpl::ContinueOnScriptLoaderFinished() { ...@@ -361,9 +366,9 @@ void WebSharedWorkerImpl::ContinueOnScriptLoaderFinished() {
worker_inspector_proxy_->ShouldPauseOnWorkerStart(document), worker_inspector_proxy_->ShouldPauseOnWorkerStart(document),
parent_execution_context_task_runners_); parent_execution_context_task_runners_);
worker_inspector_proxy_->WorkerThreadCreated(document, GetWorkerThread(), worker_inspector_proxy_->WorkerThreadCreated(document, GetWorkerThread(),
url_); script_response_url);
// TODO(nhiroki): Support module workers (https://crbug.com/680046). // TODO(nhiroki): Support module workers (https://crbug.com/680046).
GetWorkerThread()->EvaluateClassicScript(url_, source_code, GetWorkerThread()->EvaluateClassicScript(script_response_url, source_code,
nullptr /* cached_meta_data */, nullptr /* cached_meta_data */,
v8_inspector::V8StackTraceId()); v8_inspector::V8StackTraceId());
client_->WorkerScriptLoaded(); client_->WorkerScriptLoaded();
......
...@@ -144,7 +144,7 @@ class CORE_EXPORT WebSharedWorkerImpl final : public WebSharedWorker, ...@@ -144,7 +144,7 @@ class CORE_EXPORT WebSharedWorkerImpl final : public WebSharedWorker,
// Kept around only while main script loading is ongoing. // Kept around only while main script loading is ongoing.
scoped_refptr<WorkerClassicScriptLoader> main_script_loader_; scoped_refptr<WorkerClassicScriptLoader> main_script_loader_;
WebURL url_; WebURL script_request_url_;
WebString name_; WebString name_;
mojom::IPAddressSpace creation_address_space_; mojom::IPAddressSpace creation_address_space_;
......
...@@ -69,8 +69,6 @@ struct CORE_EXPORT GlobalScopeCreationParams final { ...@@ -69,8 +69,6 @@ struct CORE_EXPORT GlobalScopeCreationParams final {
// GlobalScopeCreationParams, but this mechanism is not yet implemented. // GlobalScopeCreationParams, but this mechanism is not yet implemented.
// TODO(crbug/861564): implement this and set the response URL to module // TODO(crbug/861564): implement this and set the response URL to module
// workers. // workers.
//
// TODO(crbug/861564): Set this to response URL for classic shared workers.
KURL script_url; KURL script_url;
ScriptType script_type; ScriptType script_type;
......
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