cloneInto is not able to clone Xrays object property with ArrayBuffer value

RESOLVED FIXED in Firefox 40

Status

()

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: yury, Assigned: bholley)

Tracking

Trunk
mozilla40
x86
Mac OS X
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox40 fixed)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
Currently an object's Xrays vision needs to be unwaived before calling cloneInto if a property contains ArrayBuffer:


let Cu = Components.utils;
let sandbox1 = new Cu.Sandbox('resource://r1/');
let sandbox2 = new Cu.Sandbox('resource://r2/');
let arg = Cu.evalInSandbox('({buf: ArrayBuffer(2)})', sandbox1);

let clonedArg = Cu.cloneInto(arg, sandbox2);
print(Cu.waiveXrays(clonedArg).buf); // undefined

let clonedArg = Cu.cloneInto(Cu.waiveXrays(arg), sandbox2);
print(Cu.waiveXrays(clonedArg).buf); // ArrayBuffer


It's expected that cloneInto(arg, sandbox2) call shall work as  Cu.cloneInto(Cu.waiveXrays(arg), sandbox2) one.
(Reporter)

Updated

4 years ago
Blocks: 1137947
(Assignee)

Comment 1

4 years ago
Created attachment 8588237 [details] [diff] [review]
Let ArrayBuffer through object Xrays. v1
Attachment #8588237 - Flags: review?(gkrizsanits)
(Assignee)

Comment 2

4 years ago
Thanks for the great bug report, yury.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=406ca2f6354d
Comment on attachment 8588237 [details] [diff] [review]
Let ArrayBuffer through object Xrays. v1

Review of attachment 8588237 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for the detailed description!

::: js/xpconnect/tests/unit/test_bug1150771.js
@@ +1,5 @@
> +function run_test() {
> +let Cu = Components.utils;
> +let sandbox1 = new Cu.Sandbox(null);
> +let sandbox2 = new Cu.Sandbox(null);
> +let arg = Cu.evalInSandbox('({buf: ArrayBuffer(2)})', sandbox1);

nit: ({ buf: ArrayBuffer(2) })
Attachment #8588237 - Flags: review?(gkrizsanits) → review+
(Assignee)

Updated

4 years ago
Assignee: nobody → bobbyholley
https://hg.mozilla.org/mozilla-central/rev/9b3309fcf57c
Status: NEW → RESOLVED
Last Resolved: 4 years ago
status-firefox40: affected → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
(Reporter)

Updated

4 years ago
See Also: → bug 1155024
Blocks: 1155024
Blocks: 1162712
You need to log in before you can comment on or make changes to this bug.