| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 callbacks->onError(WebServiceWorkerError( | 301 callbacks->onError(WebServiceWorkerError( |
| 302 WebServiceWorkerError::ErrorTypeType, | 302 WebServiceWorkerError::ErrorTypeType, |
| 303 WebString::fromUTF8("Failed to register a ServiceWorker: " + | 303 WebString::fromUTF8("Failed to register a ServiceWorker: " + |
| 304 webErrorMessage.utf8()))); | 304 webErrorMessage.utf8()))); |
| 305 return; | 305 return; |
| 306 } | 306 } |
| 307 | 307 |
| 308 ContentSecurityPolicy* csp = executionContext->contentSecurityPolicy(); | 308 ContentSecurityPolicy* csp = executionContext->contentSecurityPolicy(); |
| 309 if (csp) { | 309 if (csp) { |
| 310 if (!(csp->allowRequestWithoutIntegrity( | 310 if (!(csp->allowRequestWithoutIntegrity( |
| 311 WebURLRequest::RequestContextServiceWorker, scriptURL) && | 311 WebURLRequest::RequestContextServiceWorker, scriptURL, |
| 312 ResourceRequest::RedirectStatus::NoRedirect, |
| 313 ContentSecurityPolicy::SendReport, |
| 314 ContentSecurityPolicyHeaderTypeEnforce) && |
| 312 csp->allowWorkerContextFromSource( | 315 csp->allowWorkerContextFromSource( |
| 313 scriptURL, ResourceRequest::RedirectStatus::NoRedirect, | 316 scriptURL, ResourceRequest::RedirectStatus::NoRedirect, |
| 314 ContentSecurityPolicy::SendReport))) { | 317 ContentSecurityPolicy::SendReport, |
| 318 ContentSecurityPolicyHeaderTypeEnforce))) { |
| 315 callbacks->onError(WebServiceWorkerError( | 319 callbacks->onError(WebServiceWorkerError( |
| 316 WebServiceWorkerError::ErrorTypeSecurity, | 320 WebServiceWorkerError::ErrorTypeSecurity, |
| 317 String( | 321 String( |
| 318 "Failed to register a ServiceWorker: The provided scriptURL ('" + | 322 "Failed to register a ServiceWorker: The provided scriptURL ('" + |
| 319 scriptURL.getString() + | 323 scriptURL.getString() + |
| 320 "') violates the Content Security Policy."))); | 324 "') violates the Content Security Policy."))); |
| 321 return; | 325 return; |
| 322 } | 326 } |
| 323 } | 327 } |
| 324 | 328 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 535 |
| 532 if (ServiceWorkerContainerClient* client = | 536 if (ServiceWorkerContainerClient* client = |
| 533 ServiceWorkerContainerClient::from(executionContext)) { | 537 ServiceWorkerContainerClient::from(executionContext)) { |
| 534 m_provider = client->provider(); | 538 m_provider = client->provider(); |
| 535 if (m_provider) | 539 if (m_provider) |
| 536 m_provider->setClient(this); | 540 m_provider->setClient(this); |
| 537 } | 541 } |
| 538 } | 542 } |
| 539 | 543 |
| 540 } // namespace blink | 544 } // namespace blink |
| OLD | NEW |