From 50c9f628900423e6d8c2ae542892e60524f8f6bf Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Fri, 4 Dec 2020 11:39:26 -0800 Subject: [PATCH] screenshot.png works! (when focused, when you kill old debugger) --- extension/background.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extension/background.js b/extension/background.js index 0924e56..1932075 100644 --- a/extension/background.js +++ b/extension/background.js @@ -171,7 +171,9 @@ router["/tabs/by-id/*/screenshot.png"] = { await sendDebuggerCommand(tabId, "Page.enable", {}); const {data} = await sendDebuggerCommand(tabId, "Page.captureScreenshot"); - return { buf: utf8(atob(data), offset, size) }; + const arr = Uint8Array.from(atob(data), c => c.charCodeAt(0)); + const slice = arr.slice(offset, offset + size); + return { buf: String.fromCharCode(...slice) }; } }; router["/tabs/by-id/*/resources"] = {