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

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

Issue 2478783002: Resolve FetchEvent.preloadResponse with undefined when Navigation Preload is disabled. (Closed)
Patch Set: ScriptPromiseProperty::resolveWithUndefined() Created 3 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/serviceworkers/FetchEvent.h" 5 #include "modules/serviceworkers/FetchEvent.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/ToV8.h" 8 #include "bindings/core/v8/ToV8.h"
9 #include "bindings/core/v8/V8HiddenValue.h" 9 #include "bindings/core/v8/V8HiddenValue.h"
10 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" 10 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const FetchEventInit& initializer, 69 const FetchEventInit& initializer,
70 RespondWithObserver* respondWithObserver, 70 RespondWithObserver* respondWithObserver,
71 WaitUntilObserver* waitUntilObserver, 71 WaitUntilObserver* waitUntilObserver,
72 bool navigationPreloadSent) 72 bool navigationPreloadSent)
73 : ExtendableEvent(type, initializer, waitUntilObserver), 73 : ExtendableEvent(type, initializer, waitUntilObserver),
74 m_observer(respondWithObserver), 74 m_observer(respondWithObserver),
75 m_preloadResponseProperty(new PreloadResponseProperty( 75 m_preloadResponseProperty(new PreloadResponseProperty(
76 scriptState->getExecutionContext(), 76 scriptState->getExecutionContext(),
77 this, 77 this,
78 PreloadResponseProperty::PreloadResponse)) { 78 PreloadResponseProperty::PreloadResponse)) {
79 if (!navigationPreloadSent) { 79 if (!navigationPreloadSent)
80 // TODO(horo): This behavior is still under the spec discussion. 80 m_preloadResponseProperty->resolveWithUndefined();
81 // https://github.com/w3c/ServiceWorker/issues/920#issuecomment-255874864
82 m_preloadResponseProperty->resolve(nullptr);
83 }
84 81
85 m_clientId = initializer.clientId(); 82 m_clientId = initializer.clientId();
86 m_isReload = initializer.isReload(); 83 m_isReload = initializer.isReload();
87 if (initializer.hasRequest()) { 84 if (initializer.hasRequest()) {
88 ScriptState::Scope scope(scriptState); 85 ScriptState::Scope scope(scriptState);
89 m_request = initializer.request(); 86 m_request = initializer.request();
90 v8::Local<v8::Value> request = ToV8(m_request, scriptState); 87 v8::Local<v8::Value> request = ToV8(m_request, scriptState);
91 v8::Local<v8::Value> event = ToV8(this, scriptState); 88 v8::Local<v8::Value> event = ToV8(this, scriptState);
92 if (event.IsEmpty()) { 89 if (event.IsEmpty()) {
93 // |toV8| can return an empty handle when the worker is terminating. 90 // |toV8| can return an empty handle when the worker is terminating.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 145 }
149 146
150 DEFINE_TRACE(FetchEvent) { 147 DEFINE_TRACE(FetchEvent) {
151 visitor->trace(m_observer); 148 visitor->trace(m_observer);
152 visitor->trace(m_request); 149 visitor->trace(m_request);
153 visitor->trace(m_preloadResponseProperty); 150 visitor->trace(m_preloadResponseProperty);
154 ExtendableEvent::trace(visitor); 151 ExtendableEvent::trace(visitor);
155 } 152 }
156 153
157 } // namespace blink 154 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698