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

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 396963002: ServiceWorker: Bypass resolving a promise when ExecutionContext is gone (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 4 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 /* 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 m_provider->registerServiceWorker(patternURL, scriptURL, new CallbackPromise Adapter<ServiceWorker, ServiceWorkerError>(resolver)); 123 m_provider->registerServiceWorker(patternURL, scriptURL, new CallbackPromise Adapter<ServiceWorker, ServiceWorkerError>(resolver));
124 #else 124 #else
125 m_provider->registerServiceWorker(patternURL, scriptURL, new CallbackPromise Adapter<ServiceWorkerRegistration, ServiceWorkerError>(resolver)); 125 m_provider->registerServiceWorker(patternURL, scriptURL, new CallbackPromise Adapter<ServiceWorkerRegistration, ServiceWorkerError>(resolver));
126 #endif 126 #endif
127 127
128 return promise; 128 return promise;
129 } 129 }
130 130
131 class UndefinedValue { 131 class UndefinedValue {
132 public: 132 public:
133
134 #ifdef DISABLE_SERVICE_WORKER_REGISTRATION 133 #ifdef DISABLE_SERVICE_WORKER_REGISTRATION
135 typedef WebServiceWorker WebType; 134 typedef WebServiceWorker WebType;
136 #else 135 #else
137 typedef WebServiceWorkerRegistration WebType; 136 typedef WebServiceWorkerRegistration WebType;
138 #endif 137 #endif
139 static V8UndefinedType from(ScriptPromiseResolver* resolver, WebType* regist ration) 138 static V8UndefinedType from(ScriptPromiseResolver* resolver, WebType* regist ration)
140 { 139 {
141 ASSERT(!registration); // Anything passed here will be leaked. 140 ASSERT(!registration); // Anything passed here will be leaked.
142 return V8UndefinedType(); 141 return V8UndefinedType();
143 } 142 }
143 static void dispose(WebServiceWorker* worker)
144 {
145 ASSERT(!worker); // Anything passed here will be leaked.
146 }
144 147
145 private: 148 private:
146 UndefinedValue(); 149 UndefinedValue();
147 }; 150 };
148 151
149 ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ScriptState* scrip tState, const String& pattern) 152 ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ScriptState* scrip tState, const String& pattern)
150 { 153 {
151 ASSERT(RuntimeEnabledFeatures::serviceWorkerEnabled()); 154 ASSERT(RuntimeEnabledFeatures::serviceWorkerEnabled());
152 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); 155 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState);
153 ScriptPromise promise = resolver->promise(); 156 ScriptPromise promise = resolver->promise();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 m_ready = createReadyProperty(); 285 m_ready = createReadyProperty();
283 286
284 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) { 287 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) {
285 m_provider = client->provider(); 288 m_provider = client->provider();
286 if (m_provider) 289 if (m_provider)
287 m_provider->setClient(this); 290 m_provider->setClient(this);
288 } 291 }
289 } 292 }
290 293
291 } // namespace blink 294 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerClients.cpp ('k') | Source/modules/serviceworkers/ServiceWorkerError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698