Bug 185550

Summary: Add referrerpolicy attribute support for <script> elements
Product: WebKit Reporter: Dominic Farolino <domfarolino>
Component: DOMAssignee: Rob Buis <rbuis>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, cdumez, commit-queue, dbates, ews-watchlist, rbuis, rniwa, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 11   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 179053    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Archive of layout-test-results from ews101 for mac-highsierra
none
Archive of layout-test-results from ews105 for mac-highsierra-wk2
none
Archive of layout-test-results from ews115 for mac-highsierra
none
Archive of layout-test-results from ews215 for win-future
none
Archive of layout-test-results from ews121 for ios-simulator-wk2
none
Patch
none
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ews101 for mac-highsierra
none
Archive of layout-test-results from ews106 for mac-highsierra-wk2
none
Archive of layout-test-results from ews123 for ios-simulator-wk2
none
Archive of layout-test-results from ews214 for win-future
none
Archive of layout-test-results from ews116 for mac-highsierra
none
Patch
none
Archive of layout-test-results from ews100 for mac-highsierra
none
Archive of layout-test-results from ews116 for mac-highsierra
none
Patch
none
Archive of layout-test-results from ews214 for win-future
none
Patch
none
Patch
none
Patch none

Description Dominic Farolino 2018-05-11 10:10:07 PDT
The HTML Standard PR [1] is adding support for the referrerpolicy attribute on <script> elements. Check the PR for a link to the relevant WPTs (which atm, I have not yet started).

[1]: https://github.com/whatwg/html/pull/3678
Comment 1 Rob Buis 2019-05-28 01:15:18 PDT
Created attachment 370716 [details]
Patch
Comment 2 Rob Buis 2019-05-28 09:22:19 PDT
Created attachment 370751 [details]
Patch
Comment 3 EWS Watchlist 2019-05-28 10:24:32 PDT
Comment on attachment 370751 [details]
Patch

Attachment 370751 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/12309031

Number of test failures exceeded the failure limit.
Comment 4 EWS Watchlist 2019-05-28 10:24:33 PDT
Created attachment 370759 [details]
Archive of layout-test-results from ews101 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 5 EWS Watchlist 2019-05-28 10:34:04 PDT
Comment on attachment 370751 [details]
Patch

Attachment 370751 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/12309057

Number of test failures exceeded the failure limit.
Comment 6 EWS Watchlist 2019-05-28 10:34:05 PDT
Created attachment 370761 [details]
Archive of layout-test-results from ews105 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 7 EWS Watchlist 2019-05-28 10:46:55 PDT
Comment on attachment 370751 [details]
Patch

Attachment 370751 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/12309032

Number of test failures exceeded the failure limit.
Comment 8 EWS Watchlist 2019-05-28 10:46:57 PDT
Created attachment 370765 [details]
Archive of layout-test-results from ews115 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 9 EWS Watchlist 2019-05-28 11:13:21 PDT
Comment on attachment 370751 [details]
Patch

Attachment 370751 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/12309335

Number of test failures exceeded the failure limit.
Comment 10 EWS Watchlist 2019-05-28 11:13:29 PDT
Created attachment 370768 [details]
Archive of layout-test-results from ews215 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews215  Port: win-future  Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Comment 11 EWS Watchlist 2019-05-28 12:08:48 PDT
Comment on attachment 370751 [details]
Patch

Attachment 370751 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/12309772

Number of test failures exceeded the failure limit.
Comment 12 EWS Watchlist 2019-05-28 12:08:49 PDT
Created attachment 370772 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.14.5
Comment 13 Rob Buis 2019-05-28 23:57:22 PDT
Created attachment 370833 [details]
Patch
Comment 14 Rob Buis 2019-05-29 01:17:50 PDT
Created attachment 370835 [details]
Patch
Comment 15 Rob Buis 2019-05-29 12:02:52 PDT
Created attachment 370870 [details]
Patch
Comment 16 Rob Buis 2019-05-29 13:13:37 PDT
Created attachment 370878 [details]
Patch
Comment 17 EWS Watchlist 2019-05-29 14:29:14 PDT
Comment on attachment 370878 [details]
Patch

Attachment 370878 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/12321257

New failing tests:
http/tests/referrer-policy-script/origin/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/no-referrer-when-downgrade/cross-origin-http.https.html
http/tests/referrer-policy-script/same-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/unsafe-url/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin-when-cross-origin/cross-origin-http.https.html
Comment 18 EWS Watchlist 2019-05-29 14:29:16 PDT
Created attachment 370884 [details]
Archive of layout-test-results from ews101 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 19 EWS Watchlist 2019-05-29 14:44:10 PDT
Comment on attachment 370878 [details]
Patch

Attachment 370878 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/12321279

New failing tests:
http/tests/referrer-policy-script/same-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/origin/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin/cross-origin-http.https.html
Comment 20 EWS Watchlist 2019-05-29 14:44:11 PDT
Created attachment 370886 [details]
Archive of layout-test-results from ews106 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 21 EWS Watchlist 2019-05-29 15:19:00 PDT
Comment on attachment 370878 [details]
Patch

Attachment 370878 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/12321345

New failing tests:
http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/no-referrer-when-downgrade/cross-origin-http.https.html
http/tests/referrer-policy-script/origin/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin/cross-origin-http.https.html
Comment 22 EWS Watchlist 2019-05-29 15:19:02 PDT
Created attachment 370889 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.14.5
Comment 23 EWS Watchlist 2019-05-29 15:49:27 PDT
Comment on attachment 370878 [details]
Patch

Attachment 370878 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/12321635

New failing tests:
http/tests/referrer-policy-script/origin/same-origin.html
http/tests/referrer-policy-script/no-referrer/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin-when-cross-origin/cross-origin-http-http.html
http/tests/referrer-policy-script/origin/cross-origin-http-http.html
http/tests/referrer-policy-script/origin/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin/same-origin.html
http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http-http.html
http/tests/referrer-policy-script/no-referrer-when-downgrade/cross-origin-http.https.html
http/tests/referrer-policy-script/same-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/no-referrer/cross-origin-http-http.html
http/tests/referrer-policy-script/strict-origin/cross-origin-http-http.html
http/tests/referrer-policy-script/unsafe-url/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin-when-cross-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http.https.html
Comment 24 EWS Watchlist 2019-05-29 15:49:29 PDT
Created attachment 370892 [details]
Archive of layout-test-results from ews214 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews214  Port: win-future  Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Comment 25 EWS Watchlist 2019-05-29 21:11:16 PDT
Comment on attachment 370878 [details]
Patch

Attachment 370878 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/12324173

New failing tests:
http/tests/referrer-policy-script/origin/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/same-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/unsafe-url/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin-when-cross-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http.https.html
Comment 26 EWS Watchlist 2019-05-29 21:11:18 PDT
Created attachment 370918 [details]
Archive of layout-test-results from ews116 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 27 Rob Buis 2019-05-30 01:00:16 PDT
Created attachment 370926 [details]
Patch
Comment 28 EWS Watchlist 2019-05-30 02:16:08 PDT
Comment on attachment 370926 [details]
Patch

Attachment 370926 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/12326139

New failing tests:
http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/origin/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin/cross-origin-http.https.html
Comment 29 EWS Watchlist 2019-05-30 02:16:10 PDT
Created attachment 370928 [details]
Archive of layout-test-results from ews100 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 30 EWS Watchlist 2019-05-30 02:57:28 PDT
Comment on attachment 370926 [details]
Patch

Attachment 370926 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/12326214

New failing tests:
http/tests/referrer-policy-script/same-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http.https.html
http/tests/referrer-policy-script/origin/cross-origin-http.https.html
http/tests/referrer-policy-script/strict-origin/cross-origin-http.https.html
Comment 31 EWS Watchlist 2019-05-30 02:57:30 PDT
Created attachment 370931 [details]
Archive of layout-test-results from ews116 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 32 Rob Buis 2019-05-30 03:25:53 PDT
Created attachment 370933 [details]
Patch
Comment 33 EWS Watchlist 2019-05-30 05:31:35 PDT
Comment on attachment 370933 [details]
Patch

Attachment 370933 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/12327053

New failing tests:
http/tests/referrer-policy-script/origin/same-origin.html
http/tests/referrer-policy-script/strict-origin-when-cross-origin/cross-origin-http-http.html
http/tests/referrer-policy-script/origin/cross-origin-http-http.html
http/tests/referrer-policy-script/strict-origin/same-origin.html
http/tests/referrer-policy-script/same-origin/cross-origin-http-http.html
http/tests/referrer-policy-script/no-referrer/cross-origin-http-http.html
http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http-http.html
http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http.https.html
Comment 34 EWS Watchlist 2019-05-30 05:31:37 PDT
Created attachment 370936 [details]
Archive of layout-test-results from ews214 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews214  Port: win-future  Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Comment 35 Rob Buis 2019-05-30 06:34:51 PDT
Created attachment 370939 [details]
Patch
Comment 36 youenn fablet 2019-07-15 08:57:55 PDT
Comment on attachment 370939 [details]
Patch

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

> Source/WebCore/ChangeLog:36
> +               http/tests/referrer-policy-script/unsafe-url/same-origin.html

Nice to have all these tests. I guess I should finish the reimport of WPT referrer policy tests.
I wonder whether some of these might be redundant though or would be worth exporting to WPT.

> Source/WebCore/bindings/js/CachedScriptFetcher.h:45
> +    CachedScriptFetcher(const String& nonce, const ReferrerPolicy& referrerPolicy, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree)

s/const ReferrerPolicy& policy/ReferrerPolicy

> Source/WebCore/dom/LoadableClassicScript.cpp:38
> +Ref<LoadableClassicScript> LoadableClassicScript::create(const String& nonce, const String& integrityMetadata, const ReferrerPolicy& policy, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree)

Ditto, below as well

> LayoutTests/platform/win/TestExpectations:4299
> +webkit.org/b/195461 http/tests/referrer-policy-script [ Skip ]

Do we know why they are failing here?
I would have thought they would be similar to Mac-wk1.
Comment 37 Rob Buis 2019-07-16 02:10:57 PDT
Created attachment 374201 [details]
Patch
Comment 38 Rob Buis 2019-07-16 04:32:58 PDT
Created attachment 374204 [details]
Patch
Comment 39 Rob Buis 2019-07-16 11:46:37 PDT
Comment on attachment 370939 [details]
Patch

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

>> Source/WebCore/ChangeLog:36
>> +               http/tests/referrer-policy-script/unsafe-url/same-origin.html
> 
> Nice to have all these tests. I guess I should finish the reimport of WPT referrer policy tests.
> I wonder whether some of these might be redundant though or would be worth exporting to WPT.

It would be great to have the WPT referrer policy tests imported and working.
I think the http/tests/referrer-policy-script tests can be removed once that is done, since the WPT tests are even more in depth (same/cross origin, redirects etc.)

>> Source/WebCore/bindings/js/CachedScriptFetcher.h:45
>> +    CachedScriptFetcher(const String& nonce, const ReferrerPolicy& referrerPolicy, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree)
> 
> s/const ReferrerPolicy& policy/ReferrerPolicy

I did this substitution everywhere in the patch.

>> Source/WebCore/dom/LoadableClassicScript.cpp:38
>> +Ref<LoadableClassicScript> LoadableClassicScript::create(const String& nonce, const String& integrityMetadata, const ReferrerPolicy& policy, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree)
> 
> Ditto, below as well

I did this substitution everywhere in the patch.

>> LayoutTests/platform/win/TestExpectations:4299
>> +webkit.org/b/195461 http/tests/referrer-policy-script [ Skip ]
> 
> Do we know why they are failing here?
> I would have thought they would be similar to Mac-wk1.

I think I read some bug report stating a lot of loading test started failing on win after some "framework" was removed or updated, but I can't find that bug.
Comment 40 WebKit Commit Bot 2019-07-17 02:03:43 PDT
Comment on attachment 374204 [details]
Patch

Clearing flags on attachment: 374204

Committed r247509: <https://trac.webkit.org/changeset/247509>
Comment 41 WebKit Commit Bot 2019-07-17 02:03:46 PDT
All reviewed patches have been landed.  Closing bug.
Comment 42 Radar WebKit Bug Importer 2019-07-17 02:04:35 PDT
<rdar://problem/53193901>