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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html

Issue 2713413002: Blink bindings: use v8 to enforce method call access checks (Closed)
Patch Set: . Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <iframe id="iframe"></iframe> 2 <iframe></iframe>
3 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testharnessreport.js"></script>
5 <script> 5 <script>
6 test(function(test) { 6 var fetchTest = async_test("fetch() on discarded window");
7 var iframe = document.getElementById('iframe');
8 var w = iframe.contentWindow;
9 iframe.remove();
10 7
11 assert_not_equals(w.fetch, undefined, 8 var iframe = document.querySelector('iframe');
12 'A discarded window should have |fetch| function.'); 9 var w = iframe.contentWindow;
13 // NOTE: This is not explicitly specified as far as I know. This behavior 10 iframe.remove();
14 // may be Blink specific. 11
15 assert_equals(w.fetch('/fetch/resources/doctype.html'), undefined, 12 assert_not_equals(w.fetch, undefined,
16 '|fetch| on a discarded window returns undefined, not a Promise.'); 13 'A discarded window should have |fetch| function.');
17 }); 14
15 // NOTE: This is not explicitly specified as far as I know. This behavior
16 // may be Blink specific.
17 w.fetch('/fetch/resources/doctype.html').then(
18 function () {
19 assert_true(false, "This Promise must always be rejected.");
20 },
21 fetchTest.step_func(function (e) {
22 assert_true(e instanceof w.TypeError);
23 assert_equals(e.message, "Failed to execute 'fetch' on 'Window': The globa l scope is shutting down.");
dcheng 2017/02/27 05:34:19 Per yhirano, it's OK to return a promise, as long
24 fetchTest.done();
25 }));
18 </script> 26 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698