Closed Bug 1150771 Opened 11 years ago Closed 11 years ago

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

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: yury, Assigned: bholley)

References

Details

Attachments

(1 file)

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.
Blocks: 1137947
Attachment #8588237 - Flags: review?(gkrizsanits)
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: nobody → bobbyholley
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
See Also: → 1155024
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: