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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js

Issue 1908263002: Don't expose URL.createObjectURL and revokeObjectURL to Service Workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test cleanup Created 4 years, 7 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/fetch/script-tests/thorough/scheme-blob.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js
index 1e9a77232b7510dcd0d513c4bb36f973f8ddfbae..07e5306eb5ecb75ed038d0dde3ca252877e306c0 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js
@@ -58,30 +58,33 @@ promise_test(function(t) {
function() {});
}, 'fetch invalid data: URL');
-// Tests for blob: scheme.
-promise_test(function(t) {
- var url = URL.createObjectURL(new Blob(['fox'], {type: 'text/fox'}));
- return fetch(url)
- .then(function(response) {
- assert_equals(response.status, 200);
- assert_equals(response.statusText, 'OK');
- assert_equals(response.headers.get('Content-Type'), 'text/fox');
- assert_equals(response.headers.get('Content-Length'), '3');
- assert_equals(size(response.headers), 2);
- return response.text();
- })
- .then(function(text) {
- assert_equals(text, 'fox');
- });
- }, 'fetch blob: URL');
-
-promise_test(function(t) {
- var url = URL.createObjectURL(new Blob(['fox'], {type: 'text/fox'}));
- return fetch(url + 'invalid')
- .then(
- t.unreached_func('fetching non-existent blob: URL must fail'),
- function() {});
- }, 'fetch non-existent blob: URL');
+// Only [Exposed=(Window,DedicatedWorker,SharedWorker)].
+if ('createObjectURL' in URL) {
+ // Tests for blob: scheme.
+ promise_test(function(t) {
+ var url = URL.createObjectURL(new Blob(['fox'], {type: 'text/fox'}));
+ return fetch(url)
+ .then(function(response) {
+ assert_equals(response.status, 200);
+ assert_equals(response.statusText, 'OK');
+ assert_equals(response.headers.get('Content-Type'), 'text/fox');
+ assert_equals(response.headers.get('Content-Length'), '3');
+ assert_equals(size(response.headers), 2);
+ return response.text();
+ })
+ .then(function(text) {
+ assert_equals(text, 'fox');
+ });
+ }, 'fetch blob: URL');
+
+ promise_test(function(t) {
+ var url = URL.createObjectURL(new Blob(['fox'], {type: 'text/fox'}));
+ return fetch(url + 'invalid')
+ .then(
+ t.unreached_func('fetching non-existent blob: URL must fail'),
+ function() {});
+ }, 'fetch non-existent blob: URL');
+}
// https://fetch.spec.whatwg.org/#concept-basic-fetch
// The last statement:
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/scheme-blob.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698