Log Message
Cherry-pick r227612. rdar://problem/36873390
Modified Paths
- branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog
- branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt
- branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https.html
- branches/safari-605-branch/Source/WebCore/ChangeLog
- branches/safari-605-branch/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp
- branches/safari-605-branch/Source/WebCore/bindings/js/CachedScriptFetcher.cpp
- branches/safari-605-branch/Source/WebCore/bindings/js/CachedScriptFetcher.h
- branches/safari-605-branch/Source/WebCore/dom/LoadableClassicScript.cpp
- branches/safari-605-branch/Source/WebCore/dom/ScriptElementCachedScriptFetcher.cpp
- branches/safari-605-branch/Source/WebCore/dom/ScriptElementCachedScriptFetcher.h
- branches/safari-605-branch/Source/WebCore/html/HTMLLinkElement.cpp
Diff
Modified: branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog (227662 => 227663)
--- branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog 2018-01-26 05:03:25 UTC (rev 227663)
@@ -1,5 +1,19 @@
2018-01-25 Jason Marcell <[email protected]>
+ Cherry-pick r227612. rdar://problem/36873390
+
+ 2018-01-25 Youenn Fablet <[email protected]>
+
+ Set integrity fetch options for loading scripts and CSS
+ https://bugs.webkit.org/show_bug.cgi?id=182077
+
+ Reviewed by Chris Dumez.
+
+ * web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt:
+ * web-platform-tests/service-workers/service-worker/fetch-request-resources.https.html:
+
+2018-01-25 Jason Marcell <[email protected]>
+
Cherry-pick r227578. rdar://problem/36873356
2018-01-24 Chris Dumez <[email protected]>
Modified: branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt (227662 => 227663)
--- branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt 2018-01-26 05:03:25 UTC (rev 227663)
@@ -1,19 +1,59 @@
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+PASS Verify FetchEvent for resources.
+PASS Image load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test1 cross_origin:)
+PASS Image load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test2 cross_origin:)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test3 cross_origin:)
+PASS CSS load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test4 cross_origin:)
+PASS Image load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test5 cross_origin:anonymous)
+PASS Image load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test6 cross_origin:use-credentials)
+PASS Image load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test7 cross_origin:)
+PASS Image load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test8 cross_origin:anonymous)
+PASS Image load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test9 cross_origin:use-credentials)
+PASS Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test10 cross_origin:)
+PASS Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test11 cross_origin:anonymous)
+PASS Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test12 cross_origin:use-credentials)
+PASS Script load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test13 cross_origin:)
+PASS Script load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test14 cross_origin:anonymous)
+PASS Script load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test15 cross_origin:use-credentials)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test16 cross_origin:)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test17 cross_origin:anonymous)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test18 cross_origin:use-credentials)
+PASS CSS load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test19 cross_origin:)
+PASS CSS load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test20 cross_origin:anonymous)
+PASS CSS load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test21 cross_origin:use-credentials)
+FAIL FontFace load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test22) assert_equals: mode of FontFace load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test22) must be cors. expected "cors" but got "no-cors"
+FAIL FontFace load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test23) assert_equals: mode of FontFace load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test23) must be cors. expected "cors" but got "no-cors"
+PASS Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test24)
+PASS Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test25)
+PASS Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test26)
+PASS Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test27)
+PASS Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test28)
+PASS Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test29)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test30)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test31)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test32)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test33)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test34)
+PASS CSS load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test35)
+PASS fetch (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test36 mode:same-origin credentials:omit)
+PASS fetch (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test37 mode:same-origin credentials:same-origin)
+PASS fetch (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test38 mode:same-origin credentials:include)
+PASS fetch (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test39 mode:no-cors credentials:omit)
+PASS fetch (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test40 mode:no-cors credentials:same-origin)
+PASS fetch (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test41 mode:no-cors credentials:include)
+PASS fetch (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test42 mode:cors credentials:omit)
+PASS fetch (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test43 mode:cors credentials:same-origin)
+PASS fetch (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test44 mode:cors credentials:include)
+PASS fetch (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test45 mode:no-cors credentials:omit)
+PASS fetch (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test46 mode:no-cors credentials:same-origin)
+PASS fetch (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test47 mode:no-cors credentials:include)
+PASS fetch (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test48 mode:cors credentials:omit)
+PASS fetch (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test49 mode:cors credentials:same-origin)
+PASS fetch (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test50 mode:cors credentials:include)
+PASS Audio load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test51 cross_origin:)
+PASS Audio load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test52 cross_origin:anonymous)
+PASS Audio load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test53 cross_origin:use-credentials)
+PASS Audio load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test54 cross_origin:)
+PASS Audio load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test55 cross_origin:anonymous)
+PASS Audio load (url:https://127.0.0.1:9443/service-workers/service-worker/resources/dummy?test56 cross_origin:use-credentials)
-FAIL Verify FetchEvent for resources. assert_equals: integrity of Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test24) must be . expected " " but got ""
-
Modified: branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https.html (227662 => 227663)
--- branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https.html 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https.html 2018-01-26 05:03:25 UTC (rev 227663)
@@ -8,6 +8,15 @@
var url_count = 0;
var expected_results = {};
+function add_promise_to_test(url)
+{
+ var expected = expected_results[url];
+ return new Promise((resolve, reject) => {
+ expected.resolve = resolve;
+ setTimeout(() => reject("test time out"), 5000);
+ });
+}
+
function image_test(frame, url, cross_origin, expected_mode,
expected_credentials) {
var actual_url = url + (++url_count);
@@ -20,7 +29,8 @@
message: 'Image load (url:' +
actual_url + ' cross_origin:' + cross_origin + ')'
};
- return frame.contentWindow.load_image(actual_url, cross_origin);
+ frame.contentWindow.load_image(actual_url, cross_origin);
+ return add_promise_to_test(actual_url);
}
function script_test(frame, url, cross_origin, expected_mode,
@@ -35,7 +45,8 @@
message: 'Script load (url:' +
actual_url + ' cross_origin:' + cross_origin + ')'
};
- return frame.contentWindow.load_script(actual_url, cross_origin);
+ frame.contentWindow.load_script(actual_url, cross_origin);
+ return add_promise_to_test(actual_url);
}
function css_test(frame, url, cross_origin, expected_mode,
@@ -50,7 +61,8 @@
message: 'CSS load (url:' +
actual_url + ' cross_origin:' + cross_origin + ')'
};
- return frame.contentWindow.load_css(actual_url, cross_origin);
+ frame.contentWindow.load_css(actual_url, cross_origin);
+ return add_promise_to_test(actual_url);
}
function font_face_test(frame, url, expected_mode, expected_credentials) {
@@ -63,7 +75,8 @@
integrity: '',
message: 'FontFace load (url:' + actual_url + ')'
};
- return frame.contentWindow.load_font(actual_url);
+ frame.contentWindow.load_font(actual_url);
+ return add_promise_to_test(actual_url);
}
function script_integrity_test(frame, url, integrity, expected_integrity) {
@@ -76,7 +89,8 @@
integrity: expected_integrity,
message: 'Script load (url:' + actual_url + ')'
};
- return frame.contentWindow.load_script_with_integrity(actual_url, integrity);
+ frame.contentWindow.load_script_with_integrity(actual_url, integrity);
+ return add_promise_to_test(actual_url);
}
function css_integrity_test(frame, url, integrity, expected_integrity) {
@@ -89,7 +103,8 @@
integrity: expected_integrity,
message: 'CSS load (url:' + actual_url + ')'
};
- return frame.contentWindow.load_css_with_integrity(actual_url, integrity);
+ frame.contentWindow.load_css_with_integrity(actual_url, integrity);
+ return add_promise_to_test(actual_url);
}
function fetch_test(frame, url, mode, credentials,
@@ -103,8 +118,10 @@
message: 'fetch (url:' + actual_url + ' mode:' + mode + ' credentials:' +
credentials + ')'
};
- return frame.contentWindow.fetch(
- new Request(actual_url, {mode: mode, credentials: credentials}));
+ frame.contentWindow.fetch(
+ new Request(actual_url, {mode: mode, credentials: credentials})).then(() => {
+ }, () => { });
+ return add_promise_to_test(actual_url);
}
function audio_test(frame, url, cross_origin,
@@ -118,10 +135,11 @@
message: 'Audio load (url:' + actual_url + ' cross_origin:' +
cross_origin + ')'
};
- return frame.contentWindow.load_audio(actual_url, cross_origin);
+ frame.contentWindow.load_audio(actual_url, cross_origin);
+ return add_promise_to_test(actual_url);
}
-async_test(function(t) {
+promise_test(function(t) {
var SCOPE = 'resources/fetch-request-resources-iframe.https.html';
var SCRIPT = 'resources/fetch-request-resources-worker.js';
var host_info = get_host_info();
@@ -131,13 +149,13 @@
host_info['HTTPS_REMOTE_ORIGIN'] + base_path() + 'resources/dummy?test';
var worker;
var frame;
- service_worker_unregister_and_register(t, SCRIPT, SCOPE)
+ return service_worker_unregister_and_register(t, SCRIPT, SCOPE)
.then(function(registration) {
worker = registration.installing;
return wait_for_state(t, worker, 'activated');
})
.then(function() {
- return new Promise(function(resolve) {
+ return new Promise(function(resolve, reject) {
var channel = new MessageChannel();
channel.port1._onmessage_ = t.step_func(function(msg) {
if (msg.data.ready) {
@@ -149,28 +167,26 @@
if (!expected) {
return;
}
- assert_equals(
+ test(() => {
+ assert_equals(
result.mode, expected.mode,
'mode of ' + expected.message + ' must be ' +
expected.mode + '.');
- assert_equals(
+ assert_equals(
result.credentials, expected.credentials,
'credentials of ' + expected.message + ' must be ' +
expected.credentials + '.');
- assert_equals(
+ assert_equals(
result.redirect, expected.redirect,
'redirect mode of ' + expected.message + ' must be ' +
expected.redirect + '.');
- assert_equals(
+ assert_equals(
result.integrity, expected.integrity,
'integrity of ' + expected.message + ' must be ' +
expected.integrity + '.');
- --url_count;
+ }, expected.message);
+ expected.resolve();
delete expected_results[result.url];
- if (url_count == 0) {
- frame.remove();
- service_worker_unregister_and_done(t, SCOPE);
- }
});
worker.postMessage(
{port: channel.port2}, [channel.port2]);
@@ -177,82 +193,84 @@
});
})
.then(function() { return with_iframe(SCOPE); })
- .then(function(f) {
+ .then(async function(f) {
frame = f;
- image_test(f, LOCAL_URL, '', 'no-cors', 'include');
- image_test(f, REMOTE_URL, '', 'no-cors', 'include');
- css_test(f, LOCAL_URL, '', 'no-cors', 'include');
- css_test(f, REMOTE_URL, '', 'no-cors', 'include');
+ await image_test(f, LOCAL_URL, '', 'no-cors', 'include');
+ await image_test(f, REMOTE_URL, '', 'no-cors', 'include');
+ await css_test(f, LOCAL_URL, '', 'no-cors', 'include');
+ await css_test(f, REMOTE_URL, '', 'no-cors', 'include');
- image_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
- image_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
- image_test(f, REMOTE_URL, '', 'no-cors', 'include');
- image_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
- image_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
+ await image_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
+ await image_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
+ await image_test(f, REMOTE_URL, '', 'no-cors', 'include');
+ await image_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
+ await image_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
- script_test(f, LOCAL_URL, '', 'no-cors', 'include');
- script_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
- script_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
- script_test(f, REMOTE_URL, '', 'no-cors', 'include');
- script_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
- script_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
+ await script_test(f, LOCAL_URL, '', 'no-cors', 'include');
+ await script_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
+ await script_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
+ await script_test(f, REMOTE_URL, '', 'no-cors', 'include');
+ await script_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
+ await script_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
- css_test(f, LOCAL_URL, '', 'no-cors', 'include');
- css_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
- css_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
- css_test(f, REMOTE_URL, '', 'no-cors', 'include');
- css_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
- css_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
+ await css_test(f, LOCAL_URL, '', 'no-cors', 'include');
+ await css_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
+ await css_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
+ await css_test(f, REMOTE_URL, '', 'no-cors', 'include');
+ await css_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
+ await css_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
- font_face_test(f, LOCAL_URL, 'cors', 'same-origin');
- font_face_test(f, REMOTE_URL, 'cors', 'same-origin');
+ await font_face_test(f, LOCAL_URL, 'cors', 'same-origin');
+ await font_face_test(f, REMOTE_URL, 'cors', 'same-origin');
- script_integrity_test(f, LOCAL_URL, ' ', ' ');
- script_integrity_test(f, LOCAL_URL,
- 'This is not a valid integrity because it has no dashes',
- 'This is not a valid integrity because it has no dashes');
- script_integrity_test(f, LOCAL_URL, 'sha256-', 'sha256-');
- script_integrity_test(f, LOCAL_URL, 'sha256-foo?123', 'sha256-foo?123');
- script_integrity_test(f, LOCAL_URL, 'sha256-foo sha384-abc ', 'sha256-foo sha384-abc ');
- script_integrity_test(f, LOCAL_URL, 'sha256-foo sha256-abc', 'sha256-foo sha256-abc');
+ await script_integrity_test(f, LOCAL_URL, ' ', ' ');
+ await script_integrity_test(f, LOCAL_URL,
+ 'This is not a valid integrity because it has no dashes',
+ 'This is not a valid integrity because it has no dashes');
+ await script_integrity_test(f, LOCAL_URL, 'sha256-', 'sha256-');
+ await script_integrity_test(f, LOCAL_URL, 'sha256-foo?123', 'sha256-foo?123');
+ await script_integrity_test(f, LOCAL_URL, 'sha256-foo sha384-abc ', 'sha256-foo sha384-abc ');
+ await script_integrity_test(f, LOCAL_URL, 'sha256-foo sha256-abc', 'sha256-foo sha256-abc');
- css_integrity_test(f, LOCAL_URL, ' ', ' ');
- css_integrity_test(f, LOCAL_URL,
- 'This is not a valid integrity because it has no dashes',
- 'This is not a valid integrity because it has no dashes');
- css_integrity_test(f, LOCAL_URL, 'sha256-', 'sha256-');
- css_integrity_test(f, LOCAL_URL, 'sha256-foo?123', 'sha256-foo?123');
- css_integrity_test(f, LOCAL_URL, 'sha256-foo sha384-abc ', 'sha256-foo sha384-abc ');
- css_integrity_test(f, LOCAL_URL, 'sha256-foo sha256-abc', 'sha256-foo sha256-abc');
+ await css_integrity_test(f, LOCAL_URL, ' ', ' ');
+ await css_integrity_test(f, LOCAL_URL,
+ 'This is not a valid integrity because it has no dashes',
+ 'This is not a valid integrity because it has no dashes');
+ await css_integrity_test(f, LOCAL_URL, 'sha256-', 'sha256-');
+ await css_integrity_test(f, LOCAL_URL, 'sha256-foo?123', 'sha256-foo?123');
+ await css_integrity_test(f, LOCAL_URL, 'sha256-foo sha384-abc ', 'sha256-foo sha384-abc ');
+ await css_integrity_test(f, LOCAL_URL, 'sha256-foo sha256-abc', 'sha256-foo sha256-abc');
- fetch_test(f, LOCAL_URL, 'same-origin', 'omit', 'same-origin', 'omit');
- fetch_test(f, LOCAL_URL, 'same-origin', 'same-origin',
- 'same-origin', 'same-origin');
- fetch_test(f, LOCAL_URL, 'same-origin', 'include',
- 'same-origin', 'include');
- fetch_test(f, LOCAL_URL, 'no-cors', 'omit', 'no-cors', 'omit');
- fetch_test(f, LOCAL_URL, 'no-cors', 'same-origin',
- 'no-cors', 'same-origin');
- fetch_test(f, LOCAL_URL, 'no-cors', 'include', 'no-cors', 'include');
- fetch_test(f, LOCAL_URL, 'cors', 'omit', 'cors', 'omit');
- fetch_test(f, LOCAL_URL, 'cors', 'same-origin', 'cors', 'same-origin');
- fetch_test(f, LOCAL_URL, 'cors', 'include', 'cors', 'include');
- fetch_test(f, REMOTE_URL, 'no-cors', 'omit', 'no-cors', 'omit');
- fetch_test(f, REMOTE_URL, 'no-cors', 'same-origin',
- 'no-cors', 'same-origin');
- fetch_test(f, REMOTE_URL, 'no-cors', 'include', 'no-cors', 'include');
- fetch_test(f, REMOTE_URL, 'cors', 'omit', 'cors', 'omit');
- fetch_test(f, REMOTE_URL, 'cors', 'same-origin', 'cors', 'same-origin');
- fetch_test(f, REMOTE_URL, 'cors', 'include', 'cors', 'include');
+ await fetch_test(f, LOCAL_URL, 'same-origin', 'omit', 'same-origin', 'omit');
+ await fetch_test(f, LOCAL_URL, 'same-origin', 'same-origin',
+ 'same-origin', 'same-origin');
+ await fetch_test(f, LOCAL_URL, 'same-origin', 'include',
+ 'same-origin', 'include');
+ await fetch_test(f, LOCAL_URL, 'no-cors', 'omit', 'no-cors', 'omit');
+ await fetch_test(f, LOCAL_URL, 'no-cors', 'same-origin',
+ 'no-cors', 'same-origin');
+ await fetch_test(f, LOCAL_URL, 'no-cors', 'include', 'no-cors', 'include');
+ await fetch_test(f, LOCAL_URL, 'cors', 'omit', 'cors', 'omit');
+ await fetch_test(f, LOCAL_URL, 'cors', 'same-origin', 'cors', 'same-origin');
+ await fetch_test(f, LOCAL_URL, 'cors', 'include', 'cors', 'include');
+ await fetch_test(f, REMOTE_URL, 'no-cors', 'omit', 'no-cors', 'omit');
+ await fetch_test(f, REMOTE_URL, 'no-cors', 'same-origin',
+ 'no-cors', 'same-origin');
+ await fetch_test(f, REMOTE_URL, 'no-cors', 'include', 'no-cors', 'include');
+ await fetch_test(f, REMOTE_URL, 'cors', 'omit', 'cors', 'omit');
+ await fetch_test(f, REMOTE_URL, 'cors', 'same-origin', 'cors', 'same-origin');
+ await fetch_test(f, REMOTE_URL, 'cors', 'include', 'cors', 'include');
- audio_test(f, LOCAL_URL, '', 'no-cors', 'include');
- audio_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
- audio_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
- audio_test(f, REMOTE_URL, '', 'no-cors', 'include');
- audio_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
- audio_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
- })
- .catch(unreached_rejection(t));
+ await audio_test(f, LOCAL_URL, '', 'no-cors', 'include');
+ await audio_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
+ await audio_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
+ await audio_test(f, REMOTE_URL, '', 'no-cors', 'include');
+ await audio_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
+ await audio_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
+
+ frame.remove();
+ service_worker_unregister(t, SCOPE);
+ }).catch(unreached_rejection(t));
}, 'Verify FetchEvent for resources.');
</script>
Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (227662 => 227663)
--- branches/safari-605-branch/Source/WebCore/ChangeLog 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog 2018-01-26 05:03:25 UTC (rev 227663)
@@ -1,5 +1,34 @@
2018-01-25 Jason Marcell <[email protected]>
+ Cherry-pick r227612. rdar://problem/36873390
+
+ 2018-01-25 Youenn Fablet <[email protected]>
+
+ Set integrity fetch options for loading scripts and CSS
+ https://bugs.webkit.org/show_bug.cgi?id=182077
+
+ Reviewed by Chris Dumez.
+
+ Covered by updated test.
+
+ Set integrity fetch option in script and CSS loading.
+
+ * bindings/js/CachedModuleScriptLoader.cpp:
+ (WebCore::CachedModuleScriptLoader::load):
+ * bindings/js/CachedScriptFetcher.cpp:
+ (WebCore::CachedScriptFetcher::requestModuleScript const):
+ (WebCore::CachedScriptFetcher::requestScriptWithCache const):
+ * bindings/js/CachedScriptFetcher.h:
+ * dom/LoadableClassicScript.cpp:
+ (WebCore::LoadableClassicScript::load):
+ * dom/ScriptElementCachedScriptFetcher.cpp:
+ (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript const):
+ * dom/ScriptElementCachedScriptFetcher.h:
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::process):
+
+2018-01-25 Jason Marcell <[email protected]>
+
Cherry-pick r227578. rdar://problem/36873356
2018-01-24 Chris Dumez <[email protected]>
Modified: branches/safari-605-branch/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp (227662 => 227663)
--- branches/safari-605-branch/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp 2018-01-26 05:03:25 UTC (rev 227663)
@@ -63,7 +63,8 @@
bool CachedModuleScriptLoader::load(Document& document, const URL& sourceURL)
{
ASSERT(!m_cachedScript);
- m_cachedScript = m_scriptFetcher->requestModuleScript(document, sourceURL);
+ String integrity = m_parameters ? m_parameters->integrity() : String { };
+ m_cachedScript = m_scriptFetcher->requestModuleScript(document, sourceURL, WTFMove(integrity));
if (!m_cachedScript)
return false;
Modified: branches/safari-605-branch/Source/WebCore/bindings/js/CachedScriptFetcher.cpp (227662 => 227663)
--- branches/safari-605-branch/Source/WebCore/bindings/js/CachedScriptFetcher.cpp 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/Source/WebCore/bindings/js/CachedScriptFetcher.cpp 2018-01-26 05:03:25 UTC (rev 227663)
@@ -39,12 +39,12 @@
return adoptRef(*new CachedScriptFetcher(charset));
}
-CachedResourceHandle<CachedScript> CachedScriptFetcher::requestModuleScript(Document& document, const URL& sourceURL) const
+CachedResourceHandle<CachedScript> CachedScriptFetcher::requestModuleScript(Document& document, const URL& sourceURL, String&& integrity) const
{
- return requestScriptWithCache(document, sourceURL, String());
+ return requestScriptWithCache(document, sourceURL, String { }, WTFMove(integrity));
}
-CachedResourceHandle<CachedScript> CachedScriptFetcher::requestScriptWithCache(Document& document, const URL& sourceURL, const String& crossOriginMode) const
+CachedResourceHandle<CachedScript> CachedScriptFetcher::requestScriptWithCache(Document& document, const URL& sourceURL, const String& crossOriginMode, String&& integrity) const
{
if (!document.settings().isScriptEnabled())
return nullptr;
@@ -54,6 +54,7 @@
ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions();
options.contentSecurityPolicyImposition = hasKnownNonce ? ContentSecurityPolicyImposition::SkipPolicyCheck : ContentSecurityPolicyImposition::DoPolicyCheck;
options.sameOriginDataURLFlag = SameOriginDataURLFlag::Set;
+ options.integrity = WTFMove(integrity);
CachedResourceRequest request(ResourceRequest(sourceURL), options);
request.setAsPotentiallyCrossOrigin(crossOriginMode, document);
Modified: branches/safari-605-branch/Source/WebCore/bindings/js/CachedScriptFetcher.h (227662 => 227663)
--- branches/safari-605-branch/Source/WebCore/bindings/js/CachedScriptFetcher.h 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/Source/WebCore/bindings/js/CachedScriptFetcher.h 2018-01-26 05:03:25 UTC (rev 227663)
@@ -37,7 +37,7 @@
class CachedScriptFetcher : public JSC::ScriptFetcher {
public:
- virtual CachedResourceHandle<CachedScript> requestModuleScript(Document&, const URL& sourceURL) const;
+ virtual CachedResourceHandle<CachedScript> requestModuleScript(Document&, const URL& sourceURL, String&& integrity) const;
static Ref<CachedScriptFetcher> create(const String& charset);
@@ -55,7 +55,7 @@
{
}
- CachedResourceHandle<CachedScript> requestScriptWithCache(Document&, const URL& sourceURL, const String& crossOriginMode) const;
+ CachedResourceHandle<CachedScript> requestScriptWithCache(Document&, const URL& sourceURL, const String& crossOriginMode, String&& integrity) const;
private:
String m_nonce;
Modified: branches/safari-605-branch/Source/WebCore/dom/LoadableClassicScript.cpp (227662 => 227663)
--- branches/safari-605-branch/Source/WebCore/dom/LoadableClassicScript.cpp 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/Source/WebCore/dom/LoadableClassicScript.cpp 2018-01-26 05:03:25 UTC (rev 227663)
@@ -114,7 +114,7 @@
bool LoadableClassicScript::load(Document& document, const URL& sourceURL)
{
ASSERT(!m_cachedScript);
- m_cachedScript = requestScriptWithCache(document, sourceURL, crossOriginMode());
+ m_cachedScript = requestScriptWithCache(document, sourceURL, crossOriginMode(), String { m_integrity });
if (!m_cachedScript)
return false;
m_cachedScript->addClient(*this);
Modified: branches/safari-605-branch/Source/WebCore/dom/ScriptElementCachedScriptFetcher.cpp (227662 => 227663)
--- branches/safari-605-branch/Source/WebCore/dom/ScriptElementCachedScriptFetcher.cpp 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/Source/WebCore/dom/ScriptElementCachedScriptFetcher.cpp 2018-01-26 05:03:25 UTC (rev 227663)
@@ -31,12 +31,12 @@
namespace WebCore {
-CachedResourceHandle<CachedScript> ScriptElementCachedScriptFetcher::requestModuleScript(Document& document, const URL& sourceURL) const
+CachedResourceHandle<CachedScript> ScriptElementCachedScriptFetcher::requestModuleScript(Document& document, const URL& sourceURL, String&& integrity) const
{
// https://github.com/tc39/proposal-dynamic-import/blob/master/HTML Integration.md
// If the fetcher is not module script, credential mode is always "omit".
- return requestScriptWithCache(document, sourceURL, isClassicScript() ? ASCIILiteral("omit") : m_crossOriginMode);
+ return requestScriptWithCache(document, sourceURL, isClassicScript() ? ASCIILiteral("omit") : m_crossOriginMode, WTFMove(integrity));
}
}
Modified: branches/safari-605-branch/Source/WebCore/dom/ScriptElementCachedScriptFetcher.h (227662 => 227663)
--- branches/safari-605-branch/Source/WebCore/dom/ScriptElementCachedScriptFetcher.h 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/Source/WebCore/dom/ScriptElementCachedScriptFetcher.h 2018-01-26 05:03:25 UTC (rev 227663)
@@ -31,7 +31,7 @@
class ScriptElementCachedScriptFetcher : public CachedScriptFetcher {
public:
- virtual CachedResourceHandle<CachedScript> requestModuleScript(Document&, const URL& sourceURL) const;
+ virtual CachedResourceHandle<CachedScript> requestModuleScript(Document&, const URL& sourceURL, String&& integrity) const;
virtual bool isClassicScript() const = 0;
virtual bool isModuleScript() const = 0;
Modified: branches/safari-605-branch/Source/WebCore/html/HTMLLinkElement.cpp (227662 => 227663)
--- branches/safari-605-branch/Source/WebCore/html/HTMLLinkElement.cpp 2018-01-26 05:03:22 UTC (rev 227662)
+++ branches/safari-605-branch/Source/WebCore/html/HTMLLinkElement.cpp 2018-01-26 05:03:25 UTC (rev 227663)
@@ -309,7 +309,7 @@
options.sameOriginDataURLFlag = SameOriginDataURLFlag::Set;
if (document().contentSecurityPolicy()->allowStyleWithNonce(attributeWithoutSynchronization(HTMLNames::nonceAttr)))
options.contentSecurityPolicyImposition = ContentSecurityPolicyImposition::SkipPolicyCheck;
-
+ options.integrity = m_integrityMetadataForPendingSheetRequest;
CachedResourceRequest request(url, options, priority, WTFMove(charset));
request.setInitiator(*this);
request.setAsPotentiallyCrossOrigin(crossOrigin(), document());
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
