[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Firefox 4 and blacklist reporting



On Thu, Mar 31, 2011 at 00:51, Gregg Tavares (wrk) <gman@google.com> wrote:
>> There's no later, the event listener (if any) will be executed before
>> getContext returns, which allows to capture the additional
>> information. Also I don't think we require the canvas itself to listen
>> to the event.
>
> This is NOT how JavaScript works. Events are always asynchronous AFAIK.
> JavaScript does not support being "interrupted" by an event. Events are not
> delivered until JavaScript exits.

Nope, this IS how it works Gregg ;-)
As pointed out in my previous email, DOM2 events are synchronous :
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-dispatchEvent

"The return value of dispatchEvent indicates whether any of the
listeners which handled the event called preventDefault. If
preventDefault was called the value is false, else the value is true."

This requires event bubbling and execution of listeners to happen
before dispatchEvent returns.

Simple testcase:
document.body.addEventListener("foo", function(evt) { alert("FOO"); }, false);
var evt = document.createEvent("Event");
evt.initEvent("foo", true, true);
document.body.dispatchEvent(evt);
alert("after foo...");


And I'm pretty sure this is how native's dispatchEvent work as well :
DOM2 interface is not limited to the JavaScript language and I
remember using this long time ago (dispatching events from native, on
Mozilla).

Regards,
-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------