Problem w/ Jetpack Request API and Firefox 10 Beta

59 views
Skip to first unread message

db

unread,
Dec 29, 2011, 12:46:05 AM12/29/11
to mozilla-labs-jetpack
Hi,

I'm hoping someone can help with an issue we're having while testing
our Jetpack based add-on and Firefox 10. First off, let me state that
our add-on works in FF versions 4-9. The problem is the way our JSON
response is being handled by the Jetpack SDK or maybe it's related to
FF 10 specifically. We request information from our server that is
returned in a basic JSON response. In our main script we emit an event
to our content script after we receive the JSON response. What's
interesting is that I log the JSON response to the console in the main
script and then immediately in the content script. So in the main
script we do the following:

console.log("JSON.stringify(response.json): " +
JSON.stringify(response.json));

which yields the following:

info: JSON.stringify(response.json): [{"users":[{"name":"dennis"},
{"name":"george"},{"name":"bart"}],"message":{"label":"Custom message
goes here"}}]

then we immediately emit the response to our content script:

worker.port.emit("userResponse", {users: response.json});

in the content script we then log the response just to verify that it
looks the same. Unfortunately, it doesn't. Here's what it looks like:

info: JSON.stringify(response.json): {"0":{"users":{"0":
{"name":"dennis"},"1":{"name":"george"},"2":{"name":"bart"}},"message":
{"label":"Custom message goes here"}}}

There's no code of ours that transforms this response when logging in
the main script and then in the content script. I've tested this in FF
10 with both SDK 1.3 and 1.4rc1 and get the same results. But as I
stated above this works perfectly in previous versions of FF.

I'm not sure what to do with this right now other than hopefully
assume there's an issue with the data being manipulated by the SDK
when I emit to the content script. Any insight on this problem would
be greatly appreciated.

Thanks.

KWierso

unread,
Dec 29, 2011, 1:38:12 AM12/29/11
to mozilla-labs-jetpack
Just out of curiosity, does it work in a recent Nightly build of
Firefox? ( http://nightly.mozilla.org )

Would also be interesting to see if emitting the stringified
response.json string (and then reparsing it to JSON in the
contentscript) would get the correct results.

Jeff Griffiths

unread,
Dec 29, 2011, 1:59:15 PM12/29/11
to mozilla-la...@googlegroups.com
Hi,

I can reproduce this pretty easily, comparing 9.01 ( where I get an array as the outer variable ) and Aurora ( where I get an object ) with the same code. Here's a working example we can repro with:

https://builder.addons.mozilla.org/addon/1031572/latest/

As this is a difference in the behaviour of two different versions of Firefox using the same SDK version and addon code, the obvious conclusion is that something changed in the platform between the current release and Beta. I've logged this bug to track the issue:

https://bugzilla.mozilla.org/show_bug.cgi?id=714110

As Firefox 10 is the current beta and we have something like 5 weeks before release, I'm hoping we can resolve the issue before then.

Jeff

> --
> You received this message because you are subscribed to the Google
> Groups "mozilla-labs-jetpack" group.
> To post to this group, send email to
> mozilla-la...@googlegroups.com.
> To unsubscribe from this group, send email to
> mozilla-labs-jet...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mozilla-labs-jetpack?hl=en.

db

unread,
Dec 29, 2011, 2:39:29 PM12/29/11
to mozilla-labs-jetpack
Thank you both for your replies.

1. I did test with the Firefox Nightly build and was able to reproduce
the bug

2. If I pass the JSON response as a string and then parse in the
content script then it works fine

Glad to know a bug has been reported and thanks for being on top of
this.

Jeff Griffiths

unread,
Dec 29, 2011, 8:03:26 PM12/29/11
to mozilla-la...@googlegroups.com
----- Original Message -----
> From: "db" <dennis...@gmail.com>
> To: "mozilla-labs-jetpack" <mozilla-la...@googlegroups.com>
> Sent: Thursday, December 29, 2011 11:39:29 AM
> Subject: [jetpack] Re: Problem w/ Jetpack Request API and Firefox 10 Beta
> Thank you both for your replies.
>
> 1. I did test with the Firefox Nightly build and was able to reproduce
> the bug
>
> 2. If I pass the JSON response as a string and then parse in the
> content script then it works fine
>
> Glad to know a bug has been reported and thanks for being on top of
> this.

No, thank YOU for the report! This bug is now a blocker on the next Firefox release, with plenty of time to fix it. :D

If you want to follow the process, feel free to cc yourself on the bug itself.

cheers, Jeff

Reply all
Reply to author
Forward
0 new messages