commit | 1128ca046380b634de41a54b52937eee68c54ef8 | [log] [tgz] |
---|---|---|
author | Vidal Guillermo Diazleal Ortega <vidorteg@microsoft.com> | Tue Mar 29 21:27:44 2022 |
committer | Devtools-frontend LUCI CQ <devtools-frontend-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Mar 30 16:46:30 2022 |
tree | 95ac81926f4f4f4c847497544504b7190fdd93ad | |
parent | b9cf32266c13497d65eb8a52ed8eab33a4b040e6 [diff] |
Correctly decoding Network Tab -> Response (non-ASCII) Issue: When the response content contains non ascii characters the content displayed in the Network Tab -> Response Panel has garbled characters. This is due to incorrectly using `atob` function to decode non-ascii characters, fix is to decode base64 using characters codes instead. Before: https://i.imgur.com/kXyXxlA.png After: https://i.imgur.com/kUIfNZ0.png Bug: 1311395 Change-Id: I321631dd523b1b8392312f027a608fb3ab8851a7 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3558020 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
diff --git a/front_end/ui/legacy/components/source_frame/SourceFrame.ts b/front_end/ui/legacy/components/source_frame/SourceFrame.ts index 3e0bb19..6d3a935 100644 --- a/front_end/ui/legacy/components/source_frame/SourceFrame.ts +++ b/front_end/ui/legacy/components/source_frame/SourceFrame.ts
@@ -444,7 +444,13 @@ this.rawContent = deferredContent.error; } else { content = deferredContent.content; - this.rawContent = deferredContent.isEncoded ? window.atob(deferredContent.content) : deferredContent.content; + if (deferredContent.isEncoded) { + const view = new DataView(Common.Base64.decode(deferredContent.content)); + const decoder = new TextDecoder(); + this.rawContent = decoder.decode(view, {stream: true}); + } else { + this.rawContent = deferredContent.content; + } } progressIndicator.setWorked(1);