gbishop / outfox

Automatically exported from code.google.com/p/outfox
Other
1 stars 0 forks source link

Support for 3rd party JSON encoder/decoder #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The outfox.js file includes a copy of the public domain reference
implementation of the JavaScript JSON encoder/decoder from json.org. We
should make this an optional component. Other libraries like jQuery, Dojo,
etc. have their own implementations which are probably significantly
faster. By default, outfox.js might look for the ref impl. functions to
use, but a developer could override by specifying exactly what functions to
call when a decode / encode is needed.

Original issue reported on code.google.com by c...@unc.edu on 31 Aug 2008 at 2:00

GoogleCodeExporter commented 9 years ago
FYI Firefox itself comes with 2 JSON codecs, one JS one in modules and the 
native
XPCOM @mozilla.org/dom/json;1 nsIJSON. I'm using the latter which so far seems
compatible with Crockford's JSON2 reference implementation.

Note neither do much syntax checking which is a bit of a pain when parse files
created by 'users'.

Original comment by SteveA...@gmail.com on 7 Sep 2008 at 9:00

GoogleCodeExporter commented 9 years ago
Can you access the XPCOM one from in-page JS? When I've tried in the past, I've
gotten security errors.

var ij =
Components.classes["@mozilla.org/dom/json;1"].createInstance(Components.interfac
es.nsIJSON);
Error: Permission denied to get property XPCComponents.classes

I have a feeling there's some magic mojo I have to do first to make it work ...

Original comment by c...@unc.edu on 9 Sep 2008 at 11:48

GoogleCodeExporter commented 9 years ago
Is that in XUL pages? AFAIK [X]HTML never has privileges. 
If the page is installed in the Chrome then it should have full privileges. If 
it is
remote you won't unless it signed (dunno how).

If this is the case and it's not working you check you are using a chrome URL to
access the page. e.g chrome://outfox/content/... according to you manifest. I 
seem to
recall noticing you don't do that in some cases and perhaps that's part of the 
way it
decides.

You may hit the same problems with the module one as that is accessed through
Components.utils.import().

Original comment by SteveA...@gmail.com on 10 Sep 2008 at 8:10

GoogleCodeExporter commented 9 years ago
This bug is about JSON encode/decode in the web page.

The solution will be to rip the JSON2 implementation out of outfox.js, and 
require
the web developer to register the encode/decode functions they want to use on 
the
call to outfox.init(). When Mozilla grows support for native JSON parsing on 
the DOM
(https://bugzilla.mozilla.org/show_bug.cgi?id=408838) that will become the 
default,
but the user can still override by passing the params to init.

Original comment by c...@unc.edu on 13 Sep 2008 at 3:40

GoogleCodeExporter commented 9 years ago
In services branch rev 110

Original comment by c...@unc.edu on 23 Nov 2008 at 6:23