[wp-trac] [WordPress Trac] #39612: (Resolve) Error due to Backbone.History being started again

WordPress Trac noreply at wordpress.org
Sun Jan 22 09:47:21 UTC 2017


#39612: (Resolve) Error due to Backbone.History being started again
-------------------------------------+------------------------------
 Reporter:  tfrommen                 |       Owner:  adamsilverstein
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.8
Component:  Administration           |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  javascript
-------------------------------------+------------------------------

Comment (by tfrommen):

 So, here are the details on how the above plugins start the history...


 ----


 '''an-gradebook/js/app/router/GradeBookRouter.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''buddydrive/includes/js/buddydrive-app.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''cf-whiteboard/js/all-athletes.js:'''

 {{{
 Backbone.history.start({
     root: CFW_OPTIONS.athletes_page_path,
     pushState: ! 0
 });
 }}}

 '''clinked-client-portal/app/clinked-portal.js:'''

 {{{
 Backbone.history.start({
     silent: true
 });
 }}}

 This plugin also ships Backbone itself - which is far from ideal, of
 course.

 '''collaborate-notes/admin/js/collaborate-notes-admin.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''custom-contact-forms/assets/build/js/form-manager.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''custom-contact-forms/assets/js/manager/app.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''custom-contact-forms/build/js/form-manager.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''easing-slider/resources/assets/js/admin.js:'''

 {{{
 Backbone.history.start({
     root: window._easingsliderAdminL10n.admin_url,
     pushState: true
 });
 }}}

 '''easy-appointments/js/admin-router.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''et-mailing/inc/ae/assets/js/option-view.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''frames-video-gallery/admin/scripts/script-0.1.5.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''gust/assets/helpers.js:'''

 {{{
 Backbone.history.start({
     root: '/ghost',
     hashChange: false,
     pushState: true
 });
 }}}

 '''icegram/assets/js/gallery.min.js:'''

 I was unable to find any reference to `Backbone.history` in trunk.

 '''krux-apps/views/admin_page.php:'''

 {{{
 Backbone.history.start();
 }}}

 '''krux-smb/views/admin_page.php:'''

 This plugin's [https://plugins.svn.wordpress.org/krux-smb/ SVN repository]
 is empty?!

 '''mainwp/js/mainwp-theme.js:'''

 {{{
 Backbone.history.start({
     root: themes.data.settings.adminUrl,
     hashChange: false,
     pushState: true
 });
 }}}

 '''mobilechief-mobile-site-
 creator/lib/fontawesome/docs/assets/js/index/index.js:'''

 {{{
 Backbone.history.start({
     pushState: false
 });
 }}}

 '''multilingual-press/assets/js/admin.js:'''

 {{{
 Backbone.history.start({
     root: this.settings.urlRoot,
     hashChange: false,
     pushState: true
 });
 }}}

 MultilingualPress '''does''' check if the history has been started
 already, but this is not enough if MultilingualPress runs before WordPress
 core - which is exactly the reason why I created this ticket in the first
 place. This is the [https://github.com/inpsyde/multilingual-
 press/issues/249 GitHub issue].

 '''picu/frontend/js/picu-app.js:'''

 {{{
 Backbone.history.start({
     pushState: false
 });
 }}}

 '''plugins-enabler/js/app.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''pocha-slider/js/editor-pages.js:'''

 {{{
 Backbone.history.start({
     root: window._wpMediaGridSettings.adminUrl,
     pushState: true
 });
 }}}

 '''posts-timeline/post-timeline/poststimeline.php:'''

 {{{
 Backbone.history.start();
 }}}

 '''qoob/qoob/js/qoob.js:'''

 {{{
 Backbone.history.start({
     pushState: false
 });
 }}}

 '''rainbowpaypress/RainbowPayPress.php:'''

 {{{
 backbone.history.start();
 }}}

 '''sendpress/js/spnl-backbone.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''simple-history/js/scripts.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''street-view-comments/js/views.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''supercharts/scripts/js/wizard.min.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''thx38/thx-38.js:'''

 {{{
 Backbone.history.start({
     pushState: true,
     silent: true
 });
 }}}

 '''woocommerce-predictive-search/assets/js/predictive-search-
 results.backbone.min.js:'''

 {{{
 Backbone.history.start({
     root: wc_ps_results_vars.search_page_path,
     pushState: ! 0
 });
 }}}

 '''wp-backbone/static/js/app.run.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''wp-email-delivery/assets/js/admin.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''wp-ultimate-search/js/main-pro.js:'''

 {{{
 Backbone.history.start();
 }}}

 '''wp-ultimate-search/js/wpus-main.js:'''

 {{{
 Backbone.history.start();
 }}}


 ----


 A few observations:
 * there are '''no custom options''' defined;
 * all plugins that define a `root` different from WordPress core, are
 (hopefully) not active on the admin pages where core is (e.g., ''Media''),
 otherwise there should've been reports about either the plugin or core
 JavaScript not being functional;
 * similar to before, all plugins using `silent: true` shouldn not be
 active on the pages where core is;
 * the option `pushState: false` can be ignored, because this is the
 default anyway (Backbone sets the internal option to
 `!!options.pushState`, so there is no difference between having
 `undefined` and explicitly saying `false`);
 * almost '''none''' of the above plugins performs a check for an already
 started history itself.

 The last item is important, in my opinion, because it shows that there
 shouldn't ba any problem at all with having core stop and restart the
 history. The reason is simple: if the plugins's JavaScript was active on
 one or more of the pages where core is active, either the individual
 plugin or core would throw an `Error` - which would lead to some issues
 reported.

 So, I can only repeat: let's make stop the history (if started, of
 course), and restart it just like core requires it to be. In other words:
 apply the suggested patch. :)

 Any opinions on this?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39612#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list