blob: 96b7e706d4cdd9eb53dc8c830aba81245c4add87 [file] [log] [blame]
<!DOCTYPE html>
<body>
<script src="../../resources/js-test.js"></script>
<script>
description("Basic test for URL.toJSON()");
shouldBeEqualToString("new URL('https://example.com/').toJSON()", "https://example.com/");
shouldBeEqualToString("new URL('https://example.com/').toString()", "https://example.com/");
shouldBeEqualToString("new URL('https://example.com/').href", "https://example.com/");
shouldBeEqualToString("JSON.stringify(new URL('https://example.com/#\"'))", "\"https://example.com/#%22\"");
shouldBeEqualToString("JSON.parse(JSON.stringify(new URL('https://example.com/#\"')))", "https://example.com/#%22");
</script>
</body>