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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ResourceRequest request(m_url); | 130 ResourceRequest request(m_url); |
131 request.setHTTPMethod("GET"); | 131 request.setHTTPMethod("GET"); |
132 request.setHTTPHeaderField("Accept", "text/event-stream"); | 132 request.setHTTPHeaderField("Accept", "text/event-stream"); |
133 request.setHTTPHeaderField("Cache-Control", "no-cache"); | 133 request.setHTTPHeaderField("Cache-Control", "no-cache"); |
134 if (!m_lastEventId.isEmpty()) | 134 if (!m_lastEventId.isEmpty()) |
135 request.setHTTPHeaderField("Last-Event-ID", m_lastEventId); | 135 request.setHTTPHeaderField("Last-Event-ID", m_lastEventId); |
136 | 136 |
137 SecurityOrigin* origin = executionContext.securityOrigin(); | 137 SecurityOrigin* origin = executionContext.securityOrigin(); |
138 | 138 |
139 ThreadableLoaderOptions options; | 139 ThreadableLoaderOptions options; |
140 options.sniffContent = DoNotSniffContent; | |
141 options.allowCredentials = (origin->canRequest(m_url) || m_withCredentials)
? AllowStoredCredentials : DoNotAllowStoredCredentials; | |
142 options.credentialsRequested = m_withCredentials ? ClientRequestedCredential
s : ClientDidNotRequestCredentials; | |
143 options.preflightPolicy = PreventPreflight; | 140 options.preflightPolicy = PreventPreflight; |
144 options.crossOriginRequestPolicy = UseAccessControl; | 141 options.crossOriginRequestPolicy = UseAccessControl; |
145 options.dataBufferingPolicy = DoNotBufferData; | |
146 options.securityOrigin = origin; | |
147 options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypa
ssMainWorld(&executionContext) ? DoNotEnforceContentSecurityPolicy : EnforceConn
ectSrcDirective; | 142 options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypa
ssMainWorld(&executionContext) ? DoNotEnforceContentSecurityPolicy : EnforceConn
ectSrcDirective; |
148 | 143 |
149 m_loader = ThreadableLoader::create(executionContext, this, request, options
); | 144 ResourceLoaderOptions resourceLoaderOptions; |
| 145 resourceLoaderOptions.allowCredentials = (origin->canRequest(m_url) || m_wit
hCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials; |
| 146 resourceLoaderOptions.credentialsRequested = m_withCredentials ? ClientReque
stedCredentials : ClientDidNotRequestCredentials; |
| 147 resourceLoaderOptions.dataBufferingPolicy = DoNotBufferData; |
| 148 resourceLoaderOptions.securityOrigin = origin; |
| 149 |
| 150 m_loader = ThreadableLoader::create(executionContext, this, request, options
, resourceLoaderOptions); |
150 | 151 |
151 if (m_loader) | 152 if (m_loader) |
152 m_requestInFlight = true; | 153 m_requestInFlight = true; |
153 } | 154 } |
154 | 155 |
155 void EventSource::networkRequestEnded() | 156 void EventSource::networkRequestEnded() |
156 { | 157 { |
157 if (!m_requestInFlight) | 158 if (!m_requestInFlight) |
158 return; | 159 return; |
159 | 160 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 429 |
429 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent() | 430 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent() |
430 { | 431 { |
431 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(); | 432 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(); |
432 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_
eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS
treamOrigin, m_lastEventId, 0, nullptr); | 433 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_
eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS
treamOrigin, m_lastEventId, 0, nullptr); |
433 m_data.clear(); | 434 m_data.clear(); |
434 return event.release(); | 435 return event.release(); |
435 } | 436 } |
436 | 437 |
437 } // namespace WebCore | 438 } // namespace WebCore |
OLD | NEW |