mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-29 21:25:35 +00:00
Bug 1132301: Part 1 - share button should emit notifications when it is added to or removed from a customizable area. r=mixedpuppy
This commit is contained in:
parent
8771b32ca6
commit
e5331517f9
@ -413,6 +413,31 @@ const CustomizableWidgets = [
|
||||
node.setAttribute("removable", "true");
|
||||
node.setAttribute("observes", "Social:PageShareOrMark");
|
||||
node.setAttribute("command", "Social:SharePage");
|
||||
|
||||
let listener = {
|
||||
onWidgetAdded: (aWidgetId) => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
|
||||
Services.obs.notifyObservers(null, "social:" + this.id + "-added", null);
|
||||
},
|
||||
|
||||
onWidgetRemoved: aWidgetId => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
|
||||
Services.obs.notifyObservers(null, "social:" + this.id + "-removed", null);
|
||||
},
|
||||
|
||||
onWidgetInstanceRemoved: (aWidgetId, aDoc) => {
|
||||
if (aWidgetId != this.id || aDoc != aDocument)
|
||||
return;
|
||||
|
||||
CustomizableUI.removeListener(listener);
|
||||
}
|
||||
};
|
||||
CustomizableUI.addListener(listener);
|
||||
|
||||
return node;
|
||||
}
|
||||
}, {
|
||||
|
Loading…
Reference in New Issue
Block a user