Closed Bug 618176 Opened 14 years ago Closed 13 years ago

Failure to serialize array returned by content in frame script

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox6 --- fixed
fennec 6+ ---

People

(Reporter: cjones, Assigned: mrbkap)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(2 files, 1 obsolete file)

In a setup that looks approximately like,

  <xul window>
    <browser src="http://foo.com">
      (frame script X loaded by browser)

if script X calls a function from foo.com's |window|, and that function returns an array, then the array is JSON'd by script X, the JSONinification seems to be failing: when un-JSON'd, what was formerly an array comes out as non-array object.  Sorry for the lack of detail, but the only testcase I have right now is a heavily modified reftest framework, which is not very small.  I'll cook up a small testcase.

hg bisect says what's "at fault" is

The first bad revision is:
changeset:   58746:0641328503d8
user:        Blake Kaplan <mrbkap@gmail.com>
date:        Fri Dec 03 19:00:23 2010 -0800
summary:     Bug 614757 - Properly deep wrap via call/construct. r=gal

It might be that there's a better way to do what my code is doing, but the code did work previously.
Figured I'd attach this so I don't lose it.  Will follow up to see if this is a separate bug.
Run

  TEST_PATH="js/src/xpconnect/tests/chrome" make -C $objdir mochitest-chrome

and you should see

42 ERROR TEST-UNEXPECTED-FAIL | chrome://mochitests/content/chrome/js/src/xpconnect/tests/chrome/test_bug618176.xul | array was serialized and deserialized - got undefined, expected 3

As noted in a comment in the test, if |[ 1, 2, 3 ]| is serialized instead of the content array, the test passes.
Attachment #496694 - Attachment is obsolete: true
Nom'ing for blocking-fennec because this behavior change might affect extensions.  (I'm surprised it hasn't bitten the fennec frontend!)
tracking-fennec: --- → ?
tracking-fennec: ? → 2.0+
tracking-fennec: 2.0+ → 2.0next+
Assignee: nobody → gbrown
Attached patch Proposed fixSplinter Review
With a CrossOriginWrapper around an array we actually have CrossOriginWrapper(WaiveXRayWrapper(array)). We need to strip off both layers to see the true type of the wrapped object.
Assignee: gbrown → mrbkap
Status: NEW → ASSIGNED
Attachment #525536 - Flags: review?(gal)
Attachment #525536 - Flags: review?(gal) → review+
We should have a proper channel for this (an internal proxy method that tells you whether its an array)
tracking-fennec: 2.0next+ → 6+
http://hg.mozilla.org/mozilla-central/rev/907c8fc9370b
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: