REGRESSION (r224684): User-agent seen by page does not change when modified by the...
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2018 00:20:16 +0000 (00:20 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2018 00:20:16 +0000 (00:20 +0000)
commitcc0c63d28c45736aa3e7c149dadd9c0b56708684
tree351a6bf608bc73e46da9fb7334f1414b4d7b56bf
parent6b44d16a8aafdf664699ec6fbff76f9ddd704aac
REGRESSION (r224684): User-agent seen by page does not change when modified by the develop menu options after reloading.
<rdar://problem/34918109> and https://bugs.webkit.org/show_bug.cgi?id=186111

Reviewed by Andy Estes.

Source/WebCore:

Test: http/tests/navigation/useragent-reload.php

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::clientHandshakeRequest const): Use setUserAgent() for consistency.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::startLoadingMainResource): Clear the user agent from the original DocumentLoader request
  before adding additional fields, as reloads should pick up user agent changes.

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setCustomUserAgent):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* TestExpectations: Skip in WK1
* platform/wk2/TestExpectations: Enable in WK2

* http/tests/navigation/resources/user-agent-script.php: Added.
* http/tests/navigation/useragent-reload-expected.txt: Added.
* http/tests/navigation/useragent-reload.php: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/http/tests/navigation/resources/user-agent-script.php [new file with mode: 0644]
LayoutTests/http/tests/navigation/useragent-reload-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/navigation/useragent-reload.php [new file with mode: 0644]
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
Source/WebCore/loader/DocumentLoader.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestInvocation.cpp