Commit 48ef5e92 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Use FetchClientSettingsObject::GlobalObjectUrl() from WorkerFetchContext

To remove ExecutionContext::Url() call from WorkerFetchContext.

Bug: 878274, 931532
Change-Id: I40eaa79c72cc0c9b6ff9c7a7ecc2b206ee39bc28
Reviewed-on: https://chromium-review.googlesource.com/c/1394382Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#633814}
parent e974d3c9
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
#include "third_party/blink/renderer/core/workers/worker_content_settings_client.h" #include "third_party/blink/renderer/core/workers/worker_content_settings_client.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/platform/exported/wrapped_resource_request.h" #include "third_party/blink/renderer/platform/exported/wrapped_resource_request.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h"
#include "third_party/blink/renderer/platform/network/network_state_notifier.h" #include "third_party/blink/renderer/platform/network/network_state_notifier.h"
#include "third_party/blink/renderer/platform/network/network_utils.h" #include "third_party/blink/renderer/platform/network/network_utils.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
...@@ -164,7 +166,9 @@ bool WorkerFetchContext::ShouldBlockFetchAsCredentialedSubresource( ...@@ -164,7 +166,9 @@ bool WorkerFetchContext::ShouldBlockFetchAsCredentialedSubresource(
} }
const KURL& WorkerFetchContext::Url() const { const KURL& WorkerFetchContext::Url() const {
return global_scope_->Url(); return GetResourceFetcherProperties()
.GetFetchClientSettingsObject()
.GlobalObjectUrl();
} }
const SecurityOrigin* WorkerFetchContext::GetParentSecurityOrigin() const { const SecurityOrigin* WorkerFetchContext::GetParentSecurityOrigin() const {
......
CONSOLE ERROR: Unsafe attempt to load URL http://localhost:8000/workers/resources/worker-redirect-target.js from frame with URL http://127.0.0.1:8000/resources/redirect.php?url=http://localhost:8000/workers/resources/worker-redirect-target.js. Domains, protocols and ports must match.
Test that loading the worker's script does not allow a cross origin redirect (bug 26146)
SUCCESS: threw exception (SecurityError: Failed to construct 'Worker': Script at 'http://localhost:8000/workers/resources/worker-target.js' cannot be accessed from origin 'http://127.0.0.1:8000'.) when attempting to cross origin while loading the worker script.
SUCCESS: threw error when attempting to redirected cross origin while loading the worker script.
DONE
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