Bug 27696

Summary: Inspector: Console should show completions for the command line APIs
Product: WebKit Reporter: Keishi Hattori <keishi>
Component: Web Inspector (Deprecated)Assignee: David Levin <levin>
Status: RESOLVED FIXED    
Severity: Enhancement CC: joepeck, levin, mike
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
oops tabs
none
Fixed sortedProperties
none
Eliminated reduce
none
Eliminated reduce timothy: review+

Description Keishi Hattori 2009-07-26 22:56:30 PDT
Currently the completion candidates do not include command line APIs.
Comment 1 Keishi Hattori 2009-07-26 22:58:04 PDT
Created attachment 33520 [details]
Patch
Comment 2 Keishi Hattori 2009-07-27 02:06:27 PDT
Created attachment 33525 [details]
oops tabs
Comment 3 Joseph Pecoraro 2009-07-27 08:13:22 PDT
Sort function for Object.sortedProperties is used in ObjectPropertiesSections.  You should that parameter (sortFunc) back.  If sortFunc is not provided then the normal sort() is applied so it works out fine.

Also what about global functions/classes?  For example:
String, Date, toString, Number, ...
Comment 4 Keishi Hattori 2009-07-27 08:47:02 PDT
Created attachment 33549 [details]
Fixed sortedProperties

(In reply to comment #3)
> Sort function for Object.sortedProperties is used in ObjectPropertiesSections. 
> You should that parameter (sortFunc) back.  If sortFunc is not provided then
> the normal sort() is applied so it works out fine.

Sorry my mistake.

> Also what about global functions/classes?  For example:
> String, Date, toString, Number, ...

Great idea. My understanding is that those are specified are {DontEnum} so you need to keep a list of them. I think I'll file separate bug.
Comment 5 Timothy Hatcher 2009-07-28 20:50:04 PDT
Comment on attachment 33549 [details]
Fixed sortedProperties


> +            commandLineAPI = commandLineAPI.reduce(function(a, prop) {
> +                if (prop.charAt(0) !== "_")
> +                    a.push(prop);
> +                return a;
> +            }, []);

This is pretty fancy. I never really used/liked reduce or map. I think this would be easier to read as a simple for loop that only appends things to properties not starting with "_".

I bet it will be less code too!
Comment 6 Keishi Hattori 2009-07-28 21:41:44 PDT
Created attachment 33690 [details]
Eliminated reduce
Comment 7 Keishi Hattori 2009-07-28 22:31:10 PDT
Created attachment 33693 [details]
Eliminated reduce
Comment 8 David Levin 2009-07-29 00:30:20 PDT
Assign to levin for landing.
Comment 9 David Levin 2009-07-29 01:09:33 PDT
Committed as http://trac.webkit.org/changeset/46526