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

Side by Side Diff: Source/core/page/EventSource.cpp

Issue 18548003: Rename ExceptionCode constants to use the names in the spec (2/3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/DOMWindow.cpp ('k') | Source/core/page/History.cpp » ('j') | 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) 2009, 2012 Ericsson AB. All rights reserved. 2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved.
3 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved. 4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 , m_requestInFlight(false) 67 , m_requestInFlight(false)
68 , m_reconnectDelay(defaultReconnectDelay) 68 , m_reconnectDelay(defaultReconnectDelay)
69 { 69 {
70 ScriptWrappable::init(this); 70 ScriptWrappable::init(this);
71 eventSourceInit.get("withCredentials", m_withCredentials); 71 eventSourceInit.get("withCredentials", m_withCredentials);
72 } 72 }
73 73
74 PassRefPtr<EventSource> EventSource::create(ScriptExecutionContext* context, con st String& url, const Dictionary& eventSourceInit, ExceptionCode& ec) 74 PassRefPtr<EventSource> EventSource::create(ScriptExecutionContext* context, con st String& url, const Dictionary& eventSourceInit, ExceptionCode& ec)
75 { 75 {
76 if (url.isEmpty()) { 76 if (url.isEmpty()) {
77 ec = SYNTAX_ERR; 77 ec = SyntaxError;
78 return 0; 78 return 0;
79 } 79 }
80 80
81 KURL fullURL = context->completeURL(url); 81 KURL fullURL = context->completeURL(url);
82 if (!fullURL.isValid()) { 82 if (!fullURL.isValid()) {
83 ec = SYNTAX_ERR; 83 ec = SyntaxError;
84 return 0; 84 return 0;
85 } 85 }
86 86
87 // FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved. 87 // FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
88 bool shouldBypassMainWorldContentSecurityPolicy = false; 88 bool shouldBypassMainWorldContentSecurityPolicy = false;
89 if (context->isDocument()) { 89 if (context->isDocument()) {
90 Document* document = toDocument(context); 90 Document* document = toDocument(context);
91 shouldBypassMainWorldContentSecurityPolicy = document->frame()->script() ->shouldBypassMainWorldContentSecurityPolicy(); 91 shouldBypassMainWorldContentSecurityPolicy = document->frame()->script() ->shouldBypassMainWorldContentSecurityPolicy();
92 } 92 }
93 if (!shouldBypassMainWorldContentSecurityPolicy && !context->contentSecurity Policy()->allowConnectToSource(fullURL)) { 93 if (!shouldBypassMainWorldContentSecurityPolicy && !context->contentSecurity Policy()->allowConnectToSource(fullURL)) {
94 // FIXME: Should this be throwing an exception? 94 // FIXME: Should this be throwing an exception?
95 ec = SECURITY_ERR; 95 ec = SecurityError;
96 return 0; 96 return 0;
97 } 97 }
98 98
99 RefPtr<EventSource> source = adoptRef(new EventSource(context, fullURL, even tSourceInit)); 99 RefPtr<EventSource> source = adoptRef(new EventSource(context, fullURL, even tSourceInit));
100 100
101 source->setPendingActivity(source.get()); 101 source->setPendingActivity(source.get());
102 source->connect(); 102 source->connect();
103 source->suspendIfNeeded(); 103 source->suspendIfNeeded();
104 104
105 return source.release(); 105 return source.release();
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 { 423 {
424 return &m_eventTargetData; 424 return &m_eventTargetData;
425 } 425 }
426 426
427 EventTargetData* EventSource::ensureEventTargetData() 427 EventTargetData* EventSource::ensureEventTargetData()
428 { 428 {
429 return &m_eventTargetData; 429 return &m_eventTargetData;
430 } 430 }
431 431
432 } // namespace WebCore 432 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/DOMWindow.cpp ('k') | Source/core/page/History.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698