Ticket #3661: 3661_debug.patch

File 3661_debug.patch, 1.9 KB (added by Martin Kou, 15 years ago)
  • _source/core/scriptloader.js

     
    5353                 */
    5454                load : function( scriptUrl, callback, scope, noCheck )
    5555                {
     56                        console.log( 'load ' + scriptUrl );
    5657                        var isString = ( typeof scriptUrl == 'string' );
    5758
    5859                        if ( isString )
     
    8485
    8586                        var checkLoaded = function( url, success )
    8687                        {
    87                                 ( success ? completed : failed).push( url );
     88                                ( success ? completed : failed ).push( url );
    8889
    8990                                if ( --scriptCount <= 0 )
    9091                                        doCallback( success );
     92                                console.log( 'checkLoaded ' + url );
    9193                        };
    9294
    9395                        var onLoad = function( url, success )
    9496                        {
     97                                console.log( 'onLoad ' + url );
    9598                                // Mark this script as loaded.
    9699                                uniqueScripts[ url ] = 1;
    97100
     
    102105                                // Check all callbacks waiting for this file.
    103106                                for ( var i = 0 ; i < waitingInfo.length ; i++ )
    104107                                        waitingInfo[ i ]( url, success );
     108
     109                                console.log( 'finished onLoad ' + url );
    105110                        };
    106111
    107112                        var loadScript = function( url )
     
    121126
    122127                                // Create the <script> element.
    123128                                var script = new CKEDITOR.dom.element( 'script' );
     129
    124130                                script.setAttributes( {
    125131                                        type : 'text/javascript',
    126132                                        src : url } );
     
    147153                                                script.$.onload = function()
    148154                                                {
    149155                                                        onLoad( url, true );
     156                                                        // Some browsers, such as Safari, may call the onLoad function
     157                                                        // immediately. Which will break the loading sequence. (#3661)
     158                                                        // setTimeout( function() { onLoad( url, true ); }, 0 );
    150159                                                };
    151160
    152161                                                // FIXME: Opera and Safari will not fire onerror.
     
    167176
    168177                        for ( var i = 0 ; i < scriptCount ; i++ )
    169178                        {
     179                                console.log( 'loadScript ' + scriptUrl[ i ] );
    170180                                loadScript( scriptUrl[ i ] );
     181                                console.log( 'finished loadScript ' + scriptUrl[ i ] );
    171182                        }
    172183                },
    173184
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy