michael@0: function ok(a, msg) { michael@0: postMessage({type: 'status', status: !!a, msg: msg }); michael@0: } michael@0: michael@0: onmessage = function(event) { michael@0: // URL.href throws michael@0: var url = new URL('http://www.example.com'); michael@0: ok(url, "URL created"); michael@0: michael@0: var status = false; michael@0: try { michael@0: url.href = '42'; michael@0: } catch(e) { michael@0: status = true; michael@0: } michael@0: ok(status, "url.href = 42 should throw"); michael@0: michael@0: url.href = 'http://www.example.org'; michael@0: ok(true, "url.href should not throw"); michael@0: michael@0: status = false michael@0: try { michael@0: new URL('42'); michael@0: } catch(e) { michael@0: status = true; michael@0: } michael@0: ok(status, "new URL(42) should throw"); michael@0: michael@0: status = false michael@0: try { michael@0: new URL('http://www.example.com', '42'); michael@0: } catch(e) { michael@0: status = true; michael@0: } michael@0: ok(status, "new URL(something, 42) should throw"); michael@0: michael@0: postMessage({type: 'finish' }); michael@0: }