This project is archived and is in readonly mode.

#785 ✓resolved
Ian MacArthur

v1.2.4 Hash object each method does not exist

Reported by Ian MacArthur | November 13th, 2009 @ 06:19 PM | in 1.3.0 rc2 (closed)

I'm testing 1.2.4 release and have a problem with IE. It's
intermittent but reproducible.

I have tracked it down to core line 1665.

var purge = function(){

   Hash.each(collected, clean);    <-- fails here
   if (Browser.Engine.trident)
       $A(document.getElementsByTagName('object')).each(clean);
   if (window.CollectGarbage) CollectGarbage();
       collected = storage = null;

}; called from:
Native.implement([Element, Window, Document], {

   addListener: function(type, fn){
           if (type == 'unload'){
                   var old = fn, self = this;
                   fn = function(){
                           self.removeListener('unload', fn);
                           old();  <-- caller
                   };
           } else {
                   collected[this.uid] = this;
           }
           if (this.addEventListener) this.addEventListener(type, fn, false);
           else this.attachEvent('on' + type, fn);
           return this;
   },

When it fails, the Hash object seems corrupted. It only has 14 methods
(vs 40+ normally). In particular it seems there is no each function.

attempt() attempt(args, bind) Variant
bind() bind(bind, args) Variant
bindAsEventListener() bindAsEventListener(bind, args) Variant
bindWithEvent() bindWithEvent(bind, args) Variant
constructor() constructor(properties) Variant
Cookie() Cookie() Variant
create() create(options) Variant
delay() delay(delay, bind, args) Variant
extend() extend(properties) Variant
implement() implement() Variant
pass() pass(args, bind) Variant
periodical() periodical(periodical, bind, args) Variant
protect() protect() Variant
run() run(args, bind) Variant

I can refresh a page multiple times and it's fine, then the error
hits. I refresh the page and it's fine.

The pages had no changes other than change from v1.2.2 to v1.2.4.

This is from IE8 but IE7 seems to have the same issue. FF & Safari
seem to be okay.

Comments and changes to this ticket

  • Ian MacArthur

    Ian MacArthur November 14th, 2009 @ 03:31 AM

    More information. Not sure if it is related but IE seems to cause an infinite loop.

    The statement [while (attached[events].keys[0]) this.removeEvent(events, attached[events].keys[0]);] causes an infinite loop. The events are never removed.

    attached[events].keys.length = 2
    In removeEvent(element, type, handler), element.removeEventListener = false, element.events is undefined so nothing is removed, returns to while loop and attached[events].keys.length still = 2, while kicks in for an infinte loop.

    removeEvents: function(events){

        var type;
        if ($type(events) == 'object'){
            for (type in events) this.removeEvent(type, events[type]);
            return this;
        }
        var attached = this.retrieve('events');
        if (!attached) return this;
        if (!events){
            for (type in attached) this.removeEvents(type);
            this.eliminate('events');
        } else if (attached[events]){
            while (attached[events].keys[0]) this.removeEvent(events, attached[events].keys[0]);
            attached[events] = null;
        }
        return this;
    },
    
  • fakedarren

    fakedarren February 8th, 2010 @ 06:48 PM

    • State changed from “new” to “open”
    • Assigned user set to “fakedarren”
    • Milestone changed from 2.0 to 1.3.0 rc2
  • fakedarren

    fakedarren February 11th, 2010 @ 07:10 PM

    • Assigned user changed from “fakedarren” to “Thomas Aylott”

    Thomas - could this be related to the issue you patched earlier? With IE cloning when garbage collecting?

  • Thomas Aylott

    Thomas Aylott February 11th, 2010 @ 09:18 PM

    • State changed from “open” to “resolved”

    Yeah, the most recent commit should fix this.

    It'd be awesome if Ian could download MooTools @master from GitHub, build and then test this to verify that this fixes it.

    I'm 98.6% sure this commit solved the issue ,so I'll goahead and mark fixed until I hear otherwise.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages