Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: content/browser/service_worker/service_worker_version.cc

Issue 984853003: Service Worker: Clients.openWindow() should allow opening x-origin URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_version.cc
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index d6468fda7154264c99632e318529d5820c923f16..8774a99c45b440d80461e99ffe2dfed83aedf8ff 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -269,15 +269,6 @@ void OpenWindowOnUI(
base::Bind(&DidOpenURL, callback));
}
-void KillEmbeddedWorkerProcess(int process_id, ResultCode code) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- RenderProcessHost* render_process_host =
- RenderProcessHost::FromID(process_id);
- if (render_process_host->GetHandle() != base::kNullProcessHandle)
- render_process_host->ReceivedBadMessage();
-}
-
} // namespace
ServiceWorkerVersion::ServiceWorkerVersion(
@@ -1151,18 +1142,6 @@ void ServiceWorkerVersion::OnOpenWindow(int request_id, const GURL& url) {
if (!context_)
return;
- if (url.GetOrigin() != script_url_.GetOrigin()) {
- // There should be a same origin check by Blink, if the request is still not
- // same origin, the process might be compromised and should be eliminated.
- DVLOG(1) << "Received a cross origin openWindow() request from a service "
- "worker. Killing associated process.";
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&KillEmbeddedWorkerProcess,
- embedded_worker_->process_id(),
- RESULT_CODE_KILLED_BAD_MESSAGE));
- return;
- }
-
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&OpenWindowOnUI,
@@ -1172,10 +1151,12 @@ void ServiceWorkerVersion::OnOpenWindow(int request_id, const GURL& url) {
make_scoped_refptr(context_->wrapper()),
base::Bind(&ServiceWorkerVersion::DidOpenWindow,
weak_factory_.GetWeakPtr(),
- request_id)));
+ request_id,
+ url)));
jsbell 2015/03/06 16:59:36 I agree this matches the spec, but it's a little w
jungkees 2015/03/09 05:53:01 Filed: https://github.com/slightlyoff/ServiceWorke
}
void ServiceWorkerVersion::DidOpenWindow(int request_id,
+ const GURL& url,
int render_process_id,
int render_frame_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -1199,17 +1180,18 @@ void ServiceWorkerVersion::DidOpenWindow(int request_id,
// it.second is the client_id associated with the provider_host.
provider_host->GetClientInfo(
base::Bind(&ServiceWorkerVersion::OnOpenWindowFinished,
- weak_factory_.GetWeakPtr(), request_id, it.second));
+ weak_factory_.GetWeakPtr(), request_id, url, it.second));
return;
}
// If here, it means that no provider_host was found, in which case, the
// renderer should still be informed that the window was opened.
- OnOpenWindowFinished(request_id, 0, ServiceWorkerClientInfo());
+ OnOpenWindowFinished(request_id, url, 0, ServiceWorkerClientInfo());
}
void ServiceWorkerVersion::OnOpenWindowFinished(
int request_id,
+ const GURL& url,
int client_id,
const ServiceWorkerClientInfo& client_info) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -1226,7 +1208,7 @@ void ServiceWorkerVersion::OnOpenWindowFinished(
client.client_id = client_id;
embedded_worker_->SendMessage(ServiceWorkerMsg_OpenWindowResponse(
- request_id, client));
+ request_id, url, client));
}
void ServiceWorkerVersion::OnSetCachedMetadata(const GURL& url,
« no previous file with comments | « content/browser/service_worker/service_worker_version.h ('k') | content/common/service_worker/service_worker_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698