dxnn / daimio

A framework for building programmable applications

Home Page:daimio.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better fallthrough for DOM port flavours via D.track_event

dxnn opened this issue · comments

Courtesy of bug discovery by @inaimathi I've added D.scrub_var(target) to the list of fallthroughs.

This should enable any DOM element to host any DOM port flavour (in theory).

Oh, except what we really want there is event, not target.

Also, scrub_var breaks for DOM elements due to a stack overflow. This is odd, because scrub_var is specifically designed to detect and ignore cyclic references...

Sooo... scrub_var happily chugs along, eating circular refs through the event's target DOM element, until it eventually comes to 'window'. (Duhn duhn duhn)

Which is actually fine, surprisingly, because window is mostly full of functions or objects containing functions and scrub_var skips functions, but sooner or later this happens:

x = window.clientInformation.mimeTypes
> MimeTypeArray...
x[0].enabledPlugin[0] == x[0].enabledPlugin[0]
> false

Which obviously defeats my superclever loop detection and the world ends in a fiery stackoverflow.

So the lesson is when it comes to the DOM you can't trust anything -- even reflexivity is off the table.