Skip to content
Permalink
Browse files
XHR timeouts should not fire if there is an immediate network error.
https://bugs.webkit.org/show_bug.cgi?id=150577

Patch by Alex Christensen <achristensen@webkit.org> on 2015-11-09
Reviewed by Darin Adler.

Source/WebCore:

This fixes flakiness of http/tests/contentextensions/async-xhr-onerror.html since r191077.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::createRequest):
(WebCore::XMLHttpRequest::internalAbort):
(WebCore::XMLHttpRequest::didFinishLoading):
If the timeout timer has been started and we are going to immediately report a network error, then stop the timeout timer.
The timeout timer sometimes fired before the network error timer if it was a very short timeout (such as 1ms).
Also checks to isActive before calling stop on a timer are not necessary.

LayoutTests:

* platform/mac-wk2/TestExpectations:
http/tests/contentextensions/async-xhr-onerror.html shouldn't be flaky any more.

Canonical link: https://commits.webkit.org/169252@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192175 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Alex Christensen authored and webkit-commit-queue committed Nov 9, 2015
1 parent c6d3e7d commit b3908b77168773bf75fbb7593f076c05606f99a4
Showing 4 changed files with 32 additions and 7 deletions.
@@ -1,3 +1,13 @@
2015-11-09 Alex Christensen <achristensen@webkit.org>

XHR timeouts should not fire if there is an immediate network error.
https://bugs.webkit.org/show_bug.cgi?id=150577

Reviewed by Darin Adler.

* platform/mac-wk2/TestExpectations:
http/tests/contentextensions/async-xhr-onerror.html shouldn't be flaky any more.

2015-11-09 Nan Wang <n_wang@apple.com>

AX: Input type: time is not accessible on iOS
@@ -283,8 +283,6 @@ webkit.org/b/150378 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-wor

webkit.org/b/150736 http/tests/notifications/legacy/events.html [ Pass Crash ]

webkit.org/b/150577 http/tests/contentextensions/async-xhr-onerror.html [ Pass Failure ]

webkit.org/b/150942 animations/multiple-backgrounds.html [ Pass ImageOnlyFailure ]

### END OF (1) Classified failures with bug reports
@@ -1,3 +1,20 @@
2015-11-09 Alex Christensen <achristensen@webkit.org>

XHR timeouts should not fire if there is an immediate network error.
https://bugs.webkit.org/show_bug.cgi?id=150577

Reviewed by Darin Adler.

This fixes flakiness of http/tests/contentextensions/async-xhr-onerror.html since r191077.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::createRequest):
(WebCore::XMLHttpRequest::internalAbort):
(WebCore::XMLHttpRequest::didFinishLoading):
If the timeout timer has been started and we are going to immediately report a network error, then stop the timeout timer.
The timeout timer sometimes fired before the network error timer if it was a very short timeout (such as 1ms).
Also checks to isActive before calling stop on a timer are not necessary.

2015-11-09 Eric Carlson <eric.carlson@apple.com>

[MediaStream] Add mock audio and video sources
@@ -781,8 +781,10 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec)
// a request is in progress because we need to keep the listeners alive,
// and they are referenced by the JavaScript wrapper.
setPendingActivity(this);
if (!m_loader)
if (!m_loader) {
m_timeoutTimer.stop();
m_networkErrorTimer.startOneShot(0);
}
} else {
InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext());
ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options);
@@ -829,8 +831,7 @@ bool XMLHttpRequest::internalAbort()

m_decoder = nullptr;

if (m_timeoutTimer.isActive())
m_timeoutTimer.stop();
m_timeoutTimer.stop();

if (!m_loader)
return true;
@@ -1121,8 +1122,7 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier, double)
m_responseEncoding = String();
m_decoder = nullptr;

if (m_timeoutTimer.isActive())
m_timeoutTimer.stop();
m_timeoutTimer.stop();

if (hadLoader)
dropProtection();

0 comments on commit b3908b7

Please sign in to comment.