mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 03:35:33 +00:00
Bug 1160578 - Disable the Pocket button for logged-in users on internal Firefox pages. r=dolske
This commit is contained in:
parent
2800f31644
commit
13bb25fb11
@ -52,7 +52,8 @@ XPCOMUtils.defineLazyServiceGetter(this, "gDNSService",
|
||||
"nsIDNSService");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
|
||||
"resource://gre/modules/LightweightThemeManager.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Pocket",
|
||||
"resource:///modules/Pocket.jsm");
|
||||
|
||||
const nsIWebNavigation = Ci.nsIWebNavigation;
|
||||
|
||||
@ -4162,6 +4163,7 @@ var XULBrowserWindow = {
|
||||
BookmarkingUI.onLocationChange();
|
||||
SocialUI.updateState(location);
|
||||
UITour.onLocationChange(location);
|
||||
Pocket.onLocationChange(browser, aLocationURI);
|
||||
}
|
||||
|
||||
// Utility functions for disabling find
|
||||
|
@ -132,4 +132,28 @@ let Pocket = {
|
||||
let window = event.target.ownerDocument.defaultView;
|
||||
window.pktUI.pocketPanelDidHide(event);
|
||||
},
|
||||
|
||||
// Called on tab/urlbar/location changes and after customization. Update
|
||||
// anything that is tab specific.
|
||||
onLocationChange(browser, locationURI) {
|
||||
if (!locationURI) {
|
||||
return;
|
||||
}
|
||||
let widget = CustomizableUI.getWidget("pocket-button");
|
||||
for (let instance of widget.instances) {
|
||||
let node = instance.node;
|
||||
if (!node ||
|
||||
node.ownerDocument != browser.ownerDocument) {
|
||||
continue;
|
||||
}
|
||||
if (node) {
|
||||
let win = browser.ownerDocument.defaultView;
|
||||
node.disabled = win.pktApi.isUserLoggedIn() &&
|
||||
!locationURI.schemeIs("http") &&
|
||||
!locationURI.schemeIs("https") &&
|
||||
!(locationURI.schemeIs("about") &&
|
||||
locationURI.spec.toLowerCase().startsWith("about:reader?url="));
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user