OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |