Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/resources/subresource-integrity-fetch-worker.js

Issue 2614813004: Fix a crash of SRI when used with web workers (Closed)
Patch Set: fix Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-fetch-worker.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/resources/subresource-integrity-fetch-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/resources/subresource-integrity-fetch-worker.js b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/resources/subresource-integrity-fetch-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..64183f5b94ad77d8866bb6aadea301f594caf410
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/resources/subresource-integrity-fetch-worker.js
@@ -0,0 +1,28 @@
+importScripts('/resources/testharness.js');
+console.log('hehehe');
+const url = '../call-success.js';
+const integrity = 'sha256-B0/62fJSJFrdjEFR9ba04m/D+LHQ+zG6PGcaR0Trpxg=';
+
+promise_test(() => {
+ return fetch(url).then(res => res.text()).then(text => {
+ assert_equals(text, 'success();\n');
+ });
+}, 'No integrity');
+
+promise_test(() => {
+ return fetch(url, {integrity: integrity}).then(res => {
+ return res.text();
+ }).then(text => {
+ assert_equals(text, 'success();\n');
+ });
+}, 'Good integrity');
+
+promise_test(() => {
+ return fetch(url, {integrity: 'sha256-deadbeaf'}).then(res => {
+ assert_unreached('the integrity check should fail');
+ }, () => {
+ // The integrity check should fail.
+ });
+}, 'Bad integrity');
+
+done();
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-fetch-worker.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698