Closed
Bug 1502804
Opened 7 years ago
Closed 1 year ago
StructuredCloneAlgorithm should preserve the sharing when cloning objects
Categories
(Core :: DOM: Core & HTML, enhancement, P3)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: baku, Unassigned)
Details
| Reporter | ||
Updated•7 years ago
|
Flags: needinfo?(sphink)
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
Updated•7 years ago
|
Priority: -- → P3
Updated•3 years ago
|
Severity: normal → S3
Comment 1•1 year ago
|
||
This appears to work now. My quick test:
<!doctype html>
<title>Cloning objects, preserving sharing #2</title>
<canvas id="a" width=30 height=30></canvas>
<div id=log></div>
<script>
function test() {
var canvas = document.getElementsByTagName("canvas")[0];
var context = canvas.getContext("2d");
var img_data = context.getImageData(0, 0, 30, 30);
var obj = {a: img_data, b: {c: img_data, d: 3}};
postMessage(obj, '*');
onmessage = e => {
if (e.data.a !== e.data.b.c) {
console.error("mismatched!");
} else {
console.log("matched");
}
}
}
test();
</script>
This logged "matched".
Status: NEW → RESOLVED
Closed: 1 year ago
Flags: needinfo?(sphink)
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•