RESOLVED FIXED 213342
Add referrerpolicy attribute support for <link>
https://bugs.webkit.org/show_bug.cgi?id=213342
Summary Add referrerpolicy attribute support for <link>
Rob Buis
Reported 2020-06-18 09:03:07 PDT
Add referrerpolicy attribute support for <link>
Attachments
Patch (18.92 KB, patch)
2020-06-18 09:09 PDT, Rob Buis
no flags
Patch (19.69 KB, patch)
2020-06-18 12:07 PDT, Rob Buis
no flags
Patch (23.59 KB, patch)
2020-06-19 04:54 PDT, Rob Buis
no flags
Patch (24.32 KB, patch)
2020-06-19 04:57 PDT, Rob Buis
no flags
Patch (23.37 KB, patch)
2020-06-19 06:50 PDT, Rob Buis
no flags
Patch (24.32 KB, patch)
2020-06-19 07:38 PDT, Rob Buis
no flags
Patch (24.35 KB, patch)
2020-06-22 08:40 PDT, Rob Buis
no flags
Patch (1.21 KB, patch)
2020-06-23 13:15 PDT, Rob Buis
no flags
Rob Buis
Comment 1 2020-06-18 09:09:12 PDT
EWS Watchlist
Comment 2 2020-06-18 09:09:59 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Rob Buis
Comment 3 2020-06-18 12:07:46 PDT
Rob Buis
Comment 4 2020-06-19 04:54:30 PDT
Rob Buis
Comment 5 2020-06-19 04:57:51 PDT
Rob Buis
Comment 6 2020-06-19 06:50:34 PDT
Rob Buis
Comment 7 2020-06-19 07:38:36 PDT
Darin Adler
Comment 8 2020-06-21 13:32:23 PDT
Comment on attachment 402282 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=402282&action=review > Source/WebCore/html/parser/HTMLPreloadScanner.cpp:290 > + else if (match(attributeName, referrerpolicyAttr)) { > + m_referrerPolicy = parseReferrerPolicy(attributeValue, ReferrerPolicySource::ReferrerPolicyAttribute).valueOr(ReferrerPolicy::EmptyString); > + break; > + } Doesn't seem necessary to include "break" here. The ones above don’t, and there is a break after the chained if/else statements. That would also allow us to omit the braces and this would fit in better with the lines above. > Source/WebCore/loader/LinkLoader.h:57 > + ReferrerPolicy referrerPolicy; Should we set a default here of ReferrerPolicy::EmptyString? The other members have defaults, except for relAttribute. Generally seems good to not risk this ever being uninitialized. And maybe we can even omit this in some places if it has a default? > LayoutTests/TestExpectations:244 > -imported/w3c/web-platform-tests/referrer-policy [ Skip ] > +imported/w3c/web-platform-tests/referrer-policy/origin [ Skip ] Sure could use a comment.
Rob Buis
Comment 9 2020-06-22 08:40:05 PDT
Rob Buis
Comment 10 2020-06-22 09:56:01 PDT
Comment on attachment 402282 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=402282&action=review >> Source/WebCore/html/parser/HTMLPreloadScanner.cpp:290 >> + } > > Doesn't seem necessary to include "break" here. The ones above don’t, and there is a break after the chained if/else statements. That would also allow us to omit the braces and this would fit in better with the lines above. You are right, I probably had debug statement there while developing the patch and forgot to remove the break and braces. Fixed. >> Source/WebCore/loader/LinkLoader.h:57 >> + ReferrerPolicy referrerPolicy; > > Should we set a default here of ReferrerPolicy::EmptyString? The other members have defaults, except for relAttribute. Generally seems good to not risk this ever being uninitialized. And maybe we can even omit this in some places if it has a default? I think it gets the EmptyString value by default. >> LayoutTests/TestExpectations:244 >> +imported/w3c/web-platform-tests/referrer-policy/origin [ Skip ] > > Sure could use a comment. Yeah I am very familiar with this problem but indeed others may not be. Fixed.
EWS
Comment 11 2020-06-22 10:20:55 PDT
Committed r263356: <https://trac.webkit.org/changeset/263356> All reviewed patches have been landed. Closing bug and clearing flags on attachment 402478 [details].
Radar WebKit Bug Importer
Comment 12 2020-06-22 10:21:16 PDT
Darin Adler
Comment 13 2020-06-22 12:19:32 PDT
Comment on attachment 402282 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=402282&action=review >>> Source/WebCore/loader/LinkLoader.h:57 >>> + ReferrerPolicy referrerPolicy; >> >> Should we set a default here of ReferrerPolicy::EmptyString? The other members have defaults, except for relAttribute. Generally seems good to not risk this ever being uninitialized. And maybe we can even omit this in some places if it has a default? > > I think it gets the EmptyString value by default. I don’t think it does. As I understand it, if it’s a scalar, it won’t have a default value unless we specify one.
Rob Buis
Comment 14 2020-06-23 13:15:06 PDT
Reopening to attach new patch.
Rob Buis
Comment 15 2020-06-23 13:15:12 PDT
Rob Buis
Comment 16 2020-06-23 14:31:48 PDT
Comment on attachment 402282 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=402282&action=review >>> Source/WebCore/html/parser/HTMLPreloadScanner.cpp:290 >>> + } >> >> Doesn't seem necessary to include "break" here. The ones above don’t, and there is a break after the chained if/else statements. That would also allow us to omit the braces and this would fit in better with the lines above. > > You are right, I probably had debug statement there while developing the patch and forgot to remove the break and braces. Fixed. I am still not 100% sure, but initializing can do no harm, so I made the patch.
Darin Adler
Comment 17 2020-06-23 14:36:56 PDT
Comment on attachment 402584 [details] Patch Could also initialize relAttribute for the same reason.
Rob Buis
Comment 18 2020-06-24 00:32:17 PDT
(In reply to Darin Adler from comment #17) > Comment on attachment 402584 [details] > Patch > > Could also initialize relAttribute for the same reason. I believe in the relAttribute the default ctor will be called since LinkRelAttribute is non POD.
EWS
Comment 19 2020-06-24 00:38:04 PDT
Committed r263442: <https://trac.webkit.org/changeset/263442> All reviewed patches have been landed. Closing bug and clearing flags on attachment 402584 [details].
Darin Adler
Comment 20 2020-06-24 10:49:59 PDT
(In reply to Rob Buis from comment #18) > I believe in the relAttribute the default ctor will be called since > LinkRelAttribute is non POD. Oh, OK, great.
Note You need to log in before you can comment on or make changes to this bug.