| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (!m_provider) { | 221 if (!m_provider) { |
| 222 callbacks->onError( | 222 callbacks->onError( |
| 223 WebServiceWorkerError(WebServiceWorkerError::ErrorTypeState, | 223 WebServiceWorkerError(WebServiceWorkerError::ErrorTypeState, |
| 224 "Failed to register a ServiceWorker: The " | 224 "Failed to register a ServiceWorker: The " |
| 225 "document is in an invalid state.")); | 225 "document is in an invalid state.")); |
| 226 return; | 226 return; |
| 227 } | 227 } |
| 228 | 228 |
| 229 RefPtr<SecurityOrigin> documentOrigin = executionContext->getSecurityOrigin(); | 229 RefPtr<SecurityOrigin> documentOrigin = executionContext->getSecurityOrigin(); |
| 230 String errorMessage; | 230 String errorMessage; |
| 231 // Restrict to secure origins: https://w3c.github.io/webappsec/specs/powerfulf
eatures/#settings-privileged | 231 // Restrict to secure origins: |
| 232 // https://w3c.github.io/webappsec/specs/powerfulfeatures/#settings-privileged |
| 232 if (!executionContext->isSecureContext(errorMessage)) { | 233 if (!executionContext->isSecureContext(errorMessage)) { |
| 233 callbacks->onError(WebServiceWorkerError( | 234 callbacks->onError(WebServiceWorkerError( |
| 234 WebServiceWorkerError::ErrorTypeSecurity, errorMessage)); | 235 WebServiceWorkerError::ErrorTypeSecurity, errorMessage)); |
| 235 return; | 236 return; |
| 236 } | 237 } |
| 237 | 238 |
| 238 KURL pageURL = KURL(KURL(), documentOrigin->toString()); | 239 KURL pageURL = KURL(KURL(), documentOrigin->toString()); |
| 239 if (!SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers( | 240 if (!SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers( |
| 240 pageURL.protocol())) { | 241 pageURL.protocol())) { |
| 241 callbacks->onError(WebServiceWorkerError( | 242 callbacks->onError(WebServiceWorkerError( |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 527 |
| 527 if (ServiceWorkerContainerClient* client = | 528 if (ServiceWorkerContainerClient* client = |
| 528 ServiceWorkerContainerClient::from(executionContext)) { | 529 ServiceWorkerContainerClient::from(executionContext)) { |
| 529 m_provider = client->provider(); | 530 m_provider = client->provider(); |
| 530 if (m_provider) | 531 if (m_provider) |
| 531 m_provider->setClient(this); | 532 m_provider->setClient(this); |
| 532 } | 533 } |
| 533 } | 534 } |
| 534 | 535 |
| 535 } // namespace blink | 536 } // namespace blink |
| OLD | NEW |