Bug 58207 - Web Inspector: add support for optional output parameters.
Summary: Web Inspector: add support for optional output parameters.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-10 11:56 PDT by Pavel Feldman
Modified: 2011-04-11 05:31 PDT (History)
10 users (show)

See Also:


Attachments
Patch (8.62 KB, patch)
2011-04-10 12:05 PDT, Pavel Feldman
no flags Details | Formatted Diff | Diff
Patch (8.17 KB, patch)
2011-04-11 02:51 PDT, Pavel Feldman
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.