-
Notifications
You must be signed in to change notification settings - Fork 22.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asyncBlocking in webRequest.onAuthRequired #34137
asyncBlocking in webRequest.onAuthRequired #34137
Conversation
Preview URLs
External URLs (2)URL:
(comment last updated: 2024-07-18 09:21:19) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there may have been a miscommunication around how async handling of onAuthRequired events work in Firefox 128+. The version of this PR I'm reviewing seems to say that Firefox 128 and later no longer support asynchronous response handling in "blocking"
listeners. Based on my reading of Firefox source, it appears that blocking
listeners can still return promises to asynchronously settle an onAuthRequired events. What has changed is that Firefox now supports registering onAuthRequired listeners with "asyncBlocking"
and these listeners match the behavior seen in Chrome.
All changes suggested in this review are for illustrative purposes. I'm happy to defer to your judgement on how best to structure the related content.
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Outdated
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Outdated
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Simeon Vincent <svincent@gmail.com>
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Outdated
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Outdated
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Outdated
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Show resolved
Hide resolved
@dotproto I need to check the language in the changes and fix some formatting issues but in the meanwhile, could you check my latest updates, do they address your feedback? |
This pull request has merge conflicts that must be resolved before it can be merged. |
This pull request has merge conflicts that must be resolved before it can be merged. |
This pull request has merge conflicts that must be resolved before it can be merged. |
@rebloor, I just created a test extension to flex the various ways that an |
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Outdated
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/webrequest/onauthrequired/index.md
Show resolved
Hide resolved
Co-authored-by: Simeon Vincent <svincent@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@@ -82,23 +84,28 @@ Events have three functions: | |||
|
|||
- `details` | |||
- : `object`. Details about the request. See the [details](#details_2) section for more information. | |||
- `asyncCallback` {{optional_inline}} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mdn-linter] reported by reviewdog 🐶
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rebloor, any idea why mdn-linter is generating linter warnings that aren't showing up when doing a local yarn lint:md
or know who we could tag about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dotproto sorry, no and no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one last subjective suggestion. Thanks, @rebloor!
- in addListener, pass `"asyncBlocking"` in Chrome and Firefox or `"blocking"` in Firefox in the `extraInfoSpec` parameter | ||
- If `"blocking"` is provided, the extension can return a `webRequest.BlockingResponse` object or a Promise that resolves to a `webRequest.BlockingResponse` object | ||
- If `"asyncBlocking"` is provided, the event listener function receives a `asyncCallback` function as its second parameter. `asyncCallback`can be called asynchronously and takes a`webRequest.BlockingResponse` object as its only parameter | ||
|
||
> **Note:** Chrome does not support a Promise as a return value ([Chromium issue 1510405](https://crbug.com/1510405)). For alternatives, see [the return value of the `listener`](#listener). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this information is a bit redundant given the recent changes to the extraInfoSpec
parameter documentation. Should we remove this block and link to that property for details? I'm happy to defer to your judgement.
Description
Addresses the documentation requirements of Bug 1889897 Implement asyncBlocking support for webRequest.onAuthRequired, including: