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

Unified Diff: third_party/WebKit/Source/modules/eventsource/EventSource.cpp

Issue 2456013002: CSP: 'connect-src' should not cause exceptions. (Closed)
Patch Set: Created 4 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: third_party/WebKit/Source/modules/eventsource/EventSource.cpp
diff --git a/third_party/WebKit/Source/modules/eventsource/EventSource.cpp b/third_party/WebKit/Source/modules/eventsource/EventSource.cpp
index acaee289dc2be98a543dd183c81747778aeba04f..6d689fbdf929133c1b1b34f0e0e1855ed788f5ea 100644
--- a/third_party/WebKit/Source/modules/eventsource/EventSource.cpp
+++ b/third_party/WebKit/Source/modules/eventsource/EventSource.cpp
@@ -97,18 +97,6 @@ EventSource* EventSource::create(ExecutionContext* context,
return nullptr;
}
- // FIXME: Convert this to check the isolated world's Content Security Policy
- // once webkit.org/b/104520 is solved.
- if (!ContentSecurityPolicy::shouldBypassMainWorld(context) &&
- !context->contentSecurityPolicy()->allowConnectToSource(fullURL)) {
- // We can safely expose the URL to JavaScript, as this exception is generate
- // synchronously before any redirects take place.
- exceptionState.throwSecurityError(
- "Refused to connect to '" + fullURL.elidedString() +
- "' because it violates the document's Content Security Policy.");
- return nullptr;
- }
-
EventSource* source = new EventSource(context, fullURL, eventSourceInit);
source->scheduleInitialConnect();
@@ -319,6 +307,11 @@ void EventSource::didFail(const ResourceError& error) {
DCHECK_NE(kClosed, m_state);
DCHECK(m_loader);
+ if (error.isAccessCheck()) {
+ didFailAccessControlCheck(error);
+ return;
+ }
+
if (error.isCancellation())
m_state = kClosed;
networkRequestEnded();

Powered by Google App Engine
This is Rietveld 408576698