File tree Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -761,6 +761,7 @@ let JSWINDOWACTORS = {
761
761
ReportProductAvailable : { wantUntrusted : true } ,
762
762
AdClicked : { wantUntrusted : true } ,
763
763
AdImpression : { wantUntrusted : true } ,
764
+ DisableShopping : { wantUntrusted : true } ,
764
765
} ,
765
766
} ,
766
767
matches : [ "about:shoppingsidebar" ] ,
Original file line number Diff line number Diff line change @@ -165,6 +165,9 @@ export class ShoppingSidebarChild extends RemotePageChild {
165
165
ShoppingProduct . sendAttributionEvent ( "impression" , aid ) ;
166
166
Glean . shopping . surfaceAdsImpression . record ( ) ;
167
167
break ;
168
+ case "DisableShopping" :
169
+ this . sendAsyncMessage ( "DisableShopping" ) ;
170
+ break ;
168
171
}
169
172
}
170
173
Original file line number Diff line number Diff line change @@ -51,6 +51,16 @@ export class ShoppingSidebarParent extends JSWindowActorParent {
51
51
"browser[messagemanagergroup=browsers]"
52
52
) ;
53
53
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 ;
54
64
}
55
65
return null ;
56
66
}
@@ -310,7 +320,7 @@ class ShoppingSidebarManagerClass {
310
320
lazy . ShoppingUtils . sendTrigger ( {
311
321
browser : aBrowser ,
312
322
id : "shoppingProductPageWithSidebarClosed" ,
313
- context : { isSidebarClosing : ! ! sidebar } ,
323
+ context : { isSidebarClosing : ! aIsNavigation && ! ! sidebar } ,
314
324
} ) ;
315
325
}
316
326
}
Original file line number Diff line number Diff line change @@ -58,11 +58,9 @@ class ShoppingSettings extends MozLitElement {
58
58
}
59
59
60
60
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
+ ) ;
66
64
Glean . shopping . surfaceOptOutButtonClicked . record ( ) ;
67
65
}
68
66
You can’t perform that action at this time.
0 commit comments