From 361a9d7393bbe14c0f9690dacebd403feed792ae Mon Sep 17 00:00:00 2001 From: Paul Kaplan <pkaplan@media.mit.edu> Date: Mon, 11 Feb 2019 14:40:41 -0500 Subject: [PATCH] Make sure to put history in try/catch so it can be used with selenium Selenium loads the playground using the file:// protocol, where history.replaceState throws an error --- src/containers/sb-file-uploader.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/containers/sb-file-uploader.jsx b/src/containers/sb-file-uploader.jsx index 42e046ad5..d375ccb8a 100644 --- a/src/containers/sb-file-uploader.jsx +++ b/src/containers/sb-file-uploader.jsx @@ -128,7 +128,11 @@ class SBFileUploader extends React.Component { nonInteraction: true }); // Remove the hash if any (without triggering a hash change event or a reload) - history.replaceState({}, document.title, '.'); + try { // Can fail e.g. when GUI is loaded from static file (integration tests) + history.replaceState({}, document.title, '.'); + } catch { + // No fallback, just do not trigger promise catch below + } this.props.onLoadingFinished(this.props.loadingState, true); // Reset the file input after project is loaded // This is necessary in case the user wants to reload a project -- GitLab