EventSource: Synchronous loader callback not handled properly
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2013 09:51:36 +0000 (09:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2013 09:51:36 +0000 (09:51 +0000)
commitdfc8cb3ba659163dfad02f0a2ad256b24d9b8e6c
treed38cc353d18ed62e91375834687697672aad3e53
parenta2618fa3bad89cded91781c68376f41c3b3416b7
EventSource: Synchronous loader callback not handled properly
https://bugs.webkit.org/show_bug.cgi?id=115104

Source/WebCore:

When attempting a cross-origin request towards a non-HTTP URL, an early verification
of the protocol scheme will cause didFailAccessControlCheck to be called synchronously
before the loader has even finished being created. This special case was not handled
properly, since we tried to cancel a non-existing loader, which resulted in a crash.
In addition to checking whether a request is in flight before trying to cancel it,
this change also schedules the initial creation of the loader to happen asynchronously
when an EventSource is constructed, so that a script can register for the error event
before it is dispatched (as a result of passing a non-HTTP URL to the constructor).

Patch by Per-Erik Brodin <per-erik.brodin@ericsson.com> on 2013-04-25
Reviewed by Alexey Proskuryakov.

Test: http/tests/eventsource/eventsource-cors-non-http.html

* page/EventSource.cpp:
(WebCore::EventSource::EventSource):
(WebCore::EventSource::create):
(WebCore::EventSource::scheduleInitialConnect):
(WebCore):
(WebCore::EventSource::scheduleReconnect):
(WebCore::EventSource::connectTimerFired):
(WebCore::EventSource::close):
(WebCore::EventSource::abortConnectionAttempt):
* page/EventSource.h:
(EventSource):

LayoutTests:

Patch by Per-Erik Brodin <per-erik.brodin@ericsson.com> on 2013-04-25
Reviewed by Alexey Proskuryakov.

* http/tests/eventsource/eventsource-cors-non-http-expected.txt: Added.
* http/tests/eventsource/eventsource-cors-non-http.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/eventsource/eventsource-cors-non-http-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/eventsource/eventsource-cors-non-http.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/EventSource.h