JavaScript: when starting Backbone history, stop if previously started.

Prevent a potential error condition if Backbone history is started by a plugin or theme before core tries to start it. 

Props tfrommen.
Fixes #39612.


git-svn-id: https://develop.svn.wordpress.org/trunk@40076 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
adamsilverstein
2017-02-17 21:59:37 +00:00
parent 0efaf5ddc5
commit 0d73b031c8
4 changed files with 15 additions and 0 deletions

View File

@@ -844,6 +844,9 @@ Manage = MediaFrame.extend({
startHistory: function() {
// Verify pushState support and activate
if ( window.history && window.history.pushState ) {
if ( Backbone.History.started ) {
Backbone.history.stop();
}
Backbone.history.start( {
root: window._wpMediaGridSettings.adminUrl,
pushState: true

View File

@@ -259,6 +259,9 @@ Manage = MediaFrame.extend({
startHistory: function() {
// Verify pushState support and activate
if ( window.history && window.history.pushState ) {
if ( Backbone.History.started ) {
Backbone.history.stop();
}
Backbone.history.start( {
root: window._wpMediaGridSettings.adminUrl,
pushState: true