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

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

Issue 1656933003: Add origins argument to registerForeignFetchScopes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add url::Origin::operator== to make tests simpler Created 4 years, 10 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 b4ce1c924ba0ea8e7222fec9d2009c05b4ada234..76d91b29e2b78891b4ad3ef9c9320a273f04aabd 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -1272,7 +1272,8 @@ void ServiceWorkerVersion::OnPongFromWorker() {
}
void ServiceWorkerVersion::OnRegisterForeignFetchScopes(
- const std::vector<GURL>& sub_scopes) {
+ const std::vector<GURL>& sub_scopes,
+ const std::vector<url::Origin>& origins) {
DCHECK(status() == INSTALLING || status() == REDUNDANT) << status();
// Renderer should have already verified all these urls are inside the
// worker's scope, but verify again here on the browser process side.
@@ -1290,8 +1291,18 @@ void ServiceWorkerVersion::OnRegisterForeignFetchScopes(
return;
}
}
- foreign_fetch_scopes_.insert(foreign_fetch_scopes_.end(), sub_scopes.begin(),
- sub_scopes.end());
+ for (const url::Origin& url : origins) {
+ if (url.unique()) {
+ DVLOG(1) << "Received unexpected unique origin from renderer process.";
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&KillEmbeddedWorkerProcess, embedded_worker_->process_id(),
+ RESULT_CODE_KILLED_BAD_MESSAGE));
+ return;
+ }
+ }
+ set_foreign_fetch_scopes(sub_scopes);
+ set_foreign_fetch_origins(origins);
}
void ServiceWorkerVersion::DidEnsureLiveRegistrationForStartWorker(

Powered by Google App Engine
This is Rietveld 408576698