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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js

Issue 2100403002: calling whenDefined with invalid name should throw SyntaxError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removing assert_throws_dom_exception Created 4 years, 5 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 function create_window_in_test(t) { 1 function create_window_in_test(t) {
2 let p = new Promise((resolve) => { 2 let p = new Promise((resolve) => {
3 let f = document.createElement('iframe'); 3 let f = document.createElement('iframe');
4 f.srcdoc = ''; 4 f.srcdoc = '';
5 f.onload = (event) => { 5 f.onload = (event) => {
6 let w = f.contentWindow; 6 let w = f.contentWindow;
7 t.add_cleanup(() => f.remove()); 7 t.add_cleanup(() => f.remove());
8 resolve(w); 8 resolve(w);
9 }; 9 };
10 document.body.appendChild(f); 10 document.body.appendChild(f);
11 }); 11 });
12 return p; 12 return p;
13 } 13 }
14 14
15 function test_with_window(f, name) { 15 function test_with_window(f, name) {
16 promise_test((t) => { 16 promise_test((t) => {
17 return create_window_in_test(t) 17 return create_window_in_test(t)
18 .then((w) => { 18 .then((w) => {
19 f(w); 19 f(w);
20 }); 20 });
21 }, name); 21 }, name);
22 } 22 }
23
24 function assert_throws_dom_exception(global_context, code, func, description) {
25 let exception;
26 assert_throws(code, () => {
27 try {
28 func.call(this);
29 } catch(e) {
30 exception = e;
31 throw e;
32 }
33 }, description);
34 assert_true(exception instanceof global_context.DOMException, 'DOMException on the appropriate window');
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698