Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 42

Thread: [DEFER-717][2.x,3.x] Stack overflow in IE6/7 using prototype 1.6.1_rc3

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #11

    Default

    thank you very much evant, it works.... I really really appreciate it. There are only about 5 instances of the defer method being called, so it is a fairly easy work around.

  2. #12
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    The Prototype and Ext delay methods are completely incompatible! The Prototype defer method doesn't have delay and scope parameters at all (it is always delay:10, scope:this). The only parameters are the arguments that get passed to the method.

    You could 'hack' this by adding 10 and optionally a scope to every defer call in the prototype library, e.g.
    Code:
    if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(10, this, 1);
    ...
    timer = pollDoScroll.defer(10);
    etc.

  3. #13
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    Here's a possible solution. Include it somewhere after all the libs are loaded.

    PHP Code:
    (function(){
       
    //should be Ext's implem at this point
       
    var eDefer = Function.prototype.defer

       Function.
    prototype.defer = function() {
        var 
    args argumentsargs.length;
        if( 
    L==|| ( L==&& args[0]==1)) //common for Prototype Ajax requests
        
    {
            return 
    this.delay.curry(0.01).apply(thisargs);
        }
        return 
    eDefer.apply(thisargs);
      }; 
    })(); 
    Tweak it
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  4. #14

    Default Patch to make Prototype compatible

    Here's an alternative way to work around this problem. I like this better as it doesn't try to hack prototype to use Ext's defer function, it just changes prototype's version to have it's own name. This patch basically changes the name of prototype's defer function to be "p_defer". My group does not use the defer function at all so this worked fine for us since the changes were localized to prototype. Hope it helps people. Note this patch is against the newly released 1.6.1 version, not a release candidate.



    Index: prototype.js
    Code:
    ===================================================================
    --- prototype.js    (revision 3901)
    +++ prototype.js    (working copy)
    @@ -345,7 +345,7 @@
         bindAsEventListener: bindAsEventListener,
         curry:               curry,
         delay:               delay,
    -    defer:               defer,
    +    p_defer:             defer,
         wrap:                wrap,
         methodize:           methodize
       }
    @@ -1412,7 +1412,7 @@
           this.transport.open(this.method.toUpperCase(), this.url,
             this.options.asynchronous);
     
    -      if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
    +      if (this.options.asynchronous) this.respondToReadyState.bind(this).p_defer(1);
     
           this.transport.onreadystatechange = this.onStateChange.bind(this);
           this.setRequestHeaders();
    @@ -1894,7 +1894,7 @@
             element.innerHTML = content.stripScripts();
           }
     
    -      content.evalScripts.bind(content).defer();
    +      content.evalScripts.bind(content).p_defer();
           return element;
         }
     
    @@ -1908,7 +1908,7 @@
           content = Object.toHTML(content);
           var range = element.ownerDocument.createRange();
           range.selectNode(element);
    -      content.evalScripts.bind(content).defer();
    +      content.evalScripts.bind(content).p_defer();
           content = range.createContextualFragment(content.stripScripts());
         }
         element.parentNode.replaceChild(content, element);
    @@ -1945,7 +1945,7 @@
           if (position == 'top' || position == 'after') childNodes.reverse();
           childNodes.each(insert.curry(element));
     
    -      content.evalScripts.bind(content).defer();
    +      content.evalScripts.bind(content).p_defer();
         }
     
         return element;
    @@ -2803,7 +2803,7 @@
         }
         else element.outerHTML = content.stripScripts();
     
    -    content.evalScripts.bind(content).defer();
    +    content.evalScripts.bind(content).p_defer();
         return element;
       };
     }
    @@ -4677,7 +4677,7 @@
       function pollDoScroll() {
         try { document.documentElement.doScroll('left'); }
         catch(e) {
    -      timer = pollDoScroll.defer();
    +      timer = pollDoScroll.p_defer();
           return;
         }
         fireContentLoadedEvent();
    @@ -4688,7 +4688,7 @@
       } else {
         document.observe('readystatechange', checkReadyState);
         if (window == top)
    -      timer = pollDoScroll.defer();
    +      timer = pollDoScroll.p_defer();
       }
     
       Event.observe(window, 'load', fireContentLoadedEvent);
    Last edited by mystix; 12 Sep 2009 at 6:58 AM. Reason: POST CODE IN [code][/code] TAGS. see http://extjs.com/forum/misc.php?do=bbcode#code

  5. #15

    Default

    Had the same problem in IE6 and IE7 after changing prototype from 1.6.0.3 to 1.6.1.

    The solution from @jjathman fixed the problem, but there is one more change (marked red) to do within the prototype source.


    Code:
    ===================================================================
    --- prototype.js    (revision 3901)
    +++ prototype.js    (working copy)
    @@ -345,7 +345,7 @@
         bindAsEventListener: bindAsEventListener,
         curry:               curry,
         delay:               delay,
    -    defer:               defer,
    +    p_defer:             p_defer,
         wrap:                wrap,
         methodize:           methodize

  6. #16

    Default

    I don't think that additional change is necessary (and if you did it you would need to make sure and update the function name higher up in the source). You only need to change the name of the defer function that gets returned as the "public" name of the function. The other defer function is more of a "private" function and hence it doesn't really matter what the name of it is.

  7. #17
    Ext JS Premium Member
    Join Date
    Feb 2009
    Posts
    487

    Default

    I've had this problem too (I have a google map panel that defers rendering till the tab it's on is selected).

    jjathman - fogive the n00b question, but what tool are you using to output that patch and how can I use it to quickly patch my code?

  8. #18

    Default

    @Jangla
    To help with how to patch your code it would help to know what source code tool you use (most have patching functionality built in) and what OS you use.

  9. #19
    Ext JS Premium Member
    Join Date
    Feb 2009
    Posts
    487

    Default

    Dreamweaver CS4 on Vista

  10. #20

    Default

    On windows you can use the patch program found here: http://gnuwin32.sourceforge.net/packages/patch.htm

    Though if you've never used it before it can be kind of cryptic. Personally if you've never done patches before and don't think you will in the future, I would just look at my patch and make the changes to prototype by hand. It will only take you a couple minutes.

Page 2 of 5 FirstFirst 1234 ... LastLast

Posting Permissions

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