Results 1 to 4 of 4

Thread: View controllers can cause fatal errors in production mode only

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-14596 in 5.1.0.47.
  1. #1
    Sencha User
    Join Date
    Aug 2014
    Posts
    2
    Vote Rating
    0
      0  

    Default View controllers can cause fatal errors in production mode only

    In a view controller, when registering string method which does not reference a method in existence to an event the following error is thrown when one tries to destroy the component:

    "Uncaught TypeError: Cannot read property 'fireFn' of undefined" in Chrome and "TypeError: j is undefined" in Firefox. Curiously this only happens in the production build but not in development or testing builds.

    This error causes the view to be only partially destroyed and leaves a view controller in existence. If this is listening to events which aren't upon child components (perhaps ones raised by a controller) unpredictable and hard to track down errors will occur as view controllers that should no longer exist will be attempting to respond to those events. The errors only seem to occur in production mode which presents a nightmare for the developer given the task of debugging the problems.

    One can reproduce the error with the opening following html page and closing the window (placed in the ext-5.0.1 or ext-5.0.0 directory of the downloaded ext trial source).

    HTML Code:
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="UTF-8">
    
    <title>cutdown</title>
    
    <!-- The line below must be kept intact for Sencha Cmd to build your application -->
    <script type="text/javascript" src="build/ext-all.js"></script>
    <link rel="stylesheet" type="text/css" href="build/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all-debug.css">
    <script type="text/javascript" src="build/packages/ext-theme-crisp/build/ext-theme-crisp.js" defer=""></script>
    <script>
    
        window.onload = function() {
            Ext.onReady(function() {
                Ext.define("CustController", {
                    extend : 'Ext.app.ViewController',
                    alias : 'controller.custcontroller',
                    control : {
                        'panel' : {
                            click : 'doesNotExist',
                        }
                    }
                });
    
                Ext.define("CustButton", {
                    extend : 'Ext.button.Button',
                    xtype : 'custbutton',
                    controller : 'custcontroller',
                    listeners: {
                        'destroy': function(){ console.log ("destroy"); },
                        'beforedestroy': function(){ console.log ("beforedestroy"); },
                        'close': function(){ console.log ("close"); },
                        'beforeclose': function(){ console.log ("beforeclose"); },
                    },
                    text : 'custom stuff'
                });
    
                var win = Ext.create("Ext.window.Window", {
                    title : 'test',
                    height : 300,
                    renderTo: document.body,
                    width : 300,
                    items : {
                        xtype : 'custbutton'
                    }
                });
                win.show();
            });
        };
    </script>
    
    </head>
    <body></body>
    </html>

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,854
    Vote Rating
    908
      0  

    Default

    The description for this isn't really correct. It will only cause an exception if you refer to a method that doesn't exist.
    Evan Trimboli
    Twitter - @evantrimboli

  3. #3
    Sencha User
    Join Date
    Aug 2014
    Posts
    2
    Vote Rating
    0
      0  

    Default

    Yes this is indeed correct. However the problems do not occur in development or testing modes.

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,854
    Vote Rating
    908
      0  

    Default

    I will open an improvement to assist with the error handling.
    Evan Trimboli
    Twitter - @evantrimboli

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •