Bug 178656 - [Settings] Add initial support for generating preferences related code
Summary: [Settings] Add initial support for generating preferences related code
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks: 178637
  Show dependency treegraph
 
Reported: 2017-10-23 02:55 PDT by Sam Weinig
Modified: 2017-11-15 13:02 PST (History)
5 users (show)

See Also:


Attachments
Patch (136.52 KB, patch)
2017-10-23 03:01 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (136.25 KB, patch)
2017-10-23 03:54 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (136.40 KB, patch)
2017-10-23 08:07 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (136.37 KB, patch)
2017-10-23 15:22 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (136.37 KB, patch)
2017-10-23 15:36 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (136.80 KB, patch)
2017-10-23 15:45 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2017-10-23 02:55:02 PDT
[Settings] Add initial support for generating preferences related code
Comment 1 Sam Weinig 2017-10-23 03:01:43 PDT Comment hidden (obsolete)
Comment 2 Sam Weinig 2017-10-23 03:54:05 PDT Comment hidden (obsolete)
Comment 3 Sam Weinig 2017-10-23 08:07:30 PDT
Created attachment 324557 [details]
Patch
Comment 4 Joseph Pecoraro 2017-10-23 10:59:39 PDT
Comment on attachment 324557 [details]
Patch

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

> Source/WebKit/Scripts/GeneratePreferences.rb:78
> +    @humanReadableName = "\"#{opts["humanReadableName"]}\"" || '""'
> +    @humanReadableDescription = "\"#{opts["humanReadableDescription"]}\"" || '""'

I don't think `||` part does anything here, the left side always produces a string that at least has quotes so it won't be falsey.

In the unlikely event that we might want to escape double quotes or other escape characters in the humanReadableDescription you could use String#inspect:
http://ruby-doc.org/core-2.1.1/String.html#method-i-inspect

    @humanReadableName = (opts["humanReadableName"] || "").inspect
    @humanReadableDescription = (opts["humanReadableDescription"] || "").inspect

That said, this might be cryptic, even for Rubyists. Perhaps just a simple:

    @humanReadableName = '"' + (opts["humanReadableName"] || "") + "'"
    @humanReadableDescription = '"' + (opts["humanReadableDescription"] || "") + '"'

> Source/WebKit/Scripts/GeneratePreferences.rb:119
> +    @boolPreferncesNotDebug = @preferences.select { |p| !p.category && !p.webkitOnly && p.type == "bool" }
> +    @doublePreferncesNotDebug = @preferences.select { |p| !p.category && !p.webkitOnly && p.type == "double" }

Typo (all members): "Prefernces" => "Preferences"
Comment 5 Sam Weinig 2017-10-23 15:22:32 PDT
Created attachment 324597 [details]
Patch
Comment 6 Sam Weinig 2017-10-23 15:36:09 PDT
Created attachment 324599 [details]
Patch
Comment 7 Sam Weinig 2017-10-23 15:45:56 PDT
Created attachment 324600 [details]
Patch
Comment 8 WebKit Commit Bot 2017-10-24 11:43:35 PDT
Comment on attachment 324600 [details]
Patch

Clearing flags on attachment: 324600

Committed r223903: <https://trac.webkit.org/changeset/223903>
Comment 9 WebKit Commit Bot 2017-10-24 11:43:36 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2017-11-15 13:02:47 PST
<rdar://problem/35568675>