[Content Extensions] Make blocked async XHR call onerror
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Oct 2015 00:52:23 +0000 (00:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Oct 2015 00:52:23 +0000 (00:52 +0000)
commitec13f20af7cc9cd9435d81a5a44f9a065e5167ae
tree610e6006fd24cce3aa02aac18105b9aa5b7cd2d4
parent85871b11ebb83181dd6c56b4d39293601eac8148
[Content Extensions] Make blocked async XHR call onerror
https://bugs.webkit.org/show_bug.cgi?id=146706

Patch by Alex Christensen <achristensen@webkit.org> on 2015-10-14
Reviewed by Brady Eidson.

Source/WebCore:

Test: http/tests/contentextensions/async-xhr-onerror.html

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::XMLHttpRequest):
(WebCore::XMLHttpRequest::createRequest):
(WebCore::XMLHttpRequest::networkError):
(WebCore::XMLHttpRequest::networkErrorTimerFired):
(WebCore::XMLHttpRequest::abortError):
* xml/XMLHttpRequest.h:
Make a timer that calls networkError in 0 time if a content blocker blocks the asynchronous load.
It is necessary to call setPendingActivity and dropProtection (which calls unsetPendingActivity)
to keep a reference to the XMLHttpRequest alive.

LayoutTests:

* http/tests/contentextensions/async-xhr-onerror-expected.txt: Added.
* http/tests/contentextensions/async-xhr-onerror.html: Added.
* http/tests/contentextensions/async-xhr-onerror.html.json: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/async-xhr-onerror.html [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/async-xhr-onerror.html.json [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h