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

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

Issue 723963003: [ServiceWorker] Set FetchEvent's request's headers' guard to immutable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 1 month 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 | « LayoutTests/http/tests/serviceworker/resources/request-end-to-end-worker.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 27 matching lines...) Expand all
38 #include "core/dom/MessagePort.h" 38 #include "core/dom/MessagePort.h"
39 #include "core/events/MessageEvent.h" 39 #include "core/events/MessageEvent.h"
40 #include "core/inspector/ConsoleMessage.h" 40 #include "core/inspector/ConsoleMessage.h"
41 #include "core/workers/WorkerGlobalScope.h" 41 #include "core/workers/WorkerGlobalScope.h"
42 #include "modules/geofencing/CircularGeofencingRegion.h" 42 #include "modules/geofencing/CircularGeofencingRegion.h"
43 #include "modules/geofencing/GeofencingEvent.h" 43 #include "modules/geofencing/GeofencingEvent.h"
44 #include "modules/notifications/NotificationEvent.h" 44 #include "modules/notifications/NotificationEvent.h"
45 #include "modules/push_messaging/PushEvent.h" 45 #include "modules/push_messaging/PushEvent.h"
46 #include "modules/serviceworkers/ExtendableEvent.h" 46 #include "modules/serviceworkers/ExtendableEvent.h"
47 #include "modules/serviceworkers/FetchEvent.h" 47 #include "modules/serviceworkers/FetchEvent.h"
48 #include "modules/serviceworkers/Headers.h"
48 #include "modules/serviceworkers/InstallEvent.h" 49 #include "modules/serviceworkers/InstallEvent.h"
49 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" 50 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
50 #include "modules/serviceworkers/WaitUntilObserver.h" 51 #include "modules/serviceworkers/WaitUntilObserver.h"
51 #include "platform/RuntimeEnabledFeatures.h" 52 #include "platform/RuntimeEnabledFeatures.h"
52 #include "public/platform/WebNotificationData.h" 53 #include "public/platform/WebNotificationData.h"
53 #include "public/platform/WebServiceWorkerEventResult.h" 54 #include "public/platform/WebServiceWorkerEventResult.h"
54 #include "public/platform/WebServiceWorkerRequest.h" 55 #include "public/platform/WebServiceWorkerRequest.h"
55 #include "public/web/WebSerializedScriptValue.h" 56 #include "public/web/WebSerializedScriptValue.h"
56 #include "public/web/WebServiceWorkerContextClient.h" 57 #include "public/web/WebServiceWorkerContextClient.h"
57 #include "web/WebEmbeddedWorkerImpl.h" 58 #include "web/WebEmbeddedWorkerImpl.h"
(...skipping 22 matching lines...) Expand all
80 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest) 81 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest)
81 { 82 {
82 ASSERT(m_workerGlobalScope); 83 ASSERT(m_workerGlobalScope);
83 RespondWithObserver* observer = RespondWithObserver::create(m_workerGlobalSc ope, eventID, webRequest.mode(), webRequest.frameType()); 84 RespondWithObserver* observer = RespondWithObserver::create(m_workerGlobalSc ope, eventID, webRequest.mode(), webRequest.frameType());
84 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { 85 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) {
85 observer->didDispatchEvent(); 86 observer->didDispatchEvent();
86 return; 87 return;
87 } 88 }
88 89
89 Request* request = Request::create(m_workerGlobalScope, webRequest); 90 Request* request = Request::create(m_workerGlobalScope, webRequest);
91 request->headers()->setGuard(Headers::ImmutableGuard);
90 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(observer, reque st)); 92 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(observer, reque st));
91 fetchEvent->setIsReload(webRequest.isReload()); 93 fetchEvent->setIsReload(webRequest.isReload());
92 m_workerGlobalScope->dispatchEvent(fetchEvent.release()); 94 m_workerGlobalScope->dispatchEvent(fetchEvent.release());
93 observer->didDispatchEvent(); 95 observer->didDispatchEvent();
94 } 96 }
95 97
96 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region) 98 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region)
97 { 99 {
98 ASSERT(m_workerGlobalScope); 100 ASSERT(m_workerGlobalScope);
99 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave; 101 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 200
199 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) 201 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client)
200 : m_embeddedWorker(embeddedWorker) 202 : m_embeddedWorker(embeddedWorker)
201 , m_document(document) 203 , m_document(document)
202 , m_client(client) 204 , m_client(client)
203 , m_workerGlobalScope(0) 205 , m_workerGlobalScope(0)
204 { 206 {
205 } 207 }
206 208
207 } // namespace blink 209 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/request-end-to-end-worker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698