WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
234015
Propagate app-initiated state to new ResourceRequests
https://bugs.webkit.org/show_bug.cgi?id=234015
Summary
Propagate app-initiated state to new ResourceRequests
Brent Fulgham
Reported
2021-12-08 10:12:38 PST
While reviewing logging we have found that some ResourceRequest objects are missing the correct state for app-initiated loads. Typically, these are cases where a new ResourceRequest is created from a URL string, losing the context that came with the original load (or the context of the page triggering the load). This patch corrects a number of such cases.
Attachments
WIP Patch
(16.41 KB, patch)
2021-12-08 10:17 PST
,
Brent Fulgham
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(17.85 KB, patch)
2021-12-08 11:18 PST
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
WIP Patch
(33.63 KB, patch)
2021-12-20 17:55 PST
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
Patch
(33.63 KB, patch)
2021-12-21 10:28 PST
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
Patch
(36.70 KB, patch)
2021-12-21 12:31 PST
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
Patch
(31.98 KB, patch)
2021-12-21 16:22 PST
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Brent Fulgham
Comment 1
2021-12-08 10:14:55 PST
<
rdar://problem/86128638
>
Brent Fulgham
Comment 2
2021-12-08 10:17:39 PST
Created
attachment 446382
[details]
WIP Patch
Kate Cheney
Comment 3
2021-12-08 10:48:35 PST
Comment on
attachment 446382
[details]
WIP Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=446382&action=review
Thanks for covering these cases. r=me with gtk/wpe/wincairo/win fixes.
> Source/WebCore/Modules/websockets/WebSocketChannel.cpp:97 > + if (auto* documentLoader = m_document->loader())
Seems like you may need to #include DocumentLoader.h here for GTK and WPE.
> Source/WebCore/loader/FrameLoader.cpp:3058 > + workingResourceRequest.setIsAppInitiated(inRequest.isAppInitiated());
We set this in updateRequestAndAddExtraFields which is called below, so no need to do it here.
Brent Fulgham
Comment 4
2021-12-08 11:17:29 PST
Comment on
attachment 446382
[details]
WIP Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=446382&action=review
>> Source/WebCore/Modules/websockets/WebSocketChannel.cpp:97 >> + if (auto* documentLoader = m_document->loader()) > > Seems like you may need to #include DocumentLoader.h here for GTK and WPE.
Will do!
>> Source/WebCore/loader/FrameLoader.cpp:3058 >> + workingResourceRequest.setIsAppInitiated(inRequest.isAppInitiated()); > > We set this in updateRequestAndAddExtraFields which is called below, so no need to do it here.
Ah! Good catch. Will remove.
Brent Fulgham
Comment 5
2021-12-08 11:18:19 PST
Created
attachment 446391
[details]
Patch
Brent Fulgham
Comment 6
2021-12-20 17:55:52 PST
Created
attachment 447671
[details]
WIP Patch
Brent Fulgham
Comment 7
2021-12-20 17:56:35 PST
Comment on
attachment 447671
[details]
WIP Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447671&action=review
> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:239 > + WTFReportBacktraceWithPrefix("WebLoaderStrategy");
This debugging code should not be landed.
Brent Fulgham
Comment 8
2021-12-21 10:28:52 PST
Created
attachment 447731
[details]
Patch
Kate Cheney
Comment 9
2021-12-21 10:45:01 PST
Comment on
attachment 447731
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447731&action=review
One thing to note is only the main frame's document loader holds the correct value, so there may be some places where we need to check that value instead of the current document's loader.
> Source/WebCore/loader/FrameLoader.cpp:978 > + frameLoadRequest.resourceRequest().setIsAppInitiated(*appInitiated);
I think this one is unnecessary because loadURL() called below will call updateRequestAndAddExtraFields which will set the value.
> Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:50 > + encoder << m_isAppInitiated;
Good catch.
Kate Cheney
Comment 10
2021-12-21 11:05:06 PST
Comment on
attachment 447731
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447731&action=review
> Source/WebCore/loader/NavigationScheduler.cpp:198 > + resourceRequest.setIsAppInitiated(documentLoader->lastNavigationWasAppInitiated());
I think this will also always end up in a frame loader function that calls updateRequestAndAddExtraFields, so it is not needed.
> Source/WebCore/loader/NavigationScheduler.cpp:232 > + resourceRequest.setIsAppInitiated(documentLoader->lastNavigationWasAppInitiated());
Ditto
> Source/WebCore/loader/NavigationScheduler.cpp:261 > + resourceRequest.setIsAppInitiated(documentLoader->lastNavigationWasAppInitiated());
Ditto.
> Source/WebCore/loader/NavigationScheduler.cpp:378 > + resourceRequest.setIsAppInitiated(documentLoader->lastNavigationWasAppInitiated());
Ditto.
> Source/WebCore/loader/NavigationScheduler.cpp:482 > + resourceRequest.setIsAppInitiated(documentLoader->lastNavigationWasAppInitiated());
Ditto.
> Source/WebCore/page/DOMWindow.cpp:2545 > + resourceRequest.setIsAppInitiated(documentLoader->lastNavigationWasAppInitiated());
Ditto here. changeLocation calls loadFrameRequest which calls loadURL or loadPostRequest which will both eventually call updateRequestAndAddExtraFields.
> Source/WebCore/page/DragController.cpp:300 > + resourceRequest.setIsAppInitiated(documentLoader->lastNavigationWasAppInitiated());
Here too.
Brent Fulgham
Comment 11
2021-12-21 12:31:13 PST
Created
attachment 447742
[details]
Patch
Brent Fulgham
Comment 12
2021-12-21 16:22:58 PST
Created
attachment 447763
[details]
Patch
EWS
Comment 13
2021-12-21 22:37:27 PST
Committed
r287348
(
245490@main
): <
https://commits.webkit.org/245490@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 447763
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug