Closed
Bug 967393
Opened 10 years ago
Closed 10 years ago
Make the jsonp regex a bit more relaxed
Categories
(DevTools :: Netmonitor, defect)
DevTools
Netmonitor
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 30
People
(Reporter: vporof, Assigned: vporof)
Details
(Whiteboard: [qa-])
Attachments
(2 files)
9.05 KB,
patch
|
rcampbell
:
review+
|
Details | Diff | Splinter Review |
51.25 KB,
image/png
|
Details |
I've seen jsonp requests in the wild (like on http://www.nytimes.com/) that don't strictly adhere to the jsonp syntax, but they're still valid javascript, so they work. Our regex to identify those requests is very strict. We should gracefully handle all types of jsonp.
Assignee | ||
Comment 1•10 years ago
|
||
Assignee | ||
Comment 2•10 years ago
|
||
Visualization for the new regex.
Assignee | ||
Updated•10 years ago
|
Attachment #8369965 -
Attachment description: regex → new regex
Assignee | ||
Comment 3•10 years ago
|
||
As a clarification, the first captured group is the jsonp callback, and the second group is the actual json object passed as a param to the callback.
Comment 4•10 years ago
|
||
Comment on attachment 8369923 [details] [diff] [review] v1 Review of attachment 8369923 [details] [diff] [review]: ----------------------------------------------------------------- r+. just add some description to that regex and this is good to go. ::: browser/devtools/netmonitor/netmonitor-view.js @@ +2138,5 @@ > jsonObjectParseError = e; > } > if (jsonMimeType || jsonObject) { > // Extract the actual json substring in case this might be a "JSONP". > + let jsonpRegex = /^\s*([\w$]+)\s*\(\s*([^]*)\s*\)\s*;?\s*$/; can you describe what this regex is doing in a comment, please? Having to decode this is cruel.
Attachment #8369923 -
Flags: review?(rcampbell) → review+
Comment 5•10 years ago
|
||
maybe you can data-uri-encode that png as documentation. ;)
Comment 6•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b96fb0f79460
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 30
Updated•10 years ago
|
Whiteboard: [qa-]
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•