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

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

Issue 2456013002: CSP: 'connect-src' should not cause exceptions. (Closed)
Patch Set: Ugh. Created 3 years, 9 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 a590923abb0a31eb2319aabfe5e3828bc6bdcc6c..63224637a629614cbb43fe1a88aa0bd488dba981 100644
--- a/third_party/WebKit/Source/modules/eventsource/EventSource.cpp
+++ b/third_party/WebKit/Source/modules/eventsource/EventSource.cpp
@@ -99,18 +99,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();
@@ -323,6 +311,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