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
This commit is contained in:
Paul Kaplan committed 2019-02-11 14:40:41 -05:00
1 parent 29e738cb92
commit 361a9d7393
1 file changed
+5 -1
+5 -1
View File
@@ -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