New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 794939 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Task



Sign in to add a comment

Task: write tests for cookies in WebView.

Project Member Reported by arthurso...@chromium.org, Dec 14 2017

Issue description

In  issue 793648 , two bugs with cookies in WebView were fixed by:
https://chromium-review.googlesource.com/c/chromium/src/+/822572
https://chromium-review.googlesource.com/c/chromium/src/+/827018

There are no regression tests written for these, but we still need them.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Dec 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8c0b1dcaa85bbc72465d389981b46d4d0b86fcad

commit 8c0b1dcaa85bbc72465d389981b46d4d0b86fcad
Author: arthursonzogni <arthursonzogni@chromium.org>
Date: Thu Dec 14 17:23:50 2017

Fix third party cookies not being sent in WebView iframes.

The issue was in:
AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies()

AwContentsIoThreadClient::FromID(render_process_id, render_frame_id) was
used, but at this point a navigation request is not associated with a
renderer process yet. It caused the cookies not being sent with the
request.

The solution was to use
AwContentsIoThreadClient::FromID(frame_tree_node_id) instead.

Bug:  793648 ,  794939 
Change-Id: I5bda7affab67645cfd64c105b06c8a628047dd79
Reviewed-on: https://chromium-review.googlesource.com/827018
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524098}
[modify] https://crrev.com/8c0b1dcaa85bbc72465d389981b46d4d0b86fcad/android_webview/browser/aw_cookie_access_policy.cc
[modify] https://crrev.com/8c0b1dcaa85bbc72465d389981b46d4d0b86fcad/android_webview/browser/aw_cookie_access_policy.h

Project Member

Comment 2 by bugdroid1@chromium.org, Dec 14 2017

Labels: merge-merged-3239
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0b1e6d69c9f2f03ff07a1cf0df694d36dc35faf3

commit 0b1e6d69c9f2f03ff07a1cf0df694d36dc35faf3
Author: arthursonzogni <arthursonzogni@chromium.org>
Date: Thu Dec 14 19:30:33 2017

Fix third party cookies not being sent in WebView iframes.

The issue was in:
AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies()

AwContentsIoThreadClient::FromID(render_process_id, render_frame_id) was
used, but at this point a navigation request is not associated with a
renderer process yet. It caused the cookies not being sent with the
request.

The solution was to use
AwContentsIoThreadClient::FromID(frame_tree_node_id) instead.

Bug:  793648 ,  794939 
Change-Id: I5bda7affab67645cfd64c105b06c8a628047dd79
Reviewed-on: https://chromium-review.googlesource.com/827018
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#524098}(cherry picked from commit 8c0b1dcaa85bbc72465d389981b46d4d0b86fcad)
Reviewed-on: https://chromium-review.googlesource.com/827565
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/branch-heads/3239@{#678}
Cr-Branched-From: adb61db19020ed8ecee5e91b1a0ea4c924ae2988-refs/heads/master@{#508578}
[modify] https://crrev.com/0b1e6d69c9f2f03ff07a1cf0df694d36dc35faf3/android_webview/browser/aw_cookie_access_policy.cc
[modify] https://crrev.com/0b1e6d69c9f2f03ff07a1cf0df694d36dc35faf3/android_webview/browser/aw_cookie_access_policy.h

Project Member

Comment 3 by bugdroid1@chromium.org, Dec 14 2017

Labels: merge-merged-3282
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/584a409e8edac71cdc9b80a043648e08d68e0618

commit 584a409e8edac71cdc9b80a043648e08d68e0618
Author: arthursonzogni <arthursonzogni@chromium.org>
Date: Thu Dec 14 19:31:28 2017

Fix third party cookies not being sent in WebView iframes.

The issue was in:
AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies()

AwContentsIoThreadClient::FromID(render_process_id, render_frame_id) was
used, but at this point a navigation request is not associated with a
renderer process yet. It caused the cookies not being sent with the
request.

The solution was to use
AwContentsIoThreadClient::FromID(frame_tree_node_id) instead.

Bug:  793648 ,  794939 
Change-Id: I5bda7affab67645cfd64c105b06c8a628047dd79
Reviewed-on: https://chromium-review.googlesource.com/827018
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#524098}(cherry picked from commit 8c0b1dcaa85bbc72465d389981b46d4d0b86fcad)
Reviewed-on: https://chromium-review.googlesource.com/827567
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/branch-heads/3282@{#231}
Cr-Branched-From: 5fdc0fab22ce7efd32532ee989b223fa12f8171e-refs/heads/master@{#520840}
[modify] https://crrev.com/584a409e8edac71cdc9b80a043648e08d68e0618/android_webview/browser/aw_cookie_access_policy.cc
[modify] https://crrev.com/584a409e8edac71cdc9b80a043648e08d68e0618/android_webview/browser/aw_cookie_access_policy.h

Cc: ntfschr@chromium.org
Labels: -merge-merged-3239 -merge-merged-3282

Comment 6 by ctzsm@chromium.org, Dec 19 2017

Cc: -boli@chromium.org boliu@chromium.org
Owner: arthurso...@chromium.org
Status: Assigned (was: Untriaged)
arthursonzogni@, could you please close it if it's done? Assigning this to you for now since you are writing those tests.
I can write the WebView integration tests. If I understand correctly, the issues were:

 1. Can't set 1P cookies in iframes loaded with loadDataWithBaseUrl()
 2. Can't send 3P cookies (which are already set) to iframes

arthursonzogni@ if I've understood correctly--and this is all the test coverage we want--then feel free to pass this to me.
Owner: ntfschr@chromium.org
AFAIU:
1) Can't send 1P cookies in the iframe request when the main frame is loaded with loadDataWithBaseUrl().
2) Can't send 3P cookies at all.

It corresponds to the two repro apk:
1) https://bugs.chromium.org/p/chromium/issues/detail?id=793648#c7
2) https://bugs.chromium.org/p/chromium/issues/detail?id=793648#c57

ntfschr@ Thanks! I would be happy to assign this bug to you, since I am not used to writing webview tests.
Status: Started (was: Assigned)
Ok, I think I have 2 regression tests, I'll upload them and CC Arthur on the CL.
Project Member

Comment 10 by bugdroid1@chromium.org, Jan 9 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/655df1b56b44def9519bc26116de60ea3f7827d6

commit 655df1b56b44def9519bc26116de60ea3f7827d6
Author: Nate Fischer <ntfschr@chromium.org>
Date: Tue Jan 09 21:58:00 2018

AW: regression tests for cookies in iframe

No change to production logic, this only adds regression tests for
already-fixed issues.

This tests that:

 * 1P cookies can be set by a subresource loaded via
   loadDataWithBaseURL()
 * WebView sends 3P cookies in requests for subresources

Both tests use loadDataWithBaseURL. The second bullet applies to all
loads, but loadDataWithBaseURL is a convenient way to make a 3P load.

Bug:  794939 
Test: run_webview_instrumentation_test_apk -f LoadDataWithBaseUrlTest#test*Cookie*Iframe
Change-Id: I6305b41128e821f15ae0e82222a2bf5e5a018dc5
Reviewed-on: https://chromium-review.googlesource.com/855599
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528130}
[modify] https://crrev.com/655df1b56b44def9519bc26116de60ea3f7827d6/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java

Status: Fixed (was: Started)
I think this should be sufficient. If anyone can think of related areas in need of coverage, let me know and I'll gladly add tests.
Status: Verified (was: Fixed)
Bulk edit: marking stale 'fixed' bugs as 'verified' since they don't need verification at this point.

Sign in to add a comment