Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-8568 in a recent build.
  1. #1
    Sencha Premium Member
    Join Date
    Mar 2007
    Posts
    64
    Vote Rating
    2
    ojintoad is on a distinguished road

      0  

    Default getPlugin fails if plugins is not declared as an array

    getPlugin fails if plugins is not declared as an array


    Related forum post here, I'm copying my last post from that thread since it really should have been a bug report.

    REQUIRED INFORMATION


    Ext version tested:
    • Ext 4.1.1

    Browser versions tested against:
    • FF18

    DOCTYPE tested against:
    • Unrelated?

    Description:
    • The getPlugin method throws an exception if the component's plugin array is not manually initialized

    Steps to reproduce the problem:
    • http://jsfiddle.net/LMaaM/ shows initializing a component without a plugins array and then calling getPlugin and having it throw an exception.

    The result that was expected:
    • getPlugin should simply return null or undefined

    The result that occurs instead:
    • It throws an exception because it checks the plugins.length when plugins is undefined

    Test Case:

    See JSFiddle above.

    Additional information:

    This is based on 4.1.1 (not 4.1.3) which is latest. The test is obviously pretty contrived. However, I think it still illustrates the bug since in one case it works fine and in the other case it fails. This has to do with the fact that the code for the getPlugins code in Ext.AbstractComponent is:

    Code:
        /**
         * Retrieves a plugin by its `pluginId` which has been bound to this component.
         * @param {String} pluginId
         * @return {Ext.AbstractPlugin} plugin instance.
         */
        getPlugin: function(pluginId) {
            var i = 0,
                plugins = this.plugins,
                ln = plugins.length; //problematic
            for (; i < ln; i++) {
                if (plugins[i].pluginId === pluginId) {
                    return plugins[i];
                }
            }
        },
    My developer's thought is that the plugins.length check fails since plugins doesn't exist. Plugins isn't obligated to be defined.

    The AbstractComponent.constructPlugins method isn't obligated to assign an array to plugins or return an array that would be assign to plugins from any calls while initializing the component. The configuration option isn't defined as an array by default (wisely) either.

    I'd say there's two options to repair:
    1. getPlugins (and any other methods utilizing the plugins member variable) could guard against the case that the plugins array is undefined.
    2. plugins could be initialized as an empty array by default, reducing the need to check

    I'd guess the latter would be the better choice from a future proofing standpoint.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,791
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha Premium Member
    Join Date
    Mar 2007
    Posts
    64
    Vote Rating
    2
    ojintoad is on a distinguished road

      0  

    Default


    Awesome, thank you.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi