Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(756)

Unified Diff: content/browser/debugger/devtools_http_handler_impl.cc

Issue 10830259: DevTools: support JSONP mode in /json remote debugging discovery. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/debugger/devtools_http_handler_impl.cc
diff --git a/content/browser/debugger/devtools_http_handler_impl.cc b/content/browser/debugger/devtools_http_handler_impl.cc
index 819cd523c223a5f05bd06b42f3b1cdb7871e34d7..aacf2ea3f05df2c0440017ee50fe746029450b22 100644
--- a/content/browser/debugger/devtools_http_handler_impl.cc
+++ b/content/browser/debugger/devtools_http_handler_impl.cc
@@ -428,7 +428,16 @@ void DevToolsHttpHandlerImpl::OnJsonRequestUI(
base::JSONWriter::WriteWithOptions(&json_pages_list,
base::JSONWriter::OPTIONS_PRETTY_PRINT,
&response);
- Send200(connection_id, response, "application/json; charset=UTF-8");
+
+ size_t jsonp_pos = info.path.find("?jsonp=");
+ if (jsonp_pos == std::string::npos) {
+ Send200(connection_id, response, "application/json; charset=UTF-8");
+ return;
+ }
+
+ std::string jsonp = info.path.substr(jsonp_pos + 7);
+ response = StringPrintf("%s(%s);", jsonp.c_str(), response.c_str());
+ Send200(connection_id, response, "text/javascript; charset=UTF-8");
}
void DevToolsHttpHandlerImpl::OnWebSocketRequestUI(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698