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

Unified Diff: Source/modules/serviceworkers/RespondWithObserver.cpp

Issue 621003002: [ServiceWorker] Treat opaque response as a network error for frame loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/serviceworkers/RespondWithObserver.cpp
diff --git a/Source/modules/serviceworkers/RespondWithObserver.cpp b/Source/modules/serviceworkers/RespondWithObserver.cpp
index e4a6fa4f6f928c0e7eee272ac03115e8d2910e30..40b8ee6977e95443b5513ed7179a5bab7266d26b 100644
--- a/Source/modules/serviceworkers/RespondWithObserver.cpp
+++ b/Source/modules/serviceworkers/RespondWithObserver.cpp
@@ -63,9 +63,9 @@ private:
ResolveType m_resolveType;
};
-RespondWithObserver* RespondWithObserver::create(ExecutionContext* context, int eventID, WebURLRequest::FetchRequestMode requestMode)
+RespondWithObserver* RespondWithObserver::create(ExecutionContext* context, int eventID, WebURLRequest::FetchRequestMode requestMode, WebURLRequest::FrameType frameType)
{
- return new RespondWithObserver(context, eventID, requestMode);
+ return new RespondWithObserver(context, eventID, requestMode, frameType);
}
void RespondWithObserver::contextDestroyed()
@@ -122,16 +122,22 @@ void RespondWithObserver::responseWasFulfilled(const ScriptValue& value)
responseWasRejected();
return;
}
+ // Treat the opaque response as a network error for frame loading.
+ if (responseType == FetchResponseData::OpaqueType && m_frameType != WebURLRequest::FrameTypeNone) {
Mike West 2014/10/02 12:07:46 You probably want to check for TopLevel or Nested
horo 2014/10/03 03:43:02 It may reasonable. But the current ServiceWorker s
+ responseWasRejected();
+ return;
+ }
WebServiceWorkerResponse webResponse;
response->populateWebServiceWorkerResponse(webResponse);
ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEvent(m_eventID, webResponse);
m_state = Done;
}
-RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID, WebURLRequest::FetchRequestMode requestMode)
+RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID, WebURLRequest::FetchRequestMode requestMode, WebURLRequest::FrameType frameType)
: ContextLifecycleObserver(context)
, m_eventID(eventID)
, m_requestMode(requestMode)
+ , m_frameType(frameType)
, m_state(Initial)
{
}

Powered by Google App Engine
This is Rietveld 408576698