Commit 8195304e authored by manukh's avatar manukh Committed by Commit Bot

[chrome://omnibox] [omnibox] Format copied and downloaded JSONs.

Previously, the download results and console printed error messages were
formatted (indentation and new lines). However, the copy results and
download 'Additional Info's were not formatted. This CL fixes those 2
cases as well.

Change-Id: Ia14634f8d072293aa88ac226f91fcc62a47cea60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992356Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: manuk hovanesian <manukh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729798}
parent 176656a0
......@@ -314,8 +314,8 @@ class ExportDelegate {
}
exportClipboard() {
navigator.clipboard.writeText(JSON.stringify(this.exportData_)).catch(
error => console.error('unable to export to clipboard:', error));
navigator.clipboard.writeText(JSON.stringify(this.exportData_, null, 2))
.catch(error => console.error('unable to export to clipboard:', error));
}
exportFile() {
......
......@@ -877,7 +877,8 @@ class OutputAdditionalInfoProperty extends OutputProperty {
obj[key] = value;
return obj;
}, {});
const obj64 = btoa(unescape(encodeURIComponent(JSON.stringify(obj))));
const text = JSON.stringify(obj, null, 2);
const obj64 = btoa(unescape(encodeURIComponent(text)));
return `data:application/json;base64,${obj64}`;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment