Closed Bug 662429 Opened 13 years ago Closed 5 months ago

accelerate basic JSONP scripts

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: sfink, Unassigned)

Details

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(...).
Assignee: general → nobody
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.