OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void ServiceWorkerGlobalScopeClientImpl::didHandleActivateEvent(int eventID, Web
ServiceWorkerEventResult result) | 67 void ServiceWorkerGlobalScopeClientImpl::didHandleActivateEvent(int eventID, Web
ServiceWorkerEventResult result) |
68 { | 68 { |
69 m_client.didHandleActivateEvent(eventID, result); | 69 m_client.didHandleActivateEvent(eventID, result); |
70 } | 70 } |
71 | 71 |
72 void ServiceWorkerGlobalScopeClientImpl::didHandleInstallEvent(int installEventI
D, WebServiceWorkerEventResult result) | 72 void ServiceWorkerGlobalScopeClientImpl::didHandleInstallEvent(int installEventI
D, WebServiceWorkerEventResult result) |
73 { | 73 { |
74 m_client.didHandleInstallEvent(installEventID, result); | 74 m_client.didHandleInstallEvent(installEventID, result); |
75 } | 75 } |
76 | 76 |
77 void ServiceWorkerGlobalScopeClientImpl::didHandleFetchEvent(int fetchEventID) | 77 void ServiceWorkerGlobalScopeClientImpl::didHandleFetchEvent(int fetchEventID, R
esponse* response) |
78 { | 78 { |
79 m_client.didHandleFetchEvent(fetchEventID); | 79 if (!response) { |
80 } | 80 m_client.didHandleFetchEvent(fetchEventID); |
| 81 return; |
| 82 } |
81 | 83 |
82 void ServiceWorkerGlobalScopeClientImpl::didHandleFetchEvent(int fetchEventID, c
onst WebServiceWorkerResponse& webResponse) | 84 WebServiceWorkerResponse webResponse; |
83 { | 85 response->populateWebServiceWorkerResponse(webResponse); |
| 86 if (webResponse.status() == 0) { |
| 87 // The status code is 0 means a network error. |
| 88 m_client.didHandleFetchEvent(fetchEventID); |
| 89 return; |
| 90 } |
84 m_client.didHandleFetchEvent(fetchEventID, webResponse); | 91 m_client.didHandleFetchEvent(fetchEventID, webResponse); |
85 } | 92 } |
86 | 93 |
87 void ServiceWorkerGlobalScopeClientImpl::didHandleSyncEvent(int syncEventID) | 94 void ServiceWorkerGlobalScopeClientImpl::didHandleSyncEvent(int syncEventID) |
88 { | 95 { |
89 m_client.didHandleSyncEvent(syncEventID); | 96 m_client.didHandleSyncEvent(syncEventID); |
90 } | 97 } |
91 | 98 |
92 void ServiceWorkerGlobalScopeClientImpl::postMessageToClient(int clientID, const
WebString& message, PassOwnPtr<WebMessagePortChannelArray> webChannels) | 99 void ServiceWorkerGlobalScopeClientImpl::postMessageToClient(int clientID, const
WebString& message, PassOwnPtr<WebMessagePortChannelArray> webChannels) |
93 { | 100 { |
94 m_client.postMessageToClient(clientID, message, webChannels.leakPtr()); | 101 m_client.postMessageToClient(clientID, message, webChannels.leakPtr()); |
95 } | 102 } |
96 | 103 |
97 ServiceWorkerGlobalScopeClientImpl::ServiceWorkerGlobalScopeClientImpl(WebServic
eWorkerContextClient& client) | 104 ServiceWorkerGlobalScopeClientImpl::ServiceWorkerGlobalScopeClientImpl(WebServic
eWorkerContextClient& client) |
98 : m_client(client) | 105 : m_client(client) |
99 { | 106 { |
100 } | 107 } |
101 | 108 |
102 } // namespace blink | 109 } // namespace blink |
OLD | NEW |