Bug 192675 - WKWebView has old URL while displaying SafeBrowsing interstitial, for link-click navigations
Summary: WKWebView has old URL while displaying SafeBrowsing interstitial, for link-cl...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-12-13 13:02 PST by Ali Juma
Modified: 2018-12-18 15:02 PST (History)
8 users (show)

See Also:


Attachments
Patch (13.95 KB, patch)
2018-12-18 00:02 PST, Alex Christensen
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ali Juma 2018-12-13 13:02:07 PST
When navigating to an unsafe site by clicking on a link, WKWebView's URL property is the old URL (the URL we're coming from), not the unsafe URL, while the SafeBrowsing interstitial is displayed. Also, WKWebView's isLoading property is false while the interstitial is displayed. This makes it harder for an embedder to display the unsafe URL in the embedder's UI (so that the user can make an informed decision when presented with the warning interstitial).

This also happens for client-side redirects to unsafe destinations -- the URL is the redirecting page's URL and isLoading is false.

This is different from what happens when navigating to an unsafe site using back/forward navigation or using loadRequest, where WKWebView's URL is the unsafe URL and isLoading is true while the interstitial is displayed.
Comment 1 Radar WebKit Bug Importer 2018-12-17 08:07:41 PST
<rdar://problem/46778097>
Comment 2 Alex Christensen 2018-12-18 00:02:51 PST
Created attachment 357544 [details]
Patch
Comment 3 Geoffrey Garen 2018-12-18 10:03:07 PST
Comment on attachment 357544 [details]
Patch

r=me
Comment 4 Alex Christensen 2018-12-18 10:26:45 PST
http://trac.webkit.org/r239339
Comment 5 Ryan Haddad 2018-12-18 13:23:28 PST
The API test added with this change is failing on iOS bots:

    TestWebKitAPI.SafeBrowsing.URLObservation
        
        /Volumes/Data/slave/ios-simulator-12-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:206
        Expected equality of these values:
          [button attributedTitleForState:UIControlStateNormal].string.UTF8String
            Which is: NULL
          expectedTitle
            Which is: "Go Back"
        
        
        /Volumes/Data/slave/ios-simulator-12-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:218
        Expected equality of these values:
          [webView _safeBrowsingWarning]
            Which is: 0x7fa0a780a000
          nullptr
            Which is: (nullptr)
        
        
        /Volumes/Data/slave/ios-simulator-12-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:333
        Expected equality of these values:
          urls.size()
            Which is: 2
          expected.size()
            Which is: 3
Comment 6 Alex Christensen 2018-12-18 14:24:47 PST
Looking...
Comment 7 Alex Christensen 2018-12-18 15:02:29 PST
http://trac.webkit.org/r239356