Bug 58207

Summary: Web Inspector: add support for optional output parameters.
Product: WebKit Reporter: Pavel Feldman <pfeldman>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description Pavel Feldman 2011-04-10 11:56:48 PDT
Output parameters such as "redirectResponse" are optional, but do not allow specifying them as such.
Comment 1 Pavel Feldman 2011-04-10 12:05:00 PDT
Created attachment 88956 [details]
Patch
Comment 2 Ilya Tikhonovsky 2011-04-10 13:16:01 PDT
Comment on attachment 88956 [details]
Patch

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

> Source/WebCore/inspector/CodeGeneratorInspector.pm:380
> +        foreach my $parameter (@argsFiltered) {
> +            my $optional = $parameter->extendedAttributes->{"optional"} ? "if (" . $parameter->name . ") " : "";
> +            push(@function, "    " . $optional .  "paramsObject->set" . typeTraits($parameter->type, "JSONType") . "(\"" . $parameter->name . "\", " . $parameter->name . ");");

The generated code doesn't match WebKit style guide.

> Source/WebCore/inspector/CodeGeneratorInspector.pm:487
> +        my $optional = $parameter->extendedAttributes->{"optional"} ? "if (out_" . $parameter->name . ") " : "";
> +        push(@function, "    " . $optional .  "result->set" . typeTraits($parameter->type, "JSONType") . "(\"" . $parameter->name . "\", out_" . $parameter->name . ");");

The code doesn't work well for Array and Object types I'm not sure about strings.
The out arguments for array and object types have default values which are not equal to false.

generated code doesn't match WebKit style guide.
Comment 3 Pavel Feldman 2011-04-11 02:51:46 PDT
Created attachment 88980 [details]
Patch
Comment 4 Ilya Tikhonovsky 2011-04-11 04:28:07 PDT
Comment on attachment 88980 [details]
Patch

lgtm
Comment 5 Pavel Feldman 2011-04-11 05:31:09 PDT
Comment on attachment 88980 [details]
Patch

Clearing flags on attachment: 88980

Committed r83435: <http://trac.webkit.org/changeset/83435>
Comment 6 Pavel Feldman 2011-04-11 05:31:19 PDT
All reviewed patches have been landed.  Closing bug.