Closed Bug 568818 Opened 13 years ago Closed 13 years ago

sendSyncMessage fails with "SyntaxError: JSON.parse" if one of the listeners did not return a value

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b2

People

(Reporter: vingtetun, Assigned: vingtetun)

References

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
If you have multiple listeners on one message and if one of them doesn't return a value, sendSyncMessage throw an error.

The attached patch (2 lines) ignore the the retval if it has a length of zero which allow listener to return nothing and/or use "return;" to break the listener code if needed.
Attachment #447997 - Flags: review?(Olli.Pettay)
Attachment #447997 - Flags: review?(Olli.Pettay) → review+
do I need a sr? for this patch?
No.

I'll add some tests for this.
This bug is causing us some grief. Any idea when we can get it landed?
(In reply to comment #3)
> This bug is causing us some grief. Any idea when we can get it landed?

http://hg.mozilla.org/mozilla-central/rev/d1c910f2ec4d
I backed this out because it seemed to be causing a lot more crashes in the messageManager tests:
http://hg.mozilla.org/mozilla-central/rev/ef715f78e927
Huh. What kind of crashes?
I've re-runned all the tests yesterday and everything seems fine (http://ftp.mozilla.org/pub/mozilla.org/firefox/tryserver-builds/vnicolas@mozilla.com-e2346fa5faaa/).

I really think the crashes were from an other point, and now that messageManager is very stable, if we start to see crashes again we can consider this bug as the root cause but it is unlikely.

http://hg.mozilla.org/mozilla-central/rev/adaf0592cdfa
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
backed out because of test_bug549682.xul failures
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: nobody → 21
Ok, one line change to prevent the return value to have crazy pointer that cause 
the crash.

http://hg.mozilla.org/mozilla-central/rev/5252602a7e19
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b2
You need to log in before you can comment on or make changes to this bug.