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

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: Created 4 years, 6 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 if (error.errorType == WebServiceWorkerError::ErrorTypeType) { 79 switch (error.errorType) {
80 m_resolver->reject(V8ThrowException::createTypeError(m_resolver->get ScriptState()->isolate(), error.message)); 80 case WebServiceWorkerError::ErrorTypeNetwork:
81 } else { 81 case WebServiceWorkerError::ErrorTypeScriptEvaluateFailed:
82 case WebServiceWorkerError::ErrorTypeType: {
83 ScriptState* scriptState = m_resolver->getScriptState();
84 ScriptState::Scope scope(scriptState);
85 m_resolver->reject(V8ThrowException::createTypeError(scriptState->is olate(), error.message));
86 break;
falken 2016/06/14 02:29:18 Why are these types the ones in the switch? This
e_hakkinen 2016/07/08 12:21:13 Done.
87 }
88 default:
82 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error) ); 89 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error) );
83 } 90 }
84 } 91 }
85 92
86 private: 93 private:
87 Persistent<ScriptPromiseResolver> m_resolver; 94 Persistent<ScriptPromiseResolver> m_resolver;
88 WTF_MAKE_NONCOPYABLE(RegistrationCallback); 95 WTF_MAKE_NONCOPYABLE(RegistrationCallback);
89 }; 96 };
90 97
91 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke rGetRegistrationCallbacks { 98 class GetRegistrationCallback : public WebServiceWorkerProvider::WebServiceWorke rGetRegistrationCallbacks {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return; 424 return;
418 425
419 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) { 426 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) {
420 m_provider = client->provider(); 427 m_provider = client->provider();
421 if (m_provider) 428 if (m_provider)
422 m_provider->setClient(this); 429 m_provider->setClient(this);
423 } 430 }
424 } 431 }
425 432
426 } // namespace blink 433 } // 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