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

Unified Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 2039013002: [DevTools] Fix problem with loading source maps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 | third_party/WebKit/Source/devtools/front_end/devtools.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_ui_bindings.cc
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc
index b035e7f19410c3309b989ebf99fe6d9842e9f464..d8636d9106033555e9be8550e81472f16c206923 100644
--- a/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <utility>
+#include "base/base64.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/json/string_escape.h"
@@ -267,17 +268,21 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) {
std::string chunk = std::string(buffer->data(), num_bytes);
- if (!base::IsStringUTF8(chunk))
- return num_bytes;
+ bool encoded = false;
+ if (!base::IsStringUTF8(chunk)) {
+ encoded = true;
+ base::Base64Encode(chunk, &chunk);
+ }
base::FundamentalValue* id = new base::FundamentalValue(stream_id_);
base::StringValue* chunkValue = new base::StringValue(chunk);
+ base::FundamentalValue* encodedValue = new base::FundamentalValue(encoded);
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
- base::Bind(&DevToolsUIBindings::CallClientFunction,
- bindings_, "DevToolsAPI.streamWrite",
- base::Owned(id), base::Owned(chunkValue), nullptr));
+ base::Bind(&DevToolsUIBindings::CallClientFunction, bindings_,
+ "DevToolsAPI.streamWrite", base::Owned(id),
+ base::Owned(chunkValue), base::Owned(encodedValue)));
return num_bytes;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/devtools.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698