OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |