зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1375806 - don't overwrite the current non-empty tab when viewing pocket list, r=mixedpuppy
This moves the logic into Pocket.jsm, and first determines the right place based on modifiers etc. using whereToOpenLink. If that returns 'current', we override with 'tab' if and only if the current tab is non-empty (so we'll reuse about:blank or about:newtab, but not tabs with a website / history). MozReview-Commit-ID: H64bREBn8OU --HG-- extra : rebase_source : 9f7df22d0fc08fcdb9e37b4cce0a95f9979b98e5
This commit is contained in:
Родитель
2dc1a0736c
Коммит
27a784c809
|
@ -462,7 +462,7 @@ var PocketOverlay = {
|
|||
"id": "menu_pocket",
|
||||
"label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
|
||||
"class": "menuitem-iconic", // OSX only
|
||||
"oncommand": "openUILink(Pocket.listURL, event);",
|
||||
"oncommand": "Pocket.openList(event)",
|
||||
"hidden": hidden
|
||||
});
|
||||
let sep = createElementWithAttrs(document, "menuseparator", {
|
||||
|
@ -483,7 +483,7 @@ var PocketOverlay = {
|
|||
"id": "BMB_pocket",
|
||||
"label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
|
||||
"class": "menuitem-iconic bookmark-item subviewbutton",
|
||||
"oncommand": "openUILink(Pocket.listURL, event);",
|
||||
"oncommand": "Pocket.openList(event)",
|
||||
"hidden": hidden
|
||||
});
|
||||
let sep = createElementWithAttrs(document, "menuseparator", {
|
||||
|
@ -501,7 +501,7 @@ var PocketOverlay = {
|
|||
"id": "panelMenu_pocket",
|
||||
"label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
|
||||
"class": "subviewbutton cui-withicon",
|
||||
"oncommand": "openUILink(Pocket.listURL, event);",
|
||||
"oncommand": "Pocket.openList(event)",
|
||||
"hidden": hidden
|
||||
});
|
||||
let sep = createElementWithAttrs(document, "toolbarseparator", {
|
||||
|
@ -522,7 +522,7 @@ var PocketOverlay = {
|
|||
"id": "appMenu-library-pocket-button",
|
||||
"label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
|
||||
"class": "subviewbutton subviewbutton-iconic",
|
||||
"oncommand": "openUILink(Pocket.listURL, event);",
|
||||
"oncommand": "Pocket.openList(event)",
|
||||
"hidden": hidden
|
||||
});
|
||||
sib.parentNode.insertBefore(menu, sib);
|
||||
|
|
|
@ -19,6 +19,16 @@ var Pocket = {
|
|||
get site() { return Services.prefs.getCharPref("extensions.pocket.site"); },
|
||||
get listURL() { return "https://" + Pocket.site + "/?src=ff_ext"; },
|
||||
|
||||
openList(event) {
|
||||
let win = event.view;
|
||||
let where = win.whereToOpenLink(event);
|
||||
// Never override the current tab unless it's blank:
|
||||
if (where == "current" && !win.isTabEmpty(win.gBrowser.selectedTab)) {
|
||||
where = "tab";
|
||||
}
|
||||
win.openUILinkIn(this.listURL, where);
|
||||
},
|
||||
|
||||
/**
|
||||
* Functions related to the Pocket panel UI.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче