diff --git a/ChangeLog.md b/ChangeLog.md index c8f817fd..0a0bdf29 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,6 @@ #2.2.15 * Ensure that standard slots are repainted when any component changes + * Reload page if Safari throws a security error #2.2.14 * Ensure that jitter is shown correctly when the result of a special effect diff --git a/package.json b/package.json index 6a7e98fd..47a523c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coriolis_shipyard", - "version": "2.2.14", + "version": "2.2.15b", "repository": { "type": "git", "url": "https://github.com/EDCD/coriolis" diff --git a/src/app/Router.js b/src/app/Router.js index acf588c3..6ac0e612 100644 --- a/src/app/Router.js +++ b/src/app/Router.js @@ -76,7 +76,16 @@ Router.go = function(path, state) { if (isStandAlone()) { Persist.setState(ctx); } - history.pushState(ctx.state, ctx.title, ctx.canonicalPath); + try { + history.pushState(ctx.state, ctx.title, ctx.canonicalPath); + } catch (ex) { + sessionStorage.setItem('__safari_history_fix', JSON.stringify({ + state: ctx.state, + title: ctx.title, + path: ctx.canonicalPath + })); + location.reload(); + } } return ctx; }; @@ -99,7 +108,16 @@ Router.replace = function(path, state, dispatch) { if (isStandAlone()) { Persist.setState(ctx); } - history.replaceState(ctx.state, ctx.title, ctx.canonicalPath); + try { + history.replaceState(ctx.state, ctx.title, ctx.canonicalPath); + } catch (ex) { + sessionStorage.setItem('__safari_history_fix', JSON.stringify({ + state: ctx.state, + title: ctx.title, + path: ctx.canonicalPath + })); + location.reload(); + } return ctx; }; diff --git a/src/app/pages/OutfittingPage.jsx b/src/app/pages/OutfittingPage.jsx index f0c5f088..46401c6b 100644 --- a/src/app/pages/OutfittingPage.jsx +++ b/src/app/pages/OutfittingPage.jsx @@ -348,13 +348,13 @@ export default class OutfittingPage extends Page { - - + + - - - - + + + +
diff --git a/src/app/pages/Page.jsx b/src/app/pages/Page.jsx index ca1a1d48..7f8b5d31 100644 --- a/src/app/pages/Page.jsx +++ b/src/app/pages/Page.jsx @@ -39,6 +39,14 @@ export default class Page extends React.Component { this[prop] = this[prop].bind(this); } }); + + let fix = sessionStorage.getItem('__safari_history_fix'); + sessionStorage.removeItem('__safari_history_fix'); + if (fix) { + fix = JSON.parse(fix); + history.replaceState(history.state, document.title, location.href); + history.pushState(fix.state, fix.title, fix.path); + } } /** @@ -82,4 +90,4 @@ export default class Page extends React.Component { return this.renderPage(); } -} \ No newline at end of file +}