RESOLVED FIXED Bug 236167
[Cocoa] Always sync ResourceRequest isAppInitiated request with NSURLRequest attribution value
https://bugs.webkit.org/show_bug.cgi?id=236167
Summary [Cocoa] Always sync ResourceRequest isAppInitiated request with NSURLRequest ...
Brent Fulgham
Reported 2022-02-04 16:39:11 PST
As noticed in Bug 236111, we should always keep the state of our 'isAppInitiated' flag in sync with the underlying NSURLRequest object.
Attachments
Patch (4.00 KB, patch)
2022-02-04 18:41 PST, Brent Fulgham
no flags
Patch for landing (11.77 KB, patch)
2022-02-07 17:15 PST, Brent Fulgham
no flags
Brent Fulgham
Comment 1 2022-02-04 16:44:44 PST
Brent Fulgham
Comment 2 2022-02-04 18:41:48 PST
Darin Adler
Comment 3 2022-02-06 17:01:04 PST
Comment on attachment 450962 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=450962&action=review Can we make a regression test to show what this fixes? > Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:45 > + : ResourceRequestBase() Is this explicit initialization of the base class required? I suggest we try removing this; I believe it will still compile and generate the same code without it. > Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:301 > + nsRequest.get().attribution = request.attribution; Why use the setAttribution: syntax above, but the assignment syntax here? I would like ie better if it was consistent. I suggest we use the assignment syntax in all three places.
Brent Fulgham
Comment 4 2022-02-07 16:04:46 PST
Comment on attachment 450962 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=450962&action=review >> Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:301 >> + nsRequest.get().attribution = request.attribution; > > Why use the setAttribution: syntax above, but the assignment syntax here? I would like ie better if it was consistent. I suggest we use the assignment syntax in all three places. For some reason, the above initializations of nsRequest from 'adoptNS([m_nsRequest mutableCopy])' were computed as 'RetainPtr<id>'. The method call syntax compiled without errors, so I just used that. If I specify that the adoptNS is assigned to a RetainPtr<NSMutableURLRequest> the assignment syntax works. I could also just cast the result of 'nsRequest.get()', but that seems a little gross. I prefer the "RetainPtr<NSMutableRequest> nsRequest = adoptNS(...)". Do you have a preference?
Brent Fulgham
Comment 5 2022-02-07 17:15:56 PST
Created attachment 451179 [details] Patch for landing
Darin Adler
Comment 6 2022-02-07 17:50:01 PST
Comment on attachment 451179 [details] Patch for landing I think it’s good the way you wrote it. I am not so surprised that the compiler doesn't know the type of the result of mutableCopy. It doesn’t use (instancetype) or any trick like that, so it’s just a method that returns an id.
EWS
Comment 7 2022-02-07 18:06:17 PST
Committed r289255 (246939@main): <https://commits.webkit.org/246939@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 451179 [details].
Note You need to log in before you can comment on or make changes to this bug.