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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 , m_url(url) | 62 , m_url(url) |
63 , m_withCredentials(false) | 63 , m_withCredentials(false) |
64 , m_state(CONNECTING) | 64 , m_state(CONNECTING) |
65 , m_decoder(TextResourceDecoder::create("text/plain", "UTF-8")) | 65 , m_decoder(TextResourceDecoder::create("text/plain", "UTF-8")) |
66 , m_connectTimer(this, &EventSource::connectTimerFired) | 66 , m_connectTimer(this, &EventSource::connectTimerFired) |
67 , m_discardTrailingNewline(false) | 67 , m_discardTrailingNewline(false) |
68 , m_requestInFlight(false) | 68 , m_requestInFlight(false) |
69 , m_reconnectDelay(defaultReconnectDelay) | 69 , m_reconnectDelay(defaultReconnectDelay) |
70 { | 70 { |
71 ScriptWrappable::init(this); | 71 ScriptWrappable::init(this); |
72 eventSourceInit.get("withCredentials", m_withCredentials); | 72 DictionaryHelper::get(eventSourceInit, "withCredentials", m_withCredentials)
; |
73 } | 73 } |
74 | 74 |
75 PassRefPtrWillBeRawPtr<EventSource> EventSource::create(ExecutionContext* contex
t, const String& url, const Dictionary& eventSourceInit, ExceptionState& excepti
onState) | 75 PassRefPtrWillBeRawPtr<EventSource> EventSource::create(ExecutionContext* contex
t, const String& url, const Dictionary& eventSourceInit, ExceptionState& excepti
onState) |
76 { | 76 { |
77 if (url.isEmpty()) { | 77 if (url.isEmpty()) { |
78 exceptionState.throwDOMException(SyntaxError, "Cannot open an EventSourc
e to an empty URL."); | 78 exceptionState.throwDOMException(SyntaxError, "Cannot open an EventSourc
e to an empty URL."); |
79 return nullptr; | 79 return nullptr; |
80 } | 80 } |
81 | 81 |
82 KURL fullURL = context->completeURL(url); | 82 KURL fullURL = context->completeURL(url); |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 430 |
431 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent() | 431 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent() |
432 { | 432 { |
433 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(); | 433 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(); |
434 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_
eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS
treamOrigin, m_lastEventId, 0, nullptr); | 434 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_
eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS
treamOrigin, m_lastEventId, 0, nullptr); |
435 m_data.clear(); | 435 m_data.clear(); |
436 return event.release(); | 436 return event.release(); |
437 } | 437 } |
438 | 438 |
439 } // namespace WebCore | 439 } // namespace WebCore |
OLD | NEW |