Bug 81935

Summary: Add JSValue::isFunction
Product: WebKit Reporter: Gavin Barraclough <barraclough>
Component: JavaScriptCoreAssignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Normal CC: gustavo, pnormand, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Fix
ggaren: review+, pnormand: commit-queue-
More better. ggaren: review+, buildbot: commit-queue-

Description Gavin Barraclough 2012-03-22 11:00:51 PDT
This would be useful in the WebCore bindings code.
Also, rename asFunction to asJSFunction, since this only applies to JSFunctions.
Comment 1 Gavin Barraclough 2012-03-22 11:02:12 PDT
Created attachment 133295 [details]
Fix
Comment 2 Geoffrey Garen 2012-03-22 11:07:47 PDT
Comment on attachment 133295 [details]
Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=133295&action=review

r=me

> Source/JavaScriptCore/runtime/JSFunction.h:159
> +    inline JSFunction* asJSFunction(JSValue value)

Over time, I'd like us to move to the jsCast function template instead of one-off casting functions. That would be a nice improvement here, but I won't hold up this patch for it.

> Source/JavaScriptCore/runtime/JSFunction.h:167
> +        return isObject() && (asObject(*this)->inherits(&JSFunction::s_info) || asObject(*this)->inherits(&InternalFunction::s_info));

I think isCell() is a better check here.
Comment 3 Philippe Normand 2012-03-22 11:10:44 PDT
Comment on attachment 133295 [details]
Fix

Attachment 133295 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/12120103
Comment 4 Early Warning System Bot 2012-03-22 11:16:48 PDT
Comment on attachment 133295 [details]
Fix

Attachment 133295 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12123066
Comment 5 Early Warning System Bot 2012-03-22 11:18:42 PDT
Comment on attachment 133295 [details]
Fix

Attachment 133295 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12120102
Comment 6 Gavin Barraclough 2012-03-22 11:20:01 PDT
Created attachment 133300 [details]
More better.
Comment 7 Geoffrey Garen 2012-03-22 11:21:51 PDT
Comment on attachment 133300 [details]
More better.

r=me
Comment 8 Build Bot 2012-03-22 11:54:04 PDT
Comment on attachment 133300 [details]
More better.

Attachment 133300 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12120115
Comment 9 Gavin Barraclough 2012-03-22 11:55:12 PDT
Fixed in r111739
Comment 10 Early Warning System Bot 2012-03-22 11:58:53 PDT
Comment on attachment 133300 [details]
More better.

Attachment 133300 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12120122
Comment 11 Early Warning System Bot 2012-03-22 12:01:20 PDT
Comment on attachment 133300 [details]
More better.

Attachment 133300 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12113166
Comment 12 Build Bot 2012-03-22 12:03:27 PDT
Comment on attachment 133300 [details]
More better.

Attachment 133300 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12117157
Comment 13 Gustavo Noronha (kov) 2012-03-22 12:05:22 PDT
Comment on attachment 133300 [details]
More better.

Attachment 133300 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/12114150