From ac081e3ff016e1378ae7729494a3c5a79c08c4f9 Mon Sep 17 00:00:00 2001 From: sebavan Date: Tue, 8 Jun 2021 21:01:08 +0200 Subject: [PATCH] Fix Drag and Drop captures --- documentation/changeLogs.md | 1 + extensions/background.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/documentation/changeLogs.md b/documentation/changeLogs.md index dee74ff..477fcec 100644 --- a/documentation/changeLogs.md +++ b/documentation/changeLogs.md @@ -5,6 +5,7 @@ Please, find below the per release summary of the contribution added to the project per version. Each of the listed versions is having its corresponding tag in the repo. ## v0.9.25 +* [Fix Drag and Drop captures in the main extension popup](https://github.com/BabylonJS/Spector.js/issues/199) ## v0.9.24 * Chrome web Store policy change diff --git a/extensions/background.js b/extensions/background.js index 7dea70d..310d69a 100644 --- a/extensions/background.js +++ b/extensions/background.js @@ -115,6 +115,16 @@ listenForMessage(function(request, sender, sendResponse) { popup.captureComplete(request.errorString); } } + else if (request.capture) { + var capture = request.capture; + // Open the result view if not open (need to check if length == 1 that the function exists for Edge), + window.browser.tabs.create({ url: "result.html", active: true }, function(tab) { + resultTab = tab; + currentCapture = capture; + currentFrameId = frameId; + currentTabId = sender.tab.id; + }); + } else if (request.captureChunk) { currentCaptureChunks.push(request.captureChunk); } @@ -124,8 +134,6 @@ listenForMessage(function(request, sender, sendResponse) { currentCaptureChunks = []; var fullJSON = "".concat.apply("", allChunks); var capture = JSON.parse(fullJSON); - // If a capture has been received, - var tabWindows = browser.extension.getViews({type: "tab"}); // Open the result view if not open (need to check if length == 1 that the function exists for Edge), window.browser.tabs.create({ url: "result.html", active: true }, function(tab) { resultTab = tab;