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

Side by Side Diff: Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 1228233007: Shows error messages in the inspector when .respondWith() is called with wrong responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated falken's comment Created 5 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 | « Source/modules/serviceworkers/RespondWithObserver.cpp ('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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 { 91 {
92 ASSERT(m_workerGlobalScope); 92 ASSERT(m_workerGlobalScope);
93 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::Activate, eventID); 93 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::Activate, eventID);
94 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti vate, ExtendableEventInit(), observer)); 94 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti vate, ExtendableEventInit(), observer));
95 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); 95 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer);
96 } 96 }
97 97
98 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest) 98 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest)
99 { 99 {
100 ASSERT(m_workerGlobalScope); 100 ASSERT(m_workerGlobalScope);
101 RespondWithObserver* observer = RespondWithObserver::create(m_workerGlobalSc ope, eventID, webRequest.mode(), webRequest.frameType()); 101 RespondWithObserver* observer = RespondWithObserver::create(m_workerGlobalSc ope, eventID, webRequest.url(), webRequest.mode(), webRequest.frameType());
102 bool defaultPrevented = false; 102 bool defaultPrevented = false;
103 Request* request = Request::create(m_workerGlobalScope, webRequest); 103 Request* request = Request::create(m_workerGlobalScope, webRequest);
104 request->headers()->setGuard(Headers::ImmutableGuard); 104 request->headers()->setGuard(Headers::ImmutableGuard);
105 FetchEventInit eventInit; 105 FetchEventInit eventInit;
106 eventInit.setCancelable(true); 106 eventInit.setCancelable(true);
107 eventInit.setRequest(request); 107 eventInit.setRequest(request);
108 eventInit.setIsReload(webRequest.isReload()); 108 eventInit.setIsReload(webRequest.isReload());
109 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer)); 109 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer));
110 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ; 110 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ;
111 observer->didDispatchEvent(defaultPrevented); 111 observer->didDispatchEvent(defaultPrevented);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) 261 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client)
262 : m_embeddedWorker(embeddedWorker) 262 : m_embeddedWorker(embeddedWorker)
263 , m_document(document) 263 , m_document(document)
264 , m_client(client) 264 , m_client(client)
265 , m_workerGlobalScope(0) 265 , m_workerGlobalScope(0)
266 { 266 {
267 } 267 }
268 268
269 } // namespace blink 269 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/RespondWithObserver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698