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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 2056183002: Implement the `require-sri-for` CSP directive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated tests Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/workers/SharedWorker.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 242 }
243 243
244 WebString webErrorMessage; 244 WebString webErrorMessage;
245 if (!m_provider->validateScopeAndScriptURL(patternURL, scriptURL, &webErrorM essage)) { 245 if (!m_provider->validateScopeAndScriptURL(patternURL, scriptURL, &webErrorM essage)) {
246 callbacks->onError(WebServiceWorkerError(WebServiceWorkerError::ErrorTyp eType, WebString::fromUTF8("Failed to register a ServiceWorker: " + webErrorMess age.utf8()))); 246 callbacks->onError(WebServiceWorkerError(WebServiceWorkerError::ErrorTyp eType, WebString::fromUTF8("Failed to register a ServiceWorker: " + webErrorMess age.utf8())));
247 return; 247 return;
248 } 248 }
249 249
250 ContentSecurityPolicy* csp = executionContext->contentSecurityPolicy(); 250 ContentSecurityPolicy* csp = executionContext->contentSecurityPolicy();
251 if (csp) { 251 if (csp) {
252 if (!csp->allowWorkerContextFromSource(scriptURL, ResourceRequest::Redir ectStatus::NoRedirect, ContentSecurityPolicy::SendReport)) { 252 if (!(csp->allowRequestWithoutIntegrity(WebURLRequest::RequestContextSer viceWorker, scriptURL) && csp->allowWorkerContextFromSource(scriptURL, ResourceR equest::RedirectStatus::NoRedirect, ContentSecurityPolicy::SendReport))) {
253 callbacks->onError(WebServiceWorkerError(WebServiceWorkerError::Erro rTypeSecurity, String("Failed to register a ServiceWorker: The provided scriptUR L ('" + scriptURL.getString() + "') violates the Content Security Policy."))); 253 callbacks->onError(WebServiceWorkerError(WebServiceWorkerError::Erro rTypeSecurity, String("Failed to register a ServiceWorker: The provided scriptUR L ('" + scriptURL.getString() + "') violates the Content Security Policy.")));
254 return; 254 return;
255 } 255 }
256 } 256 }
257 257
258 m_provider->registerServiceWorker(patternURL, scriptURL, callbacks.leakPtr() ); 258 m_provider->registerServiceWorker(patternURL, scriptURL, callbacks.leakPtr() );
259 } 259 }
260 260
261 ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS tate, const String& url, const RegistrationOptions& options) 261 ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS tate, const String& url, const RegistrationOptions& options)
262 { 262 {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return; 417 return;
418 418
419 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) { 419 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) {
420 m_provider = client->provider(); 420 m_provider = client->provider();
421 if (m_provider) 421 if (m_provider)
422 m_provider->setClient(this); 422 m_provider->setClient(this);
423 } 423 }
424 } 424 }
425 425
426 } // namespace blink 426 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/workers/SharedWorker.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698