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

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

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: fix tests Created 3 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 5 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 NavigationPreloadManager* ServiceWorkerRegistration::navigationPreload() { 81 NavigationPreloadManager* ServiceWorkerRegistration::navigationPreload() {
82 if (!m_navigationPreload) 82 if (!m_navigationPreload)
83 m_navigationPreload = NavigationPreloadManager::create(this); 83 m_navigationPreload = NavigationPreloadManager::create(this);
84 return m_navigationPreload; 84 return m_navigationPreload;
85 } 85 }
86 86
87 String ServiceWorkerRegistration::scope() const { 87 String ServiceWorkerRegistration::scope() const {
88 return m_handle->registration()->scope().string(); 88 return m_handle->registration()->scope().string();
89 } 89 }
90 90
91 bool ServiceWorkerRegistration::useCache() const {
92 return m_handle->registration()->useCache();
93 }
94
91 ScriptPromise ServiceWorkerRegistration::update(ScriptState* scriptState) { 95 ScriptPromise ServiceWorkerRegistration::update(ScriptState* scriptState) {
92 ServiceWorkerContainerClient* client = 96 ServiceWorkerContainerClient* client =
93 ServiceWorkerContainerClient::from(getExecutionContext()); 97 ServiceWorkerContainerClient::from(getExecutionContext());
94 if (!client || !client->provider()) 98 if (!client || !client->provider())
95 return ScriptPromise::rejectWithDOMException( 99 return ScriptPromise::rejectWithDOMException(
96 scriptState, 100 scriptState,
97 DOMException::create(InvalidStateError, 101 DOMException::create(InvalidStateError,
98 "Failed to update a ServiceWorkerRegistration: No " 102 "Failed to update a ServiceWorkerRegistration: No "
99 "associated provider is available.")); 103 "associated provider is available."));
100 104
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 163 }
160 164
161 void ServiceWorkerRegistration::contextDestroyed(ExecutionContext*) { 165 void ServiceWorkerRegistration::contextDestroyed(ExecutionContext*) {
162 if (m_stopped) 166 if (m_stopped)
163 return; 167 return;
164 m_stopped = true; 168 m_stopped = true;
165 m_handle->registration()->proxyStopped(); 169 m_handle->registration()->proxyStopped();
166 } 170 }
167 171
168 } // namespace blink 172 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698