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 15 matching lines...) Expand all Loading... | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 #include "config.h" | 30 #include "config.h" |
31 #include "ServiceWorkerGlobalScope.h" | 31 #include "ServiceWorkerGlobalScope.h" |
32 | 32 |
33 #include "bindings/core/v8/ScriptPromise.h" | 33 #include "bindings/core/v8/ScriptPromise.h" |
34 #include "bindings/core/v8/ScriptState.h" | 34 #include "bindings/core/v8/ScriptState.h" |
35 #include "bindings/core/v8/V8ThrowException.h" | 35 #include "bindings/core/v8/V8ThrowException.h" |
36 #include "core/fetch/MemoryCache.h" | |
36 #include "core/fetch/ResourceLoaderOptions.h" | 37 #include "core/fetch/ResourceLoaderOptions.h" |
37 #include "core/inspector/ScriptCallStack.h" | 38 #include "core/inspector/ScriptCallStack.h" |
38 #include "core/loader/ThreadableLoader.h" | 39 #include "core/loader/ThreadableLoader.h" |
39 #include "core/workers/WorkerClients.h" | 40 #include "core/workers/WorkerClients.h" |
40 #include "core/workers/WorkerThreadStartupData.h" | 41 #include "core/workers/WorkerThreadStartupData.h" |
41 #include "modules/CachePolyfill.h" | 42 #include "modules/CachePolyfill.h" |
42 #include "modules/CacheStoragePolyfill.h" | 43 #include "modules/CacheStoragePolyfill.h" |
43 #include "modules/EventTargetModules.h" | 44 #include "modules/EventTargetModules.h" |
44 #include "modules/serviceworkers/CacheStorage.h" | 45 #include "modules/serviceworkers/CacheStorage.h" |
45 #include "modules/serviceworkers/FetchManager.h" | 46 #include "modules/serviceworkers/FetchManager.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 return EventTargetNames::ServiceWorkerGlobalScope; | 171 return EventTargetNames::ServiceWorkerGlobalScope; |
171 } | 172 } |
172 | 173 |
173 void ServiceWorkerGlobalScope::trace(Visitor* visitor) | 174 void ServiceWorkerGlobalScope::trace(Visitor* visitor) |
174 { | 175 { |
175 visitor->trace(m_clients); | 176 visitor->trace(m_clients); |
176 visitor->trace(m_caches); | 177 visitor->trace(m_caches); |
177 WorkerGlobalScope::trace(visitor); | 178 WorkerGlobalScope::trace(visitor); |
178 } | 179 } |
179 | 180 |
181 void ServiceWorkerGlobalScope::importScripts(const Vector<String>& urls, Excepti onState& exceptionState) | |
182 { | |
183 // Bust the MemoryCache to ensure script requests reach the browser-side | |
184 // and get added to and retrieved from the ServiceWorker's script cache. | |
dominicc (has gone to gerrit)
2014/08/08 05:27:57
I think the "and retrieved from" is a bit inaccura
michaeln
2014/08/08 19:51:42
i think it's accurate, maybe less obvious. once th
| |
185 // FIXME: Revisit in light of the solution to crbug/388375. | |
dominicc (has gone to gerrit)
2014/08/08 05:27:57
I don't think you need this FIXME; I think CR38837
michaeln
2014/08/08 19:51:42
I don't want to leave the impression that this is
| |
186 for (Vector<String>::const_iterator it = urls.begin(); it != urls.end(); ++i t) | |
187 MemoryCache::removeURLFromCache(this->executionContext(), completeURL(*i t)); | |
188 WorkerGlobalScope::importScripts(urls, exceptionState); | |
189 } | |
190 | |
180 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack> callStack) | 191 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack> callStack) |
181 { | 192 { |
182 WorkerGlobalScope::logExceptionToConsole(errorMessage, sourceURL, lineNumber , columnNumber, callStack); | 193 WorkerGlobalScope::logExceptionToConsole(errorMessage, sourceURL, lineNumber , columnNumber, callStack); |
183 addMessageToWorkerConsole(JSMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber, callStack, 0); | 194 addMessageToWorkerConsole(JSMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber, callStack, 0); |
184 } | 195 } |
185 | 196 |
186 } // namespace blink | 197 } // namespace blink |
OLD | NEW |