Bug 187826 - Add WKNavigation/WKNavigationAction related SPI
Summary: Add WKNavigation/WKNavigationAction related SPI
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-07-19 15:48 PDT by Brady Eidson
Modified: 2018-07-20 10:35 PDT (History)
10 users (show)

See Also:


Attachments
Patch (15.80 KB, patch)
2018-07-19 15:50 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch (14.08 KB, patch)
2018-07-19 15:53 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch (15.56 KB, patch)
2018-07-19 18:43 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews206 for win-future (13.03 MB, application/zip)
2018-07-19 22:34 PDT, EWS Watchlist
no flags Details
Patch (15.56 KB, patch)
2018-07-20 07:40 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch (15.56 KB, patch)
2018-07-20 09:29 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2018-07-19 15:48:15 PDT
Add WKNavigation/WKNavigationAction related SPI

This includes:
- Exposing the WKNavigation on WKNavigationAction if there is one
- Exposing a C-API method to start a load and get back a WKNavigation
Comment 1 Brady Eidson 2018-07-19 15:48:32 PDT
<rdar://problem/42387710>
Comment 2 Brady Eidson 2018-07-19 15:50:48 PDT
Created attachment 345394 [details]
Patch
Comment 3 Tim Horton 2018-07-19 15:52:44 PDT
Comment on attachment 345394 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=345394&action=review

> Tools/ChangeLog:13
> +2018-07-19  Brady Eidson  <beidson@apple.com>

What's going on here
Comment 4 Brady Eidson 2018-07-19 15:53:27 PDT
Created attachment 345395 [details]
Patch
Comment 5 Chris Dumez 2018-07-19 15:55:18 PDT
Comment on attachment 345395 [details]
Patch

r=me
Comment 6 Alex Christensen 2018-07-19 15:58:02 PDT
Comment on attachment 345395 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=345395&action=review

> Source/WebKit/UIProcess/API/APINavigationAction.h:82
> +    NavigationAction(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, std::optional<WTF::String> targetFrameName, WebCore::ResourceRequest&& request, const WebCore::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction)

Can't you use a default value instead of making another constructor?
API::Navigation* mainFrameNavigation = nullptr
Comment 7 Alex Christensen 2018-07-19 16:03:42 PDT
Comment on attachment 345395 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=345395&action=review

> Source/WebKit/UIProcess/API/Cocoa/WKNavigationActionPrivate.h:59
> +@property (nonatomic, readonly) WKNavigation *_mainFrameNavigation WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));

This feels messy.  Is there really no way to access this from the client?  We already tell the client about each navigation, and the client can know whether the frame is the main frame or not.

> Source/WebKit/UIProcess/WebPageProxy.cpp:4026
> +    API::Navigation *mainFrameNavigation = frame->isMainFrame() ? navigation.get() : nullptr;

* is in the wrong place.
Comment 8 Brady Eidson 2018-07-19 17:14:07 PDT
(In reply to Alex Christensen from comment #7)
> Comment on attachment 345395 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=345395&action=review
> 
> > Source/WebKit/UIProcess/API/Cocoa/WKNavigationActionPrivate.h:59
> > +@property (nonatomic, readonly) WKNavigation *_mainFrameNavigation WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
> 
> This feels messy.  Is there really no way to access this from the client? 
> We already tell the client about each navigation, and the client can know
> whether the frame is the main frame or not.

We do not tell the client about every navigation, that's actually wrong.

Regardless, at "decide policy" time the client has no way of knowing which navigation is being considered, and that ability is what this patch adds
(Note: Only main frames have WKNavigations, hence the name of the variable)

> > Source/WebKit/UIProcess/WebPageProxy.cpp:4026
> > +    API::Navigation *mainFrameNavigation = frame->isMainFrame() ? navigation.get() : nullptr;
> 
> * is in the wrong place.

Indeed will fix.
Comment 9 Brady Eidson 2018-07-19 17:14:27 PDT
(In reply to Alex Christensen from comment #6)
> Comment on attachment 345395 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=345395&action=review
> 
> > Source/WebKit/UIProcess/API/APINavigationAction.h:82
> > +    NavigationAction(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, std::optional<WTF::String> targetFrameName, WebCore::ResourceRequest&& request, const WebCore::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction)
> 
> Can't you use a default value instead of making another constructor?
> API::Navigation* mainFrameNavigation = nullptr

Will do.
Comment 10 Brady Eidson 2018-07-19 18:31:19 PDT
(In reply to Brady Eidson from comment #9)
> (In reply to Alex Christensen from comment #6)
> > Comment on attachment 345395 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=345395&action=review
> > 
> > > Source/WebKit/UIProcess/API/APINavigationAction.h:82
> > > +    NavigationAction(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, std::optional<WTF::String> targetFrameName, WebCore::ResourceRequest&& request, const WebCore::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction)
> > 
> > Can't you use a default value instead of making another constructor?
> > API::Navigation* mainFrameNavigation = nullptr
> 
> Will do.

Actually, no, sorry I misunderstood in the moment. I think default values to arguments to function calls are bad. :P
Comment 11 Brady Eidson 2018-07-19 18:43:50 PDT
Created attachment 345416 [details]
Patch
Comment 12 EWS Watchlist 2018-07-19 18:45:26 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 13 EWS Watchlist 2018-07-19 22:34:00 PDT
Comment on attachment 345416 [details]
Patch

Attachment 345416 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8595681

New failing tests:
http/tests/security/contentSecurityPolicy/video-with-https-url-allowed-by-csp-media-src-star.html
Comment 14 EWS Watchlist 2018-07-19 22:34:12 PDT
Created attachment 345428 [details]
Archive of layout-test-results from ews206 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews206  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 15 Brady Eidson 2018-07-19 23:18:08 PDT
Layout test failure is unrelated.
Comment 16 Brady Eidson 2018-07-19 23:32:33 PDT
Bizarre, it claims 32bit mac build broke but the output doesn't say why - the compilation of the file it claims failed isn't actually in the output.

Will build 32-bit locally I guess...  =/
Comment 17 Brady Eidson 2018-07-20 07:39:47 PDT
(In reply to Brady Eidson from comment #16)
> Bizarre, it claims 32bit mac build broke but the output doesn't say why -
> the compilation of the file it claims failed isn't actually in the output.
> 
> Will build 32-bit locally I guess...  =/

I can't even get passed JSC locally with 32 bit.

resubmitting the patch to see if i get more helpful info
Comment 18 Brady Eidson 2018-07-20 07:40:53 PDT
Created attachment 345442 [details]
Patch
Comment 19 Brady Eidson 2018-07-20 09:29:03 PDT
Created attachment 345448 [details]
Patch
Comment 20 WebKit Commit Bot 2018-07-20 10:33:34 PDT
Comment on attachment 345448 [details]
Patch

Clearing flags on attachment: 345448

Committed r234052: <https://trac.webkit.org/changeset/234052>
Comment 21 WebKit Commit Bot 2018-07-20 10:33:36 PDT
All reviewed patches have been landed.  Closing bug.
Comment 22 Radar WebKit Bug Importer 2018-07-20 10:35:18 PDT
<rdar://problem/42435157>