| 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 cef7249574c080c9b2cee34159188ac7604c637a..0ee665fa3b697f31525a8685b9879bd3afce2c4a 100644
|
| --- a/content/browser/service_worker/service_worker_version.cc
|
| +++ b/content/browser/service_worker/service_worker_version.cc
|
| @@ -1262,6 +1262,8 @@ bool ServiceWorkerVersion::OnMessageReceived(const IPC::Message& message) {
|
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ClaimClients,
|
| OnClaimClients)
|
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_Pong, OnPongFromWorker)
|
| + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_RegisterForeignFetchScopes,
|
| + OnRegisterForeignFetchScopes)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
| return handled;
|
| @@ -1864,6 +1866,29 @@ void ServiceWorkerVersion::OnPongFromWorker() {
|
| ping_controller_->OnPongReceived();
|
| }
|
|
|
| +void ServiceWorkerVersion::OnRegisterForeignFetchScopes(
|
| + const std::vector<GURL>& sub_scopes) {
|
| + 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.
|
| + GURL origin = scope_.GetOrigin();
|
| + std::string scope_path = scope_.path();
|
| + for (const GURL& url : sub_scopes) {
|
| + if (!url.is_valid() || url.GetOrigin() != origin ||
|
| + !base::StartsWith(url.path(), scope_path,
|
| + base::CompareCase::SENSITIVE)) {
|
| + DVLOG(1) << "Received unexpected invalid URL from renderer process.";
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI, FROM_HERE,
|
| + base::Bind(&KillEmbeddedWorkerProcess, embedded_worker_->process_id(),
|
| + RESULT_CODE_KILLED_BAD_MESSAGE));
|
| + return;
|
| + }
|
| + }
|
| + foreign_fetch_scopes_.insert(foreign_fetch_scopes_.end(), sub_scopes.begin(),
|
| + sub_scopes.end());
|
| +}
|
| +
|
| void ServiceWorkerVersion::DidEnsureLiveRegistrationForStartWorker(
|
| const StatusCallback& callback,
|
| ServiceWorkerStatusCode status,
|
|
|