Skip to content

Commit

Permalink
Wait for user allowlisting to apply before reloading the website (#2515)
Browse files Browse the repository at this point in the history
The popup UI (e.g. privacy dashboard) lets users disable protections
for a website. When the user clicks the toggle button, the website is
allowlisted and reloaded. With MV3, this requires a
declarativeNetRequest rule update which doesn't happen instantly. We
need to take care for that rule update to finish before reloading the
page, because otherwise some requests might still be blocked after the
reload.
  • Loading branch information
kzar authored Apr 26, 2024
1 parent 1364215 commit eb9b76d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shared/js/background/message-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ export function setList (options) {
* @param {import('@duckduckgo/privacy-dashboard/schema/__generated__/schema.types').SetListOptions} options
*/
export async function setLists (options) {
// TODO: Consider making these tabManager.setList calls concurrently with
// Promise.all, but first verify that works in practice (e.g. with
// simultaneous DNR rule updates).
for (const listItem of options.lists) {
tabManager.setList(listItem)
await tabManager.setList(listItem)
}

try {
Expand Down

0 comments on commit eb9b76d

Please sign in to comment.