PresentationRequest_error.https.html (1812B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Constructing a PresentationRequest (Error)</title> 4 <link rel="author" title="Franck William Taffo" href="http://www.fokus.fraunhofer.de"> 5 <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs"> 6 <link rel="help" href="http://w3c.github.io/presentation-api/#constructing-a-presentationrequest"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script> 10 11 test(() => { 12 assert_throws_js(TypeError, () => { 13 new PresentationRequest(); 14 }, 'Call PresentationRequest() constructor without presentation URL. TypeError Exception expected.'); 15 16 assert_throws_dom('NotSupportedError', () => { 17 new PresentationRequest([]); 18 }, 'Call PresentationRequest constructor with an empty sequence. NotSupportedError Exception expected.'); 19 20 assert_throws_dom('SyntaxError', () => { 21 new PresentationRequest('https://@'); 22 }, 'Call PresentationRequest constructor with an invalid URL. SyntaxError Exception expected.'); 23 24 assert_throws_dom('NotSupportedError', () => { 25 new PresentationRequest('unsupported://example.com'); 26 }, 'Call PresentationRequest constructor with an unsupported URL. NotSupportedError expected.'); 27 28 assert_throws_dom('SyntaxError', function() { 29 new PresentationRequest(['presentation.html', 'https://@']); 30 }, 'Call PresentationRequest constructor with a sequence of URLs, one of them invalid. SyntaxError Exception expected.'); 31 32 assert_throws_dom('NotSupportedError', function() { 33 new PresentationRequest(['unsupported://example.com', 'invalid://example.com']); 34 }, 'Call PresentationRequest constructor only with a sequence of unsupported URLs. NotSupportedError Exception expected.'); 35 }); 36 </script>