Bug 174945 - Add SPI for returning a modified request in decidePolicyForNavigationAction's decisionHandler
Summary: Add SPI for returning a modified request in decidePolicyForNavigationAction's...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-28 11:18 PDT by Alex Christensen
Modified: 2018-01-02 11:42 PST (History)
6 users (show)

See Also:


Attachments
Patch (77.34 KB, patch)
2017-07-28 11:20 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (79.56 KB, patch)
2017-07-28 13:25 PDT, Alex Christensen
achristensen: review-
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews115 for mac-elcapitan (1.25 MB, application/zip)
2017-07-28 14:40 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2017-07-28 11:18:26 PDT
Add SPI for returning a modified request in decidePolicyForNavigationAction's decisionHandler
Comment 1 Alex Christensen 2017-07-28 11:20:02 PDT
Created attachment 316650 [details]
Patch
Comment 2 Geoffrey Garen 2017-07-28 11:41:04 PDT
/Volumes/Data/EWS/WebKit/Source/WebCore/loader/PolicyChecker.cpp:130:48: error: too few arguments to function call, expected 2, have 1
        continueAfterNavigationPolicy(PolicyUse);
Comment 3 Alex Christensen 2017-07-28 13:25:47 PDT
Created attachment 316673 [details]
Patch
Comment 4 Build Bot 2017-07-28 14:40:30 PDT
Comment on attachment 316673 [details]
Patch

Attachment 316673 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/4204404

Number of test failures exceeded the failure limit.
Comment 5 Build Bot 2017-07-28 14:40:31 PDT
Created attachment 316674 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 6 Darin Adler 2017-07-30 10:16:13 PDT
Comment on attachment 316673 [details]
Patch

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

I did not review the concept but I did review the copying of ResourceRequest objects.

> Source/WebCore/loader/PolicyCallback.h:56
> +    void setRequest(ResourceRequest& newRequest) { m_request = newRequest; }

I think this should either take a ResourceRequest&& and use WTFMove, or it should take a const ResourceRequest& and always copy. Taking a non-const reference and copying does not seem right.

> Source/WebCore/loader/PolicyChecker.cpp:151
> +        continueAfterNavigationPolicy(action, newRequest);

I think that WTFMove here would avoid copying the ResourceRequest.

> Source/WebCore/loader/PolicyChecker.cpp:222
> +                callback.setRequest(*newRequest);

I think that WTFMove here would allow us to avoid copying the entire ResourceRequest.

> Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:834
> +        newRequest = navigationDecision.newRequest;

Using WTFMove here we could avoid copying the ResourceRequest.

> Source/WebKit/WebProcess/WebPage/WebFrame.cpp:256
> +    function(action, newRequest);

Adding WTFMove here would avoid copying the ResourceRequest.
Comment 7 Alex Christensen 2017-07-31 14:20:26 PDT
Comment on attachment 316673 [details]
Patch

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

>> Source/WebCore/loader/PolicyCallback.h:56
>> +    void setRequest(ResourceRequest& newRequest) { m_request = newRequest; }
> 
> I think this should either take a ResourceRequest&& and use WTFMove, or it should take a const ResourceRequest& and always copy. Taking a non-const reference and copying does not seem right.

I think PolicyCallback should be removed and replaced by WTF::Function and lambdas, but not in this patch.
Comment 8 Alex Christensen 2017-12-11 17:32:11 PST
We're not needing this any more