New issue
Advanced search Search tips

Issue 826013 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: Task



Sign in to add a comment

WKNavigationDelegate called out of order: didFinish is triggered before didCommit

Project Member Reported by danyao@chromium.org, Mar 26 2018

Issue description

This is first noticed in  crbug.com/818796#c2 .

Steps to reproduce:
1. Set breakpoints in CRWWebController |webView:didFinishNavigation| and |webView:didCommitNavigation|
2. Open NTP
3. Navigate to plus.google.com (must be signed in)
4. Click on back

Expected result:
Breakpoint in |webView:didCommitNavigation| is triggered before |webView:didFinishNavigation|.

Actual result:
The reverse order.

Caveats:
- This reproduces consistently in backward history navigation from plus.google.com to NTP. However, I can't reproduce it using other popular URLs (e.g. wikipedia.org, amazon.com) instead of plus.google.com.
- User must be signed in to plus.google.com
- Only reproducible in Chrome, not in vanilla WKWebView

This seems to suggest that there's some bad interaction between the code on plus.google.com, logic in Chrome and WKWebView.
 

Comment 1 by danyao@chromium.org, Mar 26 2018

I was also able to reproduce the bug in a tip-of-the-tree WebKit build (b76757cc465b) with Chrome:
run-webkit-app --ios-simulator ~/bling/src/out/Debug-iphonesimulator/Chromium.app/

It seems that WebCore dispatched the events out of order for the go-back navigation:

[#1 load NTP]:
com.apple.WebKit.WebContent.Development	17:27:02.567799 -0400	dispatchDidStart: frame: 0x7fb4b70048a8 URL: about:blank?for=chrome%3A%2F%2Fnewtab%2F
com.apple.WebKit.WebContent.Development	17:27:02.570167 -0400	dispatchDidCommit: frame 0x7fb4b70048a8 URL: about:blank?for=chrome%3A%2F%2Fnewtab%2F
com.apple.WebKit.WebContent.Development	17:27:02.690549 -0400	dispatchDidFinishDocLoad: frame: 0x7fb4b70048a8 URL: about:blank?for=chrome%3A%2F%2Fnewtab%2F
com.apple.WebKit.WebContent.Development	17:27:02.692015 -0400	dispatchDidFinish: 0x7fb4b70048a8 URL: about:blank?for=chrome%3A%2F%2Fnewtab%2F

[#2 load plus.google.com]:
com.apple.WebKit.WebContent.Development	17:27:33.508875 -0400	dispatchDidStart: frame: 0x7fb4b70048a8 URL: https://plus.google.com/
com.apple.WebKit.WebContent.Development	17:27:34.042447 -0400	dispatchDidCommit: frame 0x7fb4b70048a8 URL: https://plus.google.com/
com.apple.WebKit.WebContent.Development	17:27:35.604725 -0400	dispatchDidFinishDocLoad: frame: 0x7fb4b70048a8 URL: https://plus.google.com/
com.apple.WebKit.WebContent.Development	17:27:43.859575 -0400	dispatchDidFinish: 0x7fb4b70048a8 URL: https://plus.google.com/

[#3 back]:
com.apple.WebKit.WebContent.Development	17:27:51.114105 -0400	dispatchDidStart: frame: 0x7fb4b70048a8 URL: about:blank?for=chrome%3A%2F%2Fnewtab%2F
com.apple.WebKit.WebContent.Development	17:27:51.174924 -0400	dispatchDidFinish: 0x7fb4b70048a8 URL: about:blank?for=chrome%3A%2F%2Fnewtab%2F
com.apple.WebKit.WebContent.Development	17:27:51.231354 -0400	dispatchDidCommit: frame 0x7fb4b70048a8 URL: about:blank?for=chrome%3A%2F%2Fnewtab%2F

I'll file a WebKit bug once I can create a minimal repro use case.

Comment 2 by danyao@chromium.org, Mar 26 2018

Finish-before-commit has been observed previously too in crbug.com/727289 but we don't know which URL triggered it.
Labels: -Type-Bug Type-Task
Components: Mobile>iOSWeb
Components: -Mobile>WebView>Glue

Sign in to add a comment