On Tue, Jul 7, 2009 at 6:29 PM, Drew Wilson<[email protected]> wrote: > Interesting - I ran some tests on both current WebKit and Firefox. > Firefox has a couple of interesting properties. For example this code: > Worker.prototype.foo = 3; > log("Worker.prototype.foo = " + Worker.prototype.foo); > var worker = new Worker("foobar.js"); > log("worker.foo = " + worker.foo); > yields: > Worker.prototype.foo = 3 > worker.foo = undefined > in Firefox, while in Safari it yields worker.foo = 3 as expected.
This is a good test, but I would test something older than the Worker constructor. For example, the Image constructor might be a good choice. > Along those same lines: > new Worker().__proto__ == Worker.prototype > yields true on Safari, but false on Firefox, which seems broken to me. In this kind of test, you want to use === to avoid being tricked by valueOf. > This is all within the same page (no frames). I've also verified that new > parent.window.Worker().__proto__ yields a different object than invoking new > window.Worker().__proto__ from the parent page context. So they don't seem > to be doing the right thing wrt prototype chains either. Boo. This stuff is subtle. > As expected, WebKit is clearly broken with frames, as parent.window.Worker > does not even yield the same host object that invoking "window.Worker" > yields from the parent page context (not surprising, since we're looking at > lexicalGlobalObject() when we shouldn't be). It might be worth taking this discussion to a bug at this point so as not to distract everyone on webkit-dev. Adam _______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

