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

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

Issue 466723002: ServiceWorker: Enable ServiceWorkerRegistration and update layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@updatefound
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return promise; 112 return promise;
113 } 113 }
114 114
115 KURL scriptURL = executionContext->completeURL(url); 115 KURL scriptURL = executionContext->completeURL(url);
116 scriptURL.removeFragmentIdentifier(); 116 scriptURL.removeFragmentIdentifier();
117 if (!documentOrigin->canRequest(scriptURL)) { 117 if (!documentOrigin->canRequest(scriptURL)) {
118 resolver->reject(DOMException::create(SecurityError, "The origin of the script must match the current origin.")); 118 resolver->reject(DOMException::create(SecurityError, "The origin of the script must match the current origin."));
119 return promise; 119 return promise;
120 } 120 }
121 121
122 #ifdef DISABLE_SERVICE_WORKER_REGISTRATION
123 m_provider->registerServiceWorker(patternURL, scriptURL, new CallbackPromise Adapter<ServiceWorker, ServiceWorkerError>(resolver));
124 #else
125 m_provider->registerServiceWorker(patternURL, scriptURL, new CallbackPromise Adapter<ServiceWorkerRegistration, ServiceWorkerError>(resolver)); 122 m_provider->registerServiceWorker(patternURL, scriptURL, new CallbackPromise Adapter<ServiceWorkerRegistration, ServiceWorkerError>(resolver));
126 #endif
127 123
128 return promise; 124 return promise;
129 } 125 }
130 126
131 class UndefinedValue { 127 class UndefinedValue {
132 public: 128 public:
133 #ifdef DISABLE_SERVICE_WORKER_REGISTRATION
134 typedef WebServiceWorker WebType;
135 #else
136 typedef WebServiceWorkerRegistration WebType; 129 typedef WebServiceWorkerRegistration WebType;
137 #endif
138 static V8UndefinedType take(ScriptPromiseResolver* resolver, WebType* regist ration) 130 static V8UndefinedType take(ScriptPromiseResolver* resolver, WebType* regist ration)
139 { 131 {
140 ASSERT(!registration); // Anything passed here will be leaked. 132 ASSERT(!registration); // Anything passed here will be leaked.
141 return V8UndefinedType(); 133 return V8UndefinedType();
142 } 134 }
143 static void dispose(WebType* registration) 135 static void dispose(WebType* registration)
144 { 136 {
145 ASSERT(!registration); // Anything passed here will be leaked. 137 ASSERT(!registration); // Anything passed here will be leaked.
146 } 138 }
147 139
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 m_ready = createReadyProperty(); 277 m_ready = createReadyProperty();
286 278
287 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) { 279 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) {
288 m_provider = client->provider(); 280 m_provider = client->provider();
289 if (m_provider) 281 if (m_provider)
290 m_provider->setClient(this); 282 m_provider->setClient(this);
291 } 283 }
292 } 284 }
293 285
294 } // namespace blink 286 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/waiting.html ('k') | Source/modules/serviceworkers/ServiceWorkerRegistration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698