javascript - Backbone App Crash on Navigate -


i have single-page-app built backbone.js has multiple views in it, , app crashes when transitioning between views. when app crashes, browser not crash, app, browser displays message chrome's "oops" screen. crash forces user 'reload' refresh page, whatever working on lost if hadn't saved. crash intermittent , hard reproduce.

code:

to accomplish these transitions without navigation tab, create event-aggregator (or simple 'state-machine') in router so:

eventaggregator: _.extend({}, backbone.events), 

i set-up router listen multiple events, example:

this.eventaggregator.on("movetopage1", function () {                 this.navigate("page1", {trigger: true});             }); this.eventaggregator.on("movetopage1", function () {                 this.navigate("page2", {trigger: true});             }); 

so routes this:

routes: {             "page1": "viewpage1",             "page2": "viewpage2", }, 

when routes navigated-to basic stuff hide modals , showing/hiding of views, , refresh kendoui grids on of views:

viewpage1: function(){     $(window).trigger('closemodal');     $(window).trigger('minimize');     /* hide views */     _.each(this.views, function (view) {         view.$el.hide();     });     page1.$el.show();     //for kendo ui grids                 $(window).trigger("realwindowresize");      $(window).trigger("refreshgrid"); } 

then pass 'eventaggregator' object each view. view can have event-hookup button trigger event so:

eventaggregator.trigger("movetopage2"); 

other thoughts:

(not sure if of useful information, thought might explain things i've considered, or looked me solve issue)

  • two of pages normal backbone views, , 2 of them views kendo ui grids in them (not sure if relevant or not). refresh grids when page transitions.
  • i have done memory profiling , monitored memory footprint of app, , there's no evidence of memory leak.
  • when app crashes there @ least 1 ajax call left 'pending' because sent before app crashed.
  • one tester believes saw crash when pressing 'cancel' button. 1 unique test result, , interesting because cancel button not use event-pattern shown above, has attribute href="#homepage" in html.
  • sometimes bug seems easy reproduce after leaving browser idle period of time, not always. reproducible @ times while under heavy use. (in both cases, memory profiling shows nothing remarkable).
  • if litter javascript code console.log() statements, there 1 statement printed out before crash. basic code handling realwindowresize event created. however, if remove code raise event, app still crash (seems have same frequency before), though code no longer being touched. leads me believe weird timing issue...

what causing crash of type? ideas how can further debug issue? help...


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -