Closed Bug 866680 Opened 11 years ago Closed 11 years ago

gcli string params should allow empty values.

Categories

(DevTools Graveyard :: Graphic Commandline and Toolbar, defect)

20 Branch
x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 24

People

(Reporter: mgoodwin, Assigned: jwalker)

Details

Attachments

(1 file, 1 obsolete file)

Issue:
I'm working on a gcli command for which a string parameter defaults to a non empty value, but for which an empty string should be valid. gcli apparently does not allow an empty value to be specified by the user.

STR:
This behaviour can be seen with the 'cookie set' built in command. Try to set a cookie with an empty path:
1) Type 'cookie set foo bar --path ""'
2) Observe the help text in the command bar displaying '<string> [option]'
3) Press enter; observe the helper baloon showing the text "The path of the cookie to set".
There are many cases where a string is required and a blank won't do (for example the "context <name>" command) so we need to provide for the "empty string is invalid" case too.

The question is should we make the cookie command say

          {
            name: "path",
            type: { name: "string", allowBlank: true },
            ...
          },

Or should the context command say:

          {
            name: "name",
            type: { name: "string", forceValue: true },
            ...
          },

I think there are 2 reasons to prefer allowBlank: true

1. It doesn't change the current default
2. Having defaultValue: '' does nearly the same thing, allowing the user to not
   type a value. This is only an issue where there is a string where blank is
   valid, but there is a non-blank defaultValue
Attached patch v1 (obsolete) — Splinter Review
Attachment #749169 - Flags: feedback?(mgoodwin)
For detail on the commits, see the last to entries here:
https://github.com/joewalker/gcli/commits/allowblank-866680
Attached patch v2Splinter Review
Rebase
Attachment #749169 - Attachment is obsolete: true
Attachment #749169 - Flags: feedback?(mgoodwin)
Comment on attachment 750415 [details] [diff] [review]
v2

mgoodwin raised this bug as part of creating security commands, so I've f?ed him.
harth would probably be glad of mgoodwin's f+ before her review.
Attachment #750415 - Flags: review?(fayearthur)
Attachment #750415 - Flags: feedback?(mgoodwin)
Comment on attachment 750415 [details] [diff] [review]
v2

Review of attachment 750415 [details] [diff] [review]:
-----------------------------------------------------------------

Looks OK to me.
Attachment #750415 - Flags: feedback?(mgoodwin) → feedback+
Attachment #750415 - Flags: review?(fayearthur) → review+
https://hg.mozilla.org/mozilla-central/rev/97892f7b402a
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 24
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: