Bug 153407

Summary: WebKitTestRunner: Credential cache is not cleared between tests
Product: WebKit Reporter: Daniel Bates <dbates>
Component: Tools / TestsAssignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, ap, beidson, commit-queue, lforschler, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on: 153451    
Bug Blocks: 153250    
Attachments:
Description Flags
LayoutTestToDemonstrateIssue
none
Patch
none
Patch
none
Patch ap: review+

Description Daniel Bates 2016-01-24 10:59:41 PST
Created attachment 269696 [details]
LayoutTestToDemonstrateIssue

WebKitTestRunner does not clear cached credentials between test runs.

* STEPS TO REPRODUCE
The following steps assume you have a build of WebKit.

1. Apply the attached diff to the top-level WebKit checkout, LayoutTestToDemonstrateIssued.diff.
2. In the terminal, inside the top-level WebKit checkout directory, run: Tools/Scripts/run-webkit-tests --no-retry-failures --child-processes 1 http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html http/tests/loading/basic-auth-resend-wrong-credentials.html

Then the test LayoutTests/http/tests/loading/basic-auth-resend-wrong-credentials.html will fail because it uses the credentials set in LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html, (username, password) = (webkit, rocks), when accessing the protected resource <ttp://127.0.0.1:8000/loading/resources/test2/protected-resource.php>.

Notice that both LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html and LayoutTests/http/tests/loading/basic-auth-resend-wrong-credentials.html access a protected resource in the same protection space, <http://127.0.0.1:8000/resources>.
Comment 1 Daniel Bates 2016-01-24 11:00:00 PST
<rdar://problem/24280834>
Comment 2 Daniel Bates 2016-01-25 09:38:46 PST
Created attachment 269756 [details]
Patch
Comment 3 Brady Eidson 2016-01-25 09:42:17 PST
Comment on attachment 269756 [details]
Patch

Mostly good, except it only sends the message to the NetworkProcess. I think we still need it sent to all WebProcesses, as well, since we still do some networking in the WebProcesses.
Comment 4 Daniel Bates 2016-01-25 10:01:14 PST
Created attachment 269757 [details]
Patch

Updated patch to send a message to all web processes to switch to a new testing network session in addition to sending a message to the network process.
Comment 5 Daniel Bates 2016-01-25 10:41:42 PST
Committed r195543: <http://trac.webkit.org/changeset/195543>
Comment 6 Alexey Proskuryakov 2016-01-25 14:29:48 PST
This caused a pretty serious performance regression on tests, so creating a whole new session looks like too large of a hammer, unfortunately :(

before:
13:18
13:31
13:42
13:34
13:39

after:
13:59
14:19
14:47
14:12
14:21
14:20
Comment 7 Daniel Bates 2016-01-25 14:51:40 PST
(In reply to comment #6)
> This caused a pretty serious performance regression on tests, so creating a
> whole new session looks like too large of a hammer, unfortunately :(
> 
> before:
> 13:18
> 13:31
> 13:42
> 13:34
> 13:39
> 
> after:
> 13:59
> 14:19
> 14:47
> 14:12
> 14:21
> 14:20

Will rollout <http://trac.webkit.org/changeset/195543>.

It should be sufficient to clear the credential cache directly.
Comment 8 WebKit Commit Bot 2016-01-25 15:05:12 PST
Re-opened since this is blocked by bug 153451
Comment 9 Daniel Bates 2016-01-25 17:33:17 PST
Created attachment 269825 [details]
Patch
Comment 10 Daniel Bates 2016-01-26 08:08:33 PST
Committed r195589: <http://trac.webkit.org/changeset/195589>