JSON and Firefox sessionstore.js

Matt Nordhoff mnordhoff at mattnordhoff.com
Sat Apr 25 05:32:47 CEST 2009


Steven D'Aprano wrote:
> On Thu, 23 Apr 2009 05:08:35 +0100, I V wrote:
> 
>> For something with at least a vague air of credibility to it, somebody
>> who appears to be a Mozilla developer comments on their bug tracker,
>> that sessionstore.js isn't "pure JSON" (though he only identifies the
>> parantheses, which are much easier to fix, as being a problem):
>>
>> https://bugzilla.mozilla.org/show_bug.cgi?id=407110#c2
> 
> Ah, fantastic! Or rather, damn, I was hoping it was proper JSON and not 
> some sort of bizarre mutant.
> 
> For what it's worth, removing the leading/trailing parentheses gives a 
> different error:

<snip traceback>

> Presumably that's the error you get when you don't quote your property 
> names properly.

That bug is about changing it *to* JSON-plus-parentheses. The patch
landed [1] (and was subsequently backed out [2] and landed again [3]) in
time for Firefox 3.5, but unless you're running that, it's still
JavaScript source code, generated by toSource() [4]:

<http://hg.mozilla.org/mozilla-central/file/743136ef83d9/browser/components/sessionstore/src/nsSessionStore.js#l2221>
(<http://xrl.us/beqbpo>)

[1] <http://hg.mozilla.org/mozilla-central/rev/10c21d116e5d>
[2] <http://hg.mozilla.org/mozilla-central/rev/04c360f123e5>
[3] <http://hg.mozilla.org/mozilla-central/rev/22074494eef3>
[4]
<https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Global_Objects/Function/ToSource>
(<http://xrl.us/beqbo7>)
-- 



More information about the Python-list mailing list