Merge pull request #1037 from omakasecorp/next

Force redirect when pushState encounters an error
This commit is contained in:
Leo Horie 2016-05-11 11:53:36 -04:00
commit 0c19bf72ee

View file

@ -1617,8 +1617,16 @@
var method = replaceHistory ? "replaceState" : "pushState" var method = replaceHistory ? "replaceState" : "pushState"
computePreRedrawHook = setScroll computePreRedrawHook = setScroll
computePostRedrawHook = function () { computePostRedrawHook = function () {
global.history[method](null, $document.title, try {
modes[m.route.mode] + currentRoute) global.history[method](null, $document.title,
modes[m.route.mode] + currentRoute)
} catch (err) {
// In the event of a pushState or replaceState failure,
// fallback to a standard redirect. This is specifically
// to address a Safari security error when attempting to
// call pushState more than 100 times.
$location[m.route.mode] = currentRoute
}
} }
redirect(modes[m.route.mode] + currentRoute) redirect(modes[m.route.mode] + currentRoute)
} else { } else {