| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script> | 4 <script> |
| 5 function promise_test(func, name, properties) { | 5 function promise_test(func, name, properties) { |
| 6 properties = properties || {}; | 6 properties = properties || {}; |
| 7 var test = async_test(name, properties); | 7 var test = async_test(name, properties); |
| 8 Promise.resolve(test.step(func, test, test)) | 8 Promise.resolve(test.step(func, test, test)) |
| 9 .then(function() { test.done(); }) | 9 .then(function() { test.done(); }) |
| 10 .catch(test.step_func(function(value) { throw value; })); | 10 .catch(test.step_func(function(value) { throw value; })); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 assert_true(orig.hasOwnProperty(name)); | 112 assert_true(orig.hasOwnProperty(name)); |
| 113 | 113 |
| 114 return structuredClone(orig).then(function(clone) { | 114 return structuredClone(orig).then(function(clone) { |
| 115 assert_true(Array.isArray(clone), 'Clone should be an Array'); | 115 assert_true(Array.isArray(clone), 'Clone should be an Array'); |
| 116 assert_false(setter_called, 'Setter should not be called by cloning algo
rithm.'); | 116 assert_false(setter_called, 'Setter should not be called by cloning algo
rithm.'); |
| 117 assert_true(clone.hasOwnProperty(name), 'Cloning algorithm should add an
own property.') | 117 assert_true(clone.hasOwnProperty(name), 'Cloning algorithm should add an
own property.') |
| 118 assert_equals(clone[name], orig[name], 'Property value should match'); | 118 assert_equals(clone[name], orig[name], 'Property value should match'); |
| 119 }); | 119 }); |
| 120 }, 'Verify: "Add a new property..." (dense arrays)'); | 120 }, 'Verify: "Add a new property..." (dense arrays)'); |
| 121 | 121 |
| 122 promise_test(function() { |
| 123 var orig = { |
| 124 emptySet: new Set, |
| 125 set: new Set([1, 2, 3]), |
| 126 emptyMap: new Map, |
| 127 map: new Map([[1, 2], [3, 4]]) |
| 128 }; |
| 129 return structuredClone(orig).then(function(clone) { |
| 130 assert_true(clone.emptySet instanceof Set, 'Clone should be a Set'); |
| 131 assert_true(clone.emptyMap instanceof Map, 'Clone should be a Map'); |
| 132 assert_true(clone.set instanceof Set, 'Clone should be a Set'); |
| 133 assert_true(clone.map instanceof Map, 'Clone should be a Map'); |
| 134 assert_equals(clone.set.size, orig.set.size, 'Clone should be the same s
ize'); |
| 135 assert_equals(clone.map.size, orig.map.size, 'Clone should be the same s
ize'); |
| 136 }); |
| 137 }, 'Verify: "Maps and Sets are cloned..."'); |
| 138 |
| 122 </script> | 139 </script> |
| OLD | NEW |