Index: content/browser/tracing/tracing_ui.cc |
diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc |
index 87f2f9363168866d9ed392a637d8a7549b9226b9..062d6da35f236c996237fef1242686624b531ecd 100644 |
--- a/content/browser/tracing/tracing_ui.cc |
+++ b/content/browser/tracing/tracing_ui.cc |
@@ -89,7 +89,8 @@ class TracingMessageHandler |
void OnGetKnownCategories(const base::ListValue* list); |
// Callbacks. |
- void LoadTraceFileComplete(string16* file_contents); |
+ void LoadTraceFileComplete(string16* file_contents, |
+ const base::FilePath &path); |
void SaveTraceFileComplete(); |
private: |
@@ -121,9 +122,10 @@ class TaskProxy : public base::RefCountedThreadSafe<TaskProxy> { |
public: |
explicit TaskProxy(const base::WeakPtr<TracingMessageHandler>& handler) |
: handler_(handler) {} |
- void LoadTraceFileCompleteProxy(string16* file_contents) { |
+ void LoadTraceFileCompleteProxy(string16* file_contents, |
+ const base::FilePath& path) { |
if (handler_) |
- handler_->LoadTraceFileComplete(file_contents); |
+ handler_->LoadTraceFileComplete(file_contents, path); |
delete file_contents; |
} |
@@ -258,7 +260,8 @@ void ReadTraceFileCallback(TaskProxy* proxy, const base::FilePath& path) { |
BrowserThread::PostTask( |
BrowserThread::UI, FROM_HERE, |
base::Bind(&TaskProxy::LoadTraceFileCompleteProxy, proxy, |
- contents16.release())); |
+ contents16.release(), |
+ path)); |
} |
// A callback used for asynchronously writing a file from a string. Calls the |
@@ -325,7 +328,8 @@ void TracingMessageHandler::OnLoadTraceFile(const base::ListValue* list) { |
NULL); |
} |
-void TracingMessageHandler::LoadTraceFileComplete(string16* contents) { |
+void TracingMessageHandler::LoadTraceFileComplete(string16* contents, |
+ const base::FilePath& path) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
// We need to pass contents to tracingController.onLoadTraceFileComplete, but |
@@ -345,8 +349,12 @@ void TracingMessageHandler::LoadTraceFileComplete(string16* contents) { |
javascript += contents->substr(i, kMaxSize) + suffix; |
rvh->ExecuteJavascriptInWebFrame(string16(), javascript); |
} |
+ |
+ // The CallJavascriptFunction is not used because we need to pass |
+ // the first param |window.traceData| through as an un-quoted string. |
rvh->ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16( |
- "tracingController.onLoadTraceFileComplete(window.traceData);" |
+ "tracingController.onLoadTraceFileComplete(window.traceData," + |
+ base::GetDoubleQuotedJson(path.value()) + ");" + |
"delete window.traceData;")); |
} |