From f3fd9014bf6fc64486366065b5d170b183498a0e Mon Sep 17 00:00:00 2001 From: Hoarfroster Date: Wed, 4 Dec 2024 18:59:16 +0800 Subject: [PATCH 1/7] fix typo --- .../add-ons/webextensions/api/management/uninstall/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md index 5483e76d55a3782..f989bb83e5f1141 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md @@ -32,7 +32,7 @@ let uninstalling = browser.management.uninstall( - If `id` is the calling add-on's ID, `showConfirmDialog` defaults to `false`. -- If `id` is a the ID of a different add-on, the `showConfirmDialog` option is ignored and the confirmation dialog is always shown. +- If `id` is an ID of a different add-on, the `showConfirmDialog` option is ignored and the confirmation dialog is always shown. ### Return value From 8e2d3457ac5da02bed0eee54acb3d1c5a5518a57 Mon Sep 17 00:00:00 2001 From: Hoarfroster Date: Wed, 4 Dec 2024 19:12:26 +0800 Subject: [PATCH 2/7] update code example and description --- .../api/management/uninstall/index.md | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md index f989bb83e5f1141..fce041eee5da90f 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md @@ -44,19 +44,23 @@ A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that ## Examples -Uninstall the add-on whose ID is "my-addon-id", asking the user to confirm. In the callback, check whether the user canceled uninstallation. - -Note that we haven't passed a fulfillment handler because if uninstallation succeeds, the add-on is no longer around to handle it. +Uninstall the add-on whose ID is "addon-id" and ask the user to confirm. In the callback, we check whether the user cancelled uninstallation, or if the uninstallation succeeded. ```js -let id = "my-addon-id"; +let id = "addon-id"; -function onCanceled(error) { - console.log(`Uninstall canceled: ${error}`); -} +const uninstall = () => { + function onCanceled(error) { + console.log(`Cancelled: ${error}`); + } -let uninstalling = browser.management.uninstall(id); -uninstalling.then(null, onCanceled); + function onUninstalled() { + console.log("Uninstalled"); + } + + let uninstalling = chrome.management.uninstall(id); + uninstalling.then(onUninstalled, onCanceled); +} ``` {{WebExtExamples}} From 0a6d376bc6fcaf86f1693bc82ede8ee638b94348 Mon Sep 17 00:00:00 2001 From: Hoarfroster Date: Wed, 4 Dec 2024 19:15:36 +0800 Subject: [PATCH 3/7] minor improvements --- .../add-ons/webextensions/api/management/uninstall/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md index fce041eee5da90f..60c9c120fa80340 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md @@ -36,7 +36,7 @@ let uninstalling = browser.management.uninstall( ### Return value -A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that will be rejected with an error message if the user canceled uninstall. +A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that will be rejected with an error message if the user canceled the uninstallation. ## Browser compatibility @@ -44,14 +44,14 @@ A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that ## Examples -Uninstall the add-on whose ID is "addon-id" and ask the user to confirm. In the callback, we check whether the user cancelled uninstallation, or if the uninstallation succeeded. +Uninstall the add-on whose ID is "addon-id" and ask the user to confirm. In the callback, we check whether the user canceled the uninstallation, or if the operation succeeded. ```js let id = "addon-id"; const uninstall = () => { function onCanceled(error) { - console.log(`Cancelled: ${error}`); + console.log(`Canceled: ${error}`); } function onUninstalled() { From 8502777b1ca2e99b47795d754d5c2fcf631e6464 Mon Sep 17 00:00:00 2001 From: Hoarfroster Date: Wed, 4 Dec 2024 19:20:02 +0800 Subject: [PATCH 4/7] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../webextensions/api/management/uninstall/index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md index 60c9c120fa80340..476cf5d15978948 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md @@ -54,13 +54,13 @@ const uninstall = () => { console.log(`Canceled: ${error}`); } - function onUninstalled() { - console.log("Uninstalled"); - } + function onUninstalled() { + console.log("Uninstalled"); + } - let uninstalling = chrome.management.uninstall(id); - uninstalling.then(onUninstalled, onCanceled); -} + let uninstalling = chrome.management.uninstall(id); + uninstalling.then(onUninstalled, onCanceled); +}; ``` {{WebExtExamples}} From 282c43619a07804e89a5493b35e17400577a86c1 Mon Sep 17 00:00:00 2001 From: Hoarfroster Date: Wed, 4 Dec 2024 19:24:44 +0800 Subject: [PATCH 5/7] Update files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../add-ons/webextensions/api/management/uninstall/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md index 476cf5d15978948..bf6c046263d254f 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md @@ -50,9 +50,9 @@ Uninstall the add-on whose ID is "addon-id" and ask the user to confirm. In the let id = "addon-id"; const uninstall = () => { - function onCanceled(error) { - console.log(`Canceled: ${error}`); - } + function onCanceled(error) { + console.log(`Canceled: ${error}`); + } function onUninstalled() { console.log("Uninstalled"); From 7de89db3837c1ae2fb49a55583d14f58a7f642cd Mon Sep 17 00:00:00 2001 From: Hoarfroster Date: Wed, 4 Dec 2024 19:25:40 +0800 Subject: [PATCH 6/7] Update index.md --- .../api/management/uninstall/index.md | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md index bf6c046263d254f..5be5d9518c43912 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md @@ -49,18 +49,16 @@ Uninstall the add-on whose ID is "addon-id" and ask the user to confirm. In the ```js let id = "addon-id"; -const uninstall = () => { - function onCanceled(error) { - console.log(`Canceled: ${error}`); - } - - function onUninstalled() { - console.log("Uninstalled"); - } - - let uninstalling = chrome.management.uninstall(id); - uninstalling.then(onUninstalled, onCanceled); -}; +function onCanceled(error) { + console.log(`Canceled: ${error}`); +} + +function onUninstalled() { + console.log("Uninstalled"); +} + +let uninstalling = browser.management.uninstall(id); +uninstalling.then(onUninstalled, onCanceled); ``` {{WebExtExamples}} From 49b57a57f02e375e06de91e2ed39d8856471e6dd Mon Sep 17 00:00:00 2001 From: Hoarfroster Date: Mon, 16 Dec 2024 12:09:57 +0800 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: rebloor --- .../add-ons/webextensions/api/management/uninstall/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md index 5be5d9518c43912..75ea117d9896265 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md @@ -32,7 +32,7 @@ let uninstalling = browser.management.uninstall( - If `id` is the calling add-on's ID, `showConfirmDialog` defaults to `false`. -- If `id` is an ID of a different add-on, the `showConfirmDialog` option is ignored and the confirmation dialog is always shown. +- If `id` is the ID of a different add-on, the `showConfirmDialog` option is ignored and the confirmation dialog is always shown. ### Return value @@ -44,7 +44,7 @@ A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that ## Examples -Uninstall the add-on whose ID is "addon-id" and ask the user to confirm. In the callback, we check whether the user canceled the uninstallation, or if the operation succeeded. +Uninstall the add-on whose ID is "addon-id" and ask the user to confirm. In the callback, we check whether the user canceled the uninstallation or if the operation succeeded. ```js let id = "addon-id";