Bug 185550 - Add referrerpolicy attribute support for <script> elements
Summary: Add referrerpolicy attribute support for <script> elements
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 11
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
Depends on: 179053
Blocks:
  Show dependency treegraph
 
Reported: 2018-05-11 10:10 PDT by Dominic Farolino
Modified: 2019-07-17 02:04 PDT (History)
9 users (show)

See Also:


Attachments
Patch (11.58 KB, patch)
2019-05-28 01:15 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (21.70 KB, patch)
2019-05-28 09:22 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-highsierra (3.31 MB, application/zip)
2019-05-28 10:24 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-highsierra-wk2 (2.79 MB, application/zip)
2019-05-28 10:34 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews115 for mac-highsierra (1.54 MB, application/zip)
2019-05-28 10:46 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews215 for win-future (13.48 MB, application/zip)
2019-05-28 11:13 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews121 for ios-simulator-wk2 (2.95 MB, application/zip)
2019-05-28 12:08 PDT, Build Bot
no flags Details
Patch (20.34 KB, patch)
2019-05-28 23:57 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (20.37 KB, patch)
2019-05-29 01:17 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (81.56 KB, patch)
2019-05-29 12:02 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (82.08 KB, patch)
2019-05-29 13:13 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-highsierra (3.13 MB, application/zip)
2019-05-29 14:29 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews106 for mac-highsierra-wk2 (2.75 MB, application/zip)
2019-05-29 14:44 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-wk2 (2.57 MB, application/zip)
2019-05-29 15:19 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews214 for win-future (13.85 MB, application/zip)
2019-05-29 15:49 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews116 for mac-highsierra (2.92 MB, application/zip)
2019-05-29 21:11 PDT, Build Bot
no flags Details
Patch (82.17 KB, patch)
2019-05-30 01:00 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-highsierra (3.11 MB, application/zip)
2019-05-30 02:16 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews116 for mac-highsierra (2.92 MB, application/zip)
2019-05-30 02:57 PDT, Build Bot
no flags Details
Patch (78.90 KB, patch)
2019-05-30 03:25 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews214 for win-future (13.53 MB, application/zip)
2019-05-30 05:31 PDT, Build Bot
no flags Details
Patch (74.21 KB, patch)
2019-05-30 06:34 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (79.60 KB, patch)
2019-07-16 02:10 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (79.53 KB, patch)
2019-07-16 04:32 PDT, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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 Build Bot 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>