Skip to content

Commit

Permalink
Fix Capture on reaload
Browse files Browse the repository at this point in the history
  • Loading branch information
sebavan committed Oct 14, 2024
1 parent 39c2c75 commit 32d805a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
1 change: 1 addition & 0 deletions documentation/changeLogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.32
* Fix [Capture on Reload](https://github.com/BabylonJS/Spector.js/issues/313)

## v0.9.31
* Fix [Manifest V2](https://github.com/BabylonJS/Spector.js/issues/312)
Expand Down
32 changes: 5 additions & 27 deletions extensions/contentScriptProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,7 @@ var spectorCommunicationRebuildProgramElementId = "SPECTOR_COMMUNICATION_REBUILD

var spectorContextTypeKey = "__spector_context_type";

var captureOnLoad = false;
var captureOnLoadTransient = false;
var captureOnLoadQuickCapture = false;
var captureOnLoadFullCapture = false;
var captureOnLoadCommandCount = 500;
var captureOffScreen = false;

if (sessionStorage.getItem(spectorCaptureOnLoadKey) === "true") {
sessionStorage.setItem(spectorCaptureOnLoadKey, "false");
captureOnLoad = true;

captureOnLoadTransient = (sessionStorage.getItem(spectorCaptureOnLoadTransientKey) === "true");
captureOnLoadQuickCapture = (sessionStorage.getItem(spectorCaptureOnLoadQuickCaptureKey) === "true");
captureOnLoadFullCapture = (sessionStorage.getItem(spectorCaptureOnLoadFullCaptureKey) === "true");
captureOnLoadCommandCount = parseInt(sessionStorage.getItem(spectorCaptureOnLoadCommandCountKey));
}

captureOffScreen = (sessionStorage.getItem(captureOffScreenKey) === "true");
var captureOffScreen = (sessionStorage.getItem(captureOffScreenKey) === "true");

var frameId = null;

Expand Down Expand Up @@ -199,15 +182,10 @@ listenForMessage(function (message) {

// We need to reload to inject the capture loading sequence.
if (action === "captureOnLoad") {
var transient = message.transient;
var commandCount = message.commandCount;
var quickCapture = message.quickCapture;
var fullCapture = message.fullCapture;

sessionStorage.setItem(spectorCaptureOnLoadTransientKey, transient);
sessionStorage.setItem(spectorCaptureOnLoadQuickCaptureKey, quickCapture);
sessionStorage.setItem(spectorCaptureOnLoadFullCaptureKey, fullCapture);
sessionStorage.setItem(spectorCaptureOnLoadCommandCountKey, commandCount);
sessionStorage.setItem(spectorCaptureOnLoadTransientKey, message.transient);
sessionStorage.setItem(spectorCaptureOnLoadQuickCaptureKey, message.quickCapture);
sessionStorage.setItem(spectorCaptureOnLoadFullCaptureKey, message.fullCapture);
sessionStorage.setItem(spectorCaptureOnLoadCommandCountKey, message.commandCount);
sessionStorage.setItem(spectorCaptureOnLoadKey, "true");

// Delay for all frames.
Expand Down

0 comments on commit 32d805a

Please sign in to comment.