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

Side by Side Diff: LayoutTests/fast/domurl/url-constructor.html

Issue 870053004: Make URL constructor failure throw TypeError (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change test expectation Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/dom/DOMURL.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url"> 2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url">
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 6
7 function assertThrows(func, expected) { 7 function assertThrows(func, expected) {
8 try { 8 try {
9 func(); 9 func();
10 } catch (ex) { 10 } catch (ex) {
(...skipping 15 matching lines...) Expand all
26 var encodedReplacementCharacter = encodeURIComponent('\ufffd'); 26 var encodedReplacementCharacter = encodeURIComponent('\ufffd');
27 assert_equals(new URL('b/c', 'http://www.domain.com/\ud801/b').toString(), ' http://www.domain.com/' + encodedReplacementCharacter + '/b/c'); 27 assert_equals(new URL('b/c', 'http://www.domain.com/\ud801/b').toString(), ' http://www.domain.com/' + encodedReplacementCharacter + '/b/c');
28 }, 'Valid URLs'); 28 }, 'Valid URLs');
29 29
30 test(function() { 30 test(function() {
31 assertThrows(function() { 31 assertThrows(function() {
32 new URL(); 32 new URL();
33 }, 'TypeError: Failed to construct \'URL\': 1 argument required, but only 0 present.'); 33 }, 'TypeError: Failed to construct \'URL\': 1 argument required, but only 0 present.');
34 assertThrows(function() { 34 assertThrows(function() {
35 new URL('abc'); 35 new URL('abc');
36 }, 'SyntaxError: Failed to construct \'URL\': Invalid URL'); 36 }, 'TypeError: Failed to construct \'URL\': Invalid URL');
37 assertThrows(function() { 37 assertThrows(function() {
38 new URL('//abc'); 38 new URL('//abc');
39 }, 'SyntaxError: Failed to construct \'URL\': Invalid URL'); 39 }, 'TypeError: Failed to construct \'URL\': Invalid URL');
40 assertThrows(function() { 40 assertThrows(function() {
41 new URL('http:///www.domain.com/', 'abc'); 41 new URL('http:///www.domain.com/', 'abc');
42 }, 'SyntaxError: Failed to construct \'URL\': Invalid base URL'); 42 }, 'TypeError: Failed to construct \'URL\': Invalid base URL');
43 assertThrows(function() { 43 assertThrows(function() {
44 new URL('http:///www.domain.com/', null); 44 new URL('http:///www.domain.com/', null);
45 }, 'SyntaxError: Failed to construct \'URL\': Invalid base URL'); 45 }, 'TypeError: Failed to construct \'URL\': Invalid base URL');
46 }, 'Invalid URL parameters'); 46 }, 'Invalid URL parameters');
47 47
48 </script> 48 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/DOMURL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698