Closed Bug 1451334 Opened 8 years ago Closed 8 years ago

Can't use 0 as string maxLength nor array maxItems in schema

Categories

(WebExtensions :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: Oriol, Assigned: Oriol)

References

Details

Attachments

(2 files)

Attached file test.xpi
You can define a schema with "choices": [ { "type": "string", "maxLength": 0 }, { "type": "array", "items": { "type": "any" }, "maxItems": 0 } ] but it will allow non-empty strings and non-empty arrays. Enforcing a maximum of 0 seems stupid and I don't think Firefox schemas do it. But with the experiments API, authors can define their own schemas, and this bug becomes observable. 1. Open browser console 2. Install attached extension in about:debugging In the console you should see 2 "TEST PASS - got an error"
Unnecessary to have QA, it's covered by a test.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
In bug 1448120 I only fixed "minimum" for integers. I didn't fix "maxLength" for strings nor "maxItems" for arrays.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → WONTFIX
Why WONTFIX? This is obviously a bug. I can use maxLength:-1 and then "foo" throws, but if I use maxLength:0 then "foo" doesn't throw? That's nonsense.
Flags: needinfo?(kmaglione+bmo)
Summary: Can't use 0 as string maxLength nor array maxItems is schema → Can't use 0 as string maxLength nor array maxItems in schema
Comment on attachment 8964968 [details] Bug 1451334 - Allow 0 as string maxLength or array maxItems in webextension schema https://reviewboard.mozilla.org/r/233692/#review239384 zero for maxLength here doesn't seem reasonable. throwing in other cases is not a big deal.
Attachment #8964968 - Flags: review?(mixedpuppy) → review-
Product: Toolkit → WebExtensions
Flags: needinfo?(kmaglione+bmo)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: