RESOLVED FIXED 210407
Remove addExtraFieldsToSubresourceRequest
https://bugs.webkit.org/show_bug.cgi?id=210407
Summary Remove addExtraFieldsToSubresourceRequest
Rob Buis
Reported 2020-04-12 10:45:43 PDT
Remove addExtraFieldsToSubresourceRequest since it can be replaced by calling addExtraFieldsToRequest. The loadType parameter is not taken into account by defaultRequestCachingPolicy so FrameLoadType::Standard rather than m_loadType is passed.
Attachments
Patch (6.83 KB, patch)
2020-04-12 10:47 PDT, Rob Buis
no flags
Patch (11.04 KB, patch)
2020-04-12 14:21 PDT, Rob Buis
no flags
Patch (11.15 KB, patch)
2020-04-12 23:55 PDT, Rob Buis
no flags
Rob Buis
Comment 1 2020-04-12 10:47:41 PDT
Darin Adler
Comment 2 2020-04-12 12:55:10 PDT
Comment on attachment 396231 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396231&action=review > Source/WebCore/ChangeLog:11 > + Remove addExtraFieldsToSubresourceRequest since it can be replaced by > + calling addExtraFieldsToRequest. The loadType parameter is not taken > + into account by defaultRequestCachingPolicy so FrameLoadType::Standard > + rather than m_loadType is passed. I’m not completely comfortable with passing a "wrong" load type, knowing that the load type doesn’t matter. Is there some better way to resolve this. > Source/WebCore/loader/FrameLoader.cpp:3059 > + addExtraFieldsToRequest(initialRequest, FrameLoadType::Standard, false); I’m not thrilled with spreading more mysterious "false" arguments in even more places in the code.
Rob Buis
Comment 3 2020-04-12 14:20:37 PDT
Comment on attachment 396231 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396231&action=review >> Source/WebCore/ChangeLog:11 >> + rather than m_loadType is passed. > > I’m not completely comfortable with passing a "wrong" load type, knowing that the load type doesn’t matter. Is there some better way to resolve this. I gave the LoadType parameter a default value so addExtraFieldsToRequest calls for subresources do not need to specify anything for it. >> Source/WebCore/loader/FrameLoader.cpp:3059 >> + addExtraFieldsToRequest(initialRequest, FrameLoadType::Standard, false); > > I’m not thrilled with spreading more mysterious "false" arguments in even more places in the code. Fair enough, I added an enum
Rob Buis
Comment 4 2020-04-12 14:21:16 PDT
Darin Adler
Comment 5 2020-04-12 14:30:43 PDT
Comment on attachment 396239 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396239&action=review OK > Source/WebCore/loader/FrameLoader.h:94 > +enum class MainResource : bool { Yes, No }; I think the name should be either ForMainResource or IsMainResource. A type named MainResource sounds more like a resource than an indicator of the nature of a resource. Also, I suggest { No, Yes } so we have the traditional representation of 0 for false and 1 for true. > Source/WebCore/loader/FrameLoader.h:332 > + void addExtraFieldsToRequest(ResourceRequest&, MainResource, FrameLoadType = FrameLoadType::Standard); How should a caller know when it’s important to pass in a load type, and when it’s not important?
Rob Buis
Comment 6 2020-04-12 23:55:07 PDT
Rob Buis
Comment 7 2020-04-13 00:39:45 PDT
Comment on attachment 396239 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396239&action=review >> Source/WebCore/loader/FrameLoader.h:94 >> +enum class MainResource : bool { Yes, No }; > > I think the name should be either ForMainResource or IsMainResource. A type named MainResource sounds more like a resource than an indicator of the nature of a resource. > > Also, I suggest { No, Yes } so we have the traditional representation of 0 for false and 1 for true. That is better indeed, fixed. >> Source/WebCore/loader/FrameLoader.h:332 >> + void addExtraFieldsToRequest(ResourceRequest&, MainResource, FrameLoadType = FrameLoadType::Standard); > > How should a caller know when it’s important to pass in a load type, and when it’s not important? It is hard to make it clear but I added a comment for it.
EWS
Comment 8 2020-04-13 01:04:43 PDT
Committed r259997: <https://trac.webkit.org/changeset/259997> All reviewed patches have been landed. Closing bug and clearing flags on attachment 396259 [details].
Radar WebKit Bug Importer
Comment 9 2020-04-13 01:05:14 PDT
Note You need to log in before you can comment on or make changes to this bug.