Closed Bug 1448120 Opened 7 years ago Closed 7 years ago

Can't use 0 as minimum or maximum integer in schema

Categories

(WebExtensions :: General, enhancement, P3)

enhancement

Tracking

(firefox61 fixed)

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: Oriol, Assigned: Oriol)

References

Details

Attachments

(2 files)

In `browser.tabs.query`, the index parameter is defined with "index": { "type": "integer", "optional": true, "minimum": 0, "description": "The position of the tabs within their windows." }, https://searchfox.org/mozilla-central/rev/c217fbde244344fedfd07b57a740c694a456dbca/browser/components/extensions/schemas/tabs.json#715-720 But the minimum restriction is not enforced due to return new this(schema, schema.minimum || -Infinity, schema.maximum || Infinity); https://searchfox.org/mozilla-central/rev/c217fbde244344fedfd07b57a740c694a456dbca/toolkit/components/extensions/Schemas.jsm#1801
nice catch.
Priority: -- → P3
By the way, StringType's maxLength and ArrayType's maxItems are also affected. But since string and array lengths can't be negative, enforcing a maximum of 0 seems pointless. So they might not be worth fixing. https://searchfox.org/mozilla-central/rev/c217fbde244344fedfd07b57a740c694a456dbca/toolkit/components/extensions/Schemas.jsm#1391 https://searchfox.org/mozilla-central/rev/c217fbde244344fedfd07b57a740c694a456dbca/toolkit/components/extensions/Schemas.jsm#1860
Comment on attachment 8961525 [details] Bug 1448120 - Allow 0 as minimum or maximum integer in webextension schema https://reviewboard.mozilla.org/r/230298/#review235908
Attachment #8961525 - Flags: review?(mixedpuppy) → review+
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/autoland/rev/75aaafadfe9d Allow 0 as minimum or maximum integer in webextension schema r=mixedpuppy
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Is manual testing required on this bug? If yes, please provide some STR and the proper extension(if required) or set the “qe-verify -“ flag. Thanks!
Flags: needinfo?(oriol-bugzilla)
Attached file test.xpi
(In reply to CosminB from comment #7) > Is manual testing required on this bug? If yes, please provide some STR and > the proper extension(if required) or set the “qe-verify -“ flag. 1. Open browser console 2. Install attached extension in about:debugging In the console you should see a "TEST PASS - got an error" saying that the index -1 should at least be 0. Before this bug you would get "TEST FAIL - didn't throw".
Flags: needinfo?(oriol-bugzilla)
See Also: → 1451334
Flags: qe-verify-
I guess bug 1451334 comment 1 belongs here: > Unnecessary to have QA, it's covered by a test.
Depends on: 1457673
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: