Bug 142760 - Web Inspector: Add more DOM Native Function parameter strings
Summary: Web Inspector: Add more DOM Native Function parameter strings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-03-16 18:48 PDT by Joseph Pecoraro
Modified: 2015-03-16 21:43 PDT (History)
7 users (show)

See Also:


Attachments
[SCRIPT] IDL CodeGenerator used to autogenerate the JSON objects (3.04 KB, text/x-perl-script)
2015-03-16 18:51 PDT, Joseph Pecoraro
no flags Details
[PATCH] Proposed Fix (58.54 KB, patch)
2015-03-16 18:53 PDT, Joseph Pecoraro
timothy: review+
joepeck: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2015-03-16 18:48:23 PDT
* SUMMARY
Add more DOM Native Function parameter strings.

I autogenerated a set from our IDL to fill in the rest of our interfaces.

I did handle:
  - optional parameters
  - static vs non-static

I didn't handle:
  - Native DOM functions that are constructors
  - For overloaded IDL functions (WebGL Context has a few for example) I only generated a parameter list for the first function
  - Default values, because they seemed almost always to be Undefined / NullString / TreatUndefinedAsNullString
Comment 1 Radar WebKit Bug Importer 2015-03-16 18:48:36 PDT
<rdar://problem/20184149>
Comment 2 Joseph Pecoraro 2015-03-16 18:51:15 PDT
Created attachment 248776 [details]
[SCRIPT] IDL CodeGenerator used to autogenerate the JSON objects

Note to future self: To use this, I made DerivedSources.make run the JS codegenerator and this codegenerator for all IDL files. Then I just processed the stdout output: (striped empty objects, sorted, pretty printed, and hand edited).
Comment 3 Joseph Pecoraro 2015-03-16 18:53:58 PDT
Created attachment 248778 [details]
[PATCH] Proposed Fix
Comment 4 Joseph Pecoraro 2015-03-16 18:56:43 PDT
Comment on attachment 248778 [details]
[PATCH] Proposed Fix

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

> Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js:1495
> +    SecurityPolicy: {

I am not sure if this is real, or just for tests? Tests use "document.securityPolicy", but I don't see that in general browsing.
Comment 5 Timothy Hatcher 2015-03-16 19:16:34 PDT
Comment on attachment 248778 [details]
[PATCH] Proposed Fix

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

> Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js:984
> +        /* EventTarget */

So these are empty but inherit from EventTarget.

>> Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js:1495
>> +    SecurityPolicy: {
> 
> I am not sure if this is real, or just for tests? Tests use "document.securityPolicy", but I don't see that in general browsing.

Likely not exposed.

> Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js:2076
> +    var eventTargetTypes = [

Oh I see now.

> Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js:2084
> +    for (var type of eventTargetTypes)

Newline before this?
Comment 6 Joseph Pecoraro 2015-03-16 20:58:31 PDT
Comment on attachment 248778 [details]
[PATCH] Proposed Fix

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

>>> Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js:1495
>>> +    SecurityPolicy: {
>> 
>> I am not sure if this is real, or just for tests? Tests use "document.securityPolicy", but I don't see that in general browsing.
> 
> Likely not exposed.

It is behind ENABLE_CSP_NEXT, which Mac doesn't have enabled yet. I'll keep it, this is intended to be a public API I guess.
Comment 7 Joseph Pecoraro 2015-03-16 21:00:06 PDT
Comment on attachment 248778 [details]
[PATCH] Proposed Fix

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

> Source/WebCore/dom/Document.idl:214
> -    NodeList getElementsByClassName([Default=Undefined] optional DOMString tagname);
> +    NodeList getElementsByClassName([Default=Undefined] optional DOMString classNames);

So this is causing our ObjC API checker to complain:

>    Public API change. There are missing public properties and/or methods from the "DOMDocument" class.
>    - (DOMNodeList *)getElementsByClassName:(NSString *)tagname;

This should be fine, but I'm going to avoid making this change in this patch. As it really doesn't matter.
Comment 8 Timothy Hatcher 2015-03-16 21:14:21 PDT
You can make the change in a follow up. Just update the big header that is cross references to make it stick.
Comment 9 Joseph Pecoraro 2015-03-16 21:18:56 PDT
(In reply to comment #8)
> You can make the change in a follow up. Just update the big header that is
> cross references to make it stick.

Yep, I realized that now. I also have a few CodeGenerator cleanup patches after reading through some of the code.
Comment 10 Joseph Pecoraro 2015-03-16 21:43:11 PDT
http://trac.webkit.org/changeset/181614