accelerate basic JSONP scripts




JavaScript Engine
7 years ago
4 years ago


(Reporter: sfink, Unassigned)


Firefox Tracking Flags

(Not tracked)


EvalKernel currently has a heuristic for trying to compile a script as JSON if it is surrounded by parens. Could this be extended to handle \w*\(...\) as well, for JSONP?

Specifically, you'd look for 0 or more word chars followed by an open paren and the whole string ended with a close paren. If the len(word)==0, you do what we do now. If len(word)>0 and word is not a keyword (is this check even necessary?), you try the JSON parse and if it succeeds, you construct a script that arranges for the decoded data structure to be passed into whatever word compiles to.

I'm partly asking just out of curiosity: is there a reason why this wouldn't work? I recognize that it's quite a bit of noncritical complexity. And JSONP may be a little dated with the rise of JSON.parse. It seems like people really ought to start using "JSONPQ" (quoted padded JSON) callbacks that make the server return callbackFunc('...') instead of JSONP's callbackFunc(...).


4 years ago
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.