Skip to content

Commit b32b88d

Browse files
committed
Bug 1878036 - Fix review checker callout trigger timing. r=jhirsch
Differential Revision: https://phabricator.services.mozilla.com/D200371
1 parent 5b05e0a commit b32b88d

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

browser/components/BrowserGlue.sys.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ let JSWINDOWACTORS = {
761761
ReportProductAvailable: { wantUntrusted: true },
762762
AdClicked: { wantUntrusted: true },
763763
AdImpression: { wantUntrusted: true },
764+
DisableShopping: { wantUntrusted: true },
764765
},
765766
},
766767
matches: ["about:shoppingsidebar"],

browser/components/shopping/ShoppingSidebarChild.sys.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ export class ShoppingSidebarChild extends RemotePageChild {
165165
ShoppingProduct.sendAttributionEvent("impression", aid);
166166
Glean.shopping.surfaceAdsImpression.record();
167167
break;
168+
case "DisableShopping":
169+
this.sendAsyncMessage("DisableShopping");
170+
break;
168171
}
169172
}
170173

browser/components/shopping/ShoppingSidebarParent.sys.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ export class ShoppingSidebarParent extends JSWindowActorParent {
5151
"browser[messagemanagergroup=browsers]"
5252
);
5353
return associatedTabbedBrowser.currentURI?.spec ?? null;
54+
case "DisableShopping":
55+
Services.prefs.setBoolPref(
56+
ShoppingSidebarParent.SHOPPING_ACTIVE_PREF,
57+
false
58+
);
59+
Services.prefs.setIntPref(
60+
ShoppingSidebarParent.SHOPPING_OPTED_IN_PREF,
61+
2
62+
);
63+
break;
5464
}
5565
return null;
5666
}
@@ -310,7 +320,7 @@ class ShoppingSidebarManagerClass {
310320
lazy.ShoppingUtils.sendTrigger({
311321
browser: aBrowser,
312322
id: "shoppingProductPageWithSidebarClosed",
313-
context: { isSidebarClosing: !!sidebar },
323+
context: { isSidebarClosing: !aIsNavigation && !!sidebar },
314324
});
315325
}
316326
}

browser/components/shopping/content/settings.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ class ShoppingSettings extends MozLitElement {
5858
}
5959

6060
onDisableShopping() {
61-
// Unfortunately, order matters here. As soon as we set the optedIn pref
62-
// to the opted out state, the sidebar gets torn down, and the active pref
63-
// is never flipped, leaving the toolbar button in the active state.
64-
RPMSetPref("browser.shopping.experience2023.active", false);
65-
RPMSetPref("browser.shopping.experience2023.optedIn", 2);
61+
window.dispatchEvent(
62+
new CustomEvent("DisableShopping", { bubbles: true, composed: true })
63+
);
6664
Glean.shopping.surfaceOptOutButtonClicked.record();
6765
}
6866

0 commit comments

Comments
 (0)