webRequest.getSecurityInfo() options parameter is documented as optional but cannot be optional
Categories
(WebExtensions :: Request Handling, defect, P3)
Tracking
(firefox130 fixed)
| Tracking | Status | |
|---|---|---|
| firefox130 | --- | fixed |
People
(Reporter: robwu, Assigned: robwu)
References
Details
(Keywords: dev-doc-complete, Whiteboard: [addons-jira])
Attachments
(1 file)
options parameter documented as optional: https://searchfox.org/mozilla-central/rev/de46cd99a7d1634058b511a3f546a970763e5048/toolkit/components/extensions/schemas/web_request.json#469,479-480
Implementation has (requestId, options = {}):
- https://searchfox.org/mozilla-central/rev/de46cd99a7d1634058b511a3f546a970763e5048/toolkit/components/extensions/parent/ext-webRequest.js#199
- https://searchfox.org/mozilla-central/rev/de46cd99a7d1634058b511a3f546a970763e5048/toolkit/components/extensions/webrequest/SecurityInfo.sys.mjs#58
- and expects
optionsto be an object later, e.g. when checking for options.certificateChain
- and expects
options = {} only converts an omitted options to {} if options is undefined. But the Schema validator converts missing options to null instead, which prevents this from working.
Consequently, a call to browser.webRequest.getSecurityInfo(requestId) without options parameter results in an (async) error.
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 1•1 year ago
|
||
Comment 3•1 year ago
|
||
| bugherder | ||
Could I clarify what documentation is required here? We already document this as optional e.g. "object. An object which may contain any of the following properties, all optional:" Or is the requirement a release note to state that this now behaviors as documented?
| Assignee | ||
Comment 5•1 year ago
|
||
The options object itself should also be marked as optional on MDN ({{optional_inline}}), at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/getSecurityInfo#options
The BCD should mention that the option is optional since 130.
Changes ready for review:
- (Content) webRequest.getSecurityInfo options parameter optional #35345
- (BCD) webRequest.getSecurityInfo options parameter optional #24056
Description
•