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

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

Issue 2059953003: service worker: Fix the type of a register promise reject value (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Error handling unification Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/registration-tests.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 { 69 {
70 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped()) 70 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped())
71 return; 71 return;
72 m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->g etExecutionContext(), adoptPtr(handle.release()))); 72 m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->g etExecutionContext(), adoptPtr(handle.release())));
73 } 73 }
74 74
75 void onError(const WebServiceWorkerError& error) override 75 void onError(const WebServiceWorkerError& error) override
76 { 76 {
77 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped()) 77 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped())
78 return; 78 return;
79 ScriptState::Scope scope(m_resolver->getScriptState());
79 if (error.errorType == WebServiceWorkerError::ErrorTypeType) { 80 if (error.errorType == WebServiceWorkerError::ErrorTypeType) {
80 m_resolver->reject(V8ThrowException::createTypeError(m_resolver->get ScriptState()->isolate(), error.message)); 81 m_resolver->reject(V8ThrowException::createTypeError(m_resolver->get ScriptState()->isolate(), error.message));
81 } else { 82 } else {
82 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error) ); 83 using ServiceWorkerErrorForRegister = ServiceWorkerErrorForUpdate;
84 m_resolver->reject(ServiceWorkerErrorForRegister::take(m_resolver.ge t(), error));
falken 2016/07/08 12:39:46 optional nit: mm.. I'd just save a line of code an
e_hakkinen 2016/07/08 12:48:51 Done.
83 } 85 }
84 } 86 }
85 87
86 private: 88 private:
87 Persistent<ScriptPromiseResolver> m_resolver; 89 Persistent<ScriptPromiseResolver> m_resolver;
88 WTF_MAKE_NONCOPYABLE(RegistrationCallback); 90 WTF_MAKE_NONCOPYABLE(RegistrationCallback);
89 }; 91 };
90 92
91 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke rGetRegistrationCallbacks { 93 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke rGetRegistrationCallbacks {
92 public: 94 public:
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return; 419 return;
418 420
419 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) { 421 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) {
420 m_provider = client->provider(); 422 m_provider = client->provider();
421 if (m_provider) 423 if (m_provider)
422 m_provider->setClient(this); 424 m_provider->setClient(this);
423 } 425 }
424 } 426 }
425 427
426 } // namespace blink 428 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/registration-tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698