blob: 1ff1b2389ffa8cddc90c23b8317c30107ef368e3 [file] [edit]
<!DOCTYPE html><!-- webkit-test-runner [ LocalNetworkAccessEnabled=true ] -->
<html>
<head>
<title>Cloning a Request without targetAddressSpace in init must not crash</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<script>
test(() => {
const original = new Request("http://example.com/");
assert_equals(original.targetAddressSpace, "public");
// Constructing a Request from another Request without specifying
// targetAddressSpace in the init dictionary must not crash and must
// preserve the original's value.
const clone = new Request(original);
assert_equals(clone.targetAddressSpace, "public");
const cloneWithEmptyInit = new Request(original, { });
assert_equals(cloneWithEmptyInit.targetAddressSpace, "public");
const cloneWithOtherInit = new Request(original, { method: "POST" });
assert_equals(cloneWithOtherInit.targetAddressSpace, "public");
}, "Cloning a Request without targetAddressSpace in init must not crash");
</script>
</body>
</html>