Last Comment Bug 397595 - When including JSON in a dialog then .toJSONString is treated as button
: When including JSON in a dialog then .toJSONString is treated as button
Status: NEW
:
Product: Toolkit
Classification: Components
Component: XUL Widgets (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-25 18:06 PDT by Tom Aratyn
Modified: 2008-03-04 04:52 PST (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Tom Aratyn 2007-09-25 18:06:12 PDT
I've created a dialog box that includes JSON.

Expected Results:
1. open a dialog
2. no errors

Actual results:
1. open a dialog
2. error console says "Error: button.addEventListener is not a function
Source file: chrome://global/content/bindings/dialog.xml
Line: 224"

When a break is put on line 224 of dialog.xml then you'll notice dlgtype has the value toJSONString (the same name as a helper string JSON.js adds).

Experianced on:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty)

This problem is caused by JSON's overriding Object's prototype not a bug in Moz, except in so much as it would be nice to provide a facility to do these kinds of extensions without breaking anything. 

to use JSON.jsm is the correct solution here.
Comment 1 Dave Townsend [:mossop] 2007-09-25 18:12:20 PDT
Fixing this properly basically involves us making the entire Firefox UI safe from extensions manipulating the Object prototype. Might be nice at some point but I think the appropriate solution at this stage is just to discourage extension authors from doing such things, I've certainly discouraged them whenever I've heard of it already.
Comment 2 Nickolay_Ponomarev 2007-09-26 08:33:20 PDT
Should this bug be about making the dialog binding use hasOwnProperty in its for..in loop?

Note You need to log in before you can comment on or make changes to this bug.