Bug 20256 - Array.push and other standard methods disappeared.
Summary: Array.push and other standard methods disappeared.
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Alexey Proskuryakov
Depends on:
Reported: 2008-08-01 12:34 PDT by David Hansen
Modified: 2008-10-14 09:23 PDT (History)
2 users (show)

See Also:

Test case (1.38 KB, text/plain)
2008-08-01 12:34 PDT, David Hansen
no flags Details
proposed fix (2.43 KB, patch)
2008-10-14 04:23 PDT, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Hansen 2008-08-01 12:34:09 PDT
Just run the attached test case:

** (jsarray:27866): DEBUG: TypeError: Result of expression 'a.push' [undefined] is not a function.

Note that the eval in the context of the WebView does not produce any console messages.  By changing the order of evaluation it is possible to let the error happen in the context of the WebView and the context created with the JSC API is working fine.

This does affect a lot of other standard methods from at least `Array' and `String'.
Comment 1 David Hansen 2008-08-01 12:34:54 PDT
Created attachment 22608 [details]
Test case
Comment 2 Alexey Proskuryakov 2008-08-02 01:51:27 PDT
This doesn't look gtk-related, but as mentioned in bug 20107, I tried and could not reproduce this on Mac OS X, so at least part of debugging this should be done on a system where this does happen.
Comment 3 Louis JANG 2008-10-09 23:39:16 PDT
Alexey, this issue doesn't look like gtk-related. I faced same problem and checked several differences between mac and gtk. And finally I turned JSC_MULTIPLE_THREADS on, and this issue was not happend. Would you turn this flag off in mac? 
Comment 4 Louis JANG 2008-10-10 00:13:23 PDT
I investigated more and found that if I allocated private hash tables in JSGlobalData(JavaScriptCore/kjs/JSGlobalData.cpp), this issue wouldn't happen. But I don't know why this code could affect the problem. 
Comment 5 Alexey Proskuryakov 2008-10-14 04:18:25 PDT
Thank you for your analysis - I can now see the problem. When JSC_MULTIPLE_THREADS is not enabled, we are using static hash tables, but per-GlobalData identifier table. Since the hash tables reference identifiers, this makes no sense.
Comment 6 Alexey Proskuryakov 2008-10-14 04:23:44 PDT
Created attachment 24341 [details]
proposed fix

I don't remember why I made this conditional - probably there was no good reason.
Comment 7 Darin Adler 2008-10-14 09:04:02 PDT
Comment on attachment 24341 [details]
proposed fix

Comment 8 Alexey Proskuryakov 2008-10-14 09:23:30 PDT
Fixed in <http://trac.webkit.org/changeset/37586>.