WordPress.org

Make WordPress Core

Changeset 40076


Ignore:
Timestamp:
02/17/17 21:59:37 (5 months ago)
Author:
adamsilverstein
Message:

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.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/revisions.js

    r36709 r40076  
    412412            if ( window.history && window.history.pushState ) { 
    413413                this.router = new revisions.Router({ model: this }); 
     414                if ( Backbone.History.started ) { 
     415                    Backbone.history.stop(); 
     416                } 
    414417                Backbone.history.start({ pushState: true }); 
    415418            } 
  • trunk/src/wp-admin/js/theme.js

    r39586 r40076  
    14321432        this.routes(); 
    14331433 
     1434        if ( Backbone.History.started ) { 
     1435            Backbone.history.stop(); 
     1436        } 
    14341437        Backbone.history.start({ 
    14351438            root: themes.data.settings.adminUrl, 
     
    18851888        this.routes(); 
    18861889 
     1890        if ( Backbone.History.started ) { 
     1891            Backbone.history.stop(); 
     1892        } 
    18871893        Backbone.history.start({ 
    18881894            root: themes.data.settings.adminUrl, 
  • trunk/src/wp-includes/js/media-grid.js

    r37722 r40076  
    845845        // Verify pushState support and activate 
    846846        if ( window.history && window.history.pushState ) { 
     847            if ( Backbone.History.started ) { 
     848                Backbone.history.stop(); 
     849            } 
    847850            Backbone.history.start( { 
    848851                root: window._wpMediaGridSettings.adminUrl, 
  • trunk/src/wp-includes/js/media/views/frame/manage.js

    r37722 r40076  
    260260        // Verify pushState support and activate 
    261261        if ( window.history && window.history.pushState ) { 
     262            if ( Backbone.History.started ) { 
     263                Backbone.history.stop(); 
     264            } 
    262265            Backbone.history.start( { 
    263266                root: window._wpMediaGridSettings.adminUrl, 
Note: See TracChangeset for help on using the changeset viewer.