Index: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
index f939ee94ae507ebdaafc64006a602c64aa8c53ef..48ff93548f4211af36c9549c15089586b2a21845 100644 |
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
@@ -66,6 +66,18 @@ |
namespace blink { |
+namespace { |
+ |
+WebServiceWorkerUpdateViaCache ParseUpdateViaCache(const String& value) { |
nhiroki
2017/08/04 09:24:50
Can you sync this implementation with ParseUpdateV
yuryu
2017/08/17 07:36:35
Done.
|
+ if (value == "all") |
+ return WebServiceWorkerUpdateViaCache::kAll; |
+ if (value == "none") |
+ return WebServiceWorkerUpdateViaCache::kNone; |
+ return WebServiceWorkerUpdateViaCache::kImports; |
+} |
+ |
+} // namespace |
+ |
class GetRegistrationCallback : public WebServiceWorkerProvider:: |
WebServiceWorkerGetRegistrationCallbacks { |
public: |
@@ -156,6 +168,7 @@ void ServiceWorkerContainer::RegisterServiceWorkerImpl( |
ExecutionContext* execution_context, |
const KURL& raw_script_url, |
const KURL& scope, |
+ WebServiceWorkerUpdateViaCache update_via_cache, |
std::unique_ptr<RegistrationCallbacks> callbacks) { |
if (!provider_) { |
callbacks->OnError( |
@@ -261,7 +274,7 @@ void ServiceWorkerContainer::RegisterServiceWorkerImpl( |
} |
} |
- provider_->RegisterServiceWorker(pattern_url, script_url, |
+ provider_->RegisterServiceWorker(pattern_url, script_url, update_via_cache, |
std::move(callbacks)); |
} |
@@ -294,8 +307,11 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker( |
else |
pattern_url = execution_context->CompleteURL(options.scope()); |
+ WebServiceWorkerUpdateViaCache update_via_cache = |
+ ParseUpdateViaCache(options.updateViaCache()); |
+ |
RegisterServiceWorkerImpl( |
- execution_context, script_url, pattern_url, |
+ execution_context, script_url, pattern_url, update_via_cache, |
WTF::MakeUnique<CallbackPromiseAdapter<ServiceWorkerRegistration, |
ServiceWorkerErrorForUpdate>>( |
resolver)); |