summaryrefslogtreecommitdiffstats
path: root/content/browser/service_worker
diff options
context:
space:
mode:
authorhoro <horo@chromium.org>2016-02-23 02:00:17 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-23 10:02:19 +0000
commit3cbfbfb9a38555d156e4034435de61722503c7c8 (patch)
tree93ad3ceb59a0952e7167ccb655d354b985f7908e /content/browser/service_worker
parent86a5a18c6f9e720fdaac9e5dc5eca8aafcb888ce (diff)
downloadchromium_src-3cbfbfb9a38555d156e4034435de61722503c7c8.zip
chromium_src-3cbfbfb9a38555d156e4034435de61722503c7c8.tar.gz
chromium_src-3cbfbfb9a38555d156e4034435de61722503c7c8.tar.bz2
Change the logic to find the best matching Service Worker to debug
The current logic uses the length of the service worker script URL's directory to find the best matching service worker to debug. But the directory may not be same as the service worker's scope and this logic may choose wrong service workers. This CL change this logic to use the actual scope of the service worker, and check whether the page URL matches to the scope. BUG=584296 Review URL: https://codereview.chromium.org/1713933002 Cr-Commit-Position: refs/heads/master@{#376958}
Diffstat (limited to 'content/browser/service_worker')
-rw-r--r--content/browser/service_worker/embedded_worker_instance.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc
index 6811d2c..147de7e 100644
--- a/content/browser/service_worker/embedded_worker_instance.cc
+++ b/content/browser/service_worker/embedded_worker_instance.cc
@@ -59,6 +59,7 @@ void RegisterToWorkerDevToolsManagerOnUI(
const base::WeakPtr<ServiceWorkerContextCore>& service_worker_context_weak,
int64_t service_worker_version_id,
const GURL& url,
+ const GURL& scope,
const base::Callback<void(int worker_devtools_agent_route_id,
bool wait_for_debugger)>& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -69,13 +70,10 @@ void RegisterToWorkerDevToolsManagerOnUI(
worker_devtools_agent_route_id = rph->GetNextRoutingID();
wait_for_debugger =
ServiceWorkerDevToolsManager::GetInstance()->WorkerCreated(
- process_id,
- worker_devtools_agent_route_id,
+ process_id, worker_devtools_agent_route_id,
ServiceWorkerDevToolsManager::ServiceWorkerIdentifier(
- service_worker_context,
- service_worker_context_weak,
- service_worker_version_id,
- url));
+ service_worker_context, service_worker_context_weak,
+ service_worker_version_id, url, scope));
}
BrowserThread::PostTask(
BrowserThread::IO,
@@ -272,12 +270,13 @@ class EmbeddedWorkerInstance::StartTask {
// Register the instance to DevToolsManager on UI thread.
const int64_t service_worker_version_id = params->service_worker_version_id;
+ const GURL& scope = params->scope;
GURL script_url(params->script_url);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(RegisterToWorkerDevToolsManagerOnUI, process_id,
instance_->context_.get(), instance_->context_,
- service_worker_version_id, script_url,
+ service_worker_version_id, script_url, scope,
base::Bind(&StartTask::OnRegisteredToDevToolsManager,
weak_factory_.GetWeakPtr(), base::Passed(&params),
is_new_process)));