Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | function ok(a, msg) { |
michael@0 | 2 | postMessage({type: 'status', status: !!a, msg: msg }); |
michael@0 | 3 | } |
michael@0 | 4 | |
michael@0 | 5 | onmessage = function(event) { |
michael@0 | 6 | // URL.href throws |
michael@0 | 7 | var url = new URL('http://www.example.com'); |
michael@0 | 8 | ok(url, "URL created"); |
michael@0 | 9 | |
michael@0 | 10 | var status = false; |
michael@0 | 11 | try { |
michael@0 | 12 | url.href = '42'; |
michael@0 | 13 | } catch(e) { |
michael@0 | 14 | status = true; |
michael@0 | 15 | } |
michael@0 | 16 | ok(status, "url.href = 42 should throw"); |
michael@0 | 17 | |
michael@0 | 18 | url.href = 'http://www.example.org'; |
michael@0 | 19 | ok(true, "url.href should not throw"); |
michael@0 | 20 | |
michael@0 | 21 | status = false |
michael@0 | 22 | try { |
michael@0 | 23 | new URL('42'); |
michael@0 | 24 | } catch(e) { |
michael@0 | 25 | status = true; |
michael@0 | 26 | } |
michael@0 | 27 | ok(status, "new URL(42) should throw"); |
michael@0 | 28 | |
michael@0 | 29 | status = false |
michael@0 | 30 | try { |
michael@0 | 31 | new URL('http://www.example.com', '42'); |
michael@0 | 32 | } catch(e) { |
michael@0 | 33 | status = true; |
michael@0 | 34 | } |
michael@0 | 35 | ok(status, "new URL(something, 42) should throw"); |
michael@0 | 36 | |
michael@0 | 37 | postMessage({type: 'finish' }); |
michael@0 | 38 | } |