WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
16644
REGRESSION (
r28880
-
r28886
): Global variable access
https://bugs.webkit.org/show_bug.cgi?id=16644
Summary
REGRESSION (r28880-r28886): Global variable access
Woody Gilk
Reported
2007-12-28 11:42:16 PST
If you visit netvibes.com with WebKit,
r28886
or later, it will cause 3 JS "TypeError: value undefined" errors. This regression is not present in
r28880
and earlier.
Attachments
Reduction
(298 bytes, text/html)
2007-12-29 21:49 PST
,
David Kilzer (:ddkilzer)
no flags
Details
Better reduction
(161 bytes, text/html)
2007-12-29 22:00 PST
,
David Kilzer (:ddkilzer)
no flags
Details
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
David Kilzer (:ddkilzer)
Comment 1
2007-12-29 19:30:19 PST
The bisect-builds script reports: Works:
r28880
Fails:
r28886
Revision
r28884
looks most suspicious.
http://trac.webkit.org/projects/webkit/changeset/28884
David Kilzer (:ddkilzer)
Comment 2
2007-12-29 19:31:15 PST
<
rdar://problem/5665251
>
David Kilzer (:ddkilzer)
Comment 3
2007-12-29 21:32:58 PST
The initial "TypeError: value undefined" error occurs on this statement: HTMLElement.prototype.htmlElement=function(){}; The cause is that HTMLElement.prototype is undefined. HTMLElement is defined as this when the statement is run: function () { }
David Kilzer (:ddkilzer)
Comment 4
2007-12-29 21:49:52 PST
Created
attachment 18176
[details]
Reduction This is a reduction of the original JavaScript from the web site. With Safari 3.0.4 (523.12.2) with original WebKit on Mac OS X 10.4.11 (8S165), loading the test case, then loading this URL: javascript:alert(HTMLElement) Produces: [object HTMLElementConstructor] And thus the code in the if() statement never runs.
David Kilzer (:ddkilzer)
Comment 5
2007-12-29 21:51:51 PST
(In reply to
comment #4
)
> With Safari 3.0.4 (523.12.2) with original WebKit on Mac OS X 10.4.11 (8S165), > loading the test case, then loading this URL: > > javascript:alert(HTMLElement) > > Produces: > > [object HTMLElementConstructor] > > And thus the code in the if() statement never runs.
Ignore that. The local debug build of WebKit
r29032
does this as well. The issue lies somewhere else.
David Kilzer (:ddkilzer)
Comment 6
2007-12-29 22:00:08 PST
Created
attachment 18177
[details]
Better reduction If the "var HTMLElement = function(){};" statement is removed (or commented out), the test passes. However, having that statement inside the if() block causes the if() condition to return true, which I find to be completely bizarre.
Oliver Hunt
Comment 7
2007-12-29 22:29:50 PST
This is almost certainly due to
r28884
As an educated guess the problem is like to be that in: if (typeof HTMLElement == 'undefined') { var HTMLElement=function(){}; document.write("FAIL"); } else { document.write("PASS"); } the references to HTMLElement are replaced with fast indexed lookups into the symbol table, however when the symbol table is initialised it does not allow for the potential for these variables to be present on the global object, and just assumes that they are all undefined by default.I would guess that the fix would be to have the global symbol table be initalised from the values in the global object if there are any attempts to shadow any of the ghlobal objects properties.
David Kilzer (:ddkilzer)
Comment 8
2007-12-30 09:43:47 PST
The Netvibes site uses Mootools v1.11 as well. See
Bug 16605
and
Bug 16679
.
David Kilzer (:ddkilzer)
Comment 9
2008-01-02 07:37:13 PST
***
Bug 16702
has been marked as a duplicate of this bug. ***
Matt Lilek
Comment 10
2008-01-10 17:38:17 PST
This broke Lively Kernel as well -
http://research.sun.com/projects/lively/index.xhtml
Geoffrey Garen
Comment 11
2008-01-11 09:58:22 PST
Great diagnosis, Oliver and Dave. I think it would be best not to make an entry in the symbol table at all. In order to make an entry, you would need to know (a) that the existing property was DontDelete and (b) that it was a permanent property, and not any of the many global properties that come and go and return different values at different times. Maybe we can figure out how to optimize this case down the line, though.
Mark Rowe (bdash)
Comment 12
2008-01-11 10:30:55 PST
***
Bug 16813
has been marked as a duplicate of this bug. ***
Geoffrey Garen
Comment 13
2008-01-11 13:16:31 PST
This is a very challenging bug. FF does what I suggested in
Comment #11
. IE 6 & 7, though, match current TOT, while Opera is somewhere in the middle. It's not clear what correct behavior would be, but I tend to prefer IE's behavior.
Oliver Hunt
Comment 14
2008-01-11 13:25:45 PST
(In reply to
comment #13
)
> This is a very challenging bug. FF does what I suggested in
Comment #11
. IE 6 & > 7, though, match current TOT, while Opera is somewhere in the middle. It's not > clear what correct behavior would be, but I tend to prefer IE's behavior. >
Remember to check the lively kernel when fixing this :D
David Kilzer (:ddkilzer)
Comment 15
2008-01-11 13:54:46 PST
(In reply to
comment #13
)
> This is a very challenging bug. FF does what I suggested in
Comment #11
. IE 6 & > 7, though, match current TOT, while Opera is somewhere in the middle. It's not > clear what correct behavior would be, but I tend to prefer IE's behavior.
Does Brendan Eich have a bugs.w.o account? ;) On a more serious note, perhaps he hangs out on one of the Mozilla IRC channels on irc.freenode.net?
Geoffrey Garen
Comment 16
2008-01-11 23:20:45 PST
Committed revision 29428.
David Kilzer (:ddkilzer)
Comment 17
2008-01-12 10:52:16 PST
***
Bug 16605
has been marked as a duplicate of this bug. ***
David Kilzer (:ddkilzer)
Comment 18
2008-01-12 10:56:55 PST
***
Bug 16679
has been marked as a duplicate of this bug. ***
Eric Seidel (no email)
Comment 19
2008-04-03 12:48:52 PDT
Ick. FF's behavior seems poor here. Ours is even worse (since we seem to silently fail instead of throwing an exception). CCing myself with the intention of at least re-writing these tests to use the modern JS testing framework so that they run in FF and we can confirm that our behavior matches (which I'm not sure it does 100%).
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug