Bug 588011 - "Bookmark All Tabs" should ignore App Tabs.
Includes fix for Bug 607227 - Remove "Bookmark all Tabs" from the bookmarks menu. r=dao ui-r=faaborg a=blocker
This commit is contained in:
@@ -386,30 +386,21 @@ var PlacesCommandHook = {
|
||||
},
|
||||
|
||||
/**
|
||||
* This function returns a list of nsIURI objects characterizing the
|
||||
* tabs currently open in the browser. The URIs will appear in the
|
||||
* list in the order in which their corresponding tabs appeared. However,
|
||||
* only the first instance of each URI will be returned.
|
||||
*
|
||||
* @returns a list of nsIURI objects representing unique locations open
|
||||
* List of nsIURI objects characterizing the tabs currently open in the
|
||||
* browser, modulo pinned tabs. The URIs will be in the order in which their
|
||||
* corresponding tabs appeared and duplicates are discarded.
|
||||
*/
|
||||
_getUniqueTabInfo: function BATC__getUniqueTabInfo() {
|
||||
var tabList = [];
|
||||
var seenURIs = {};
|
||||
|
||||
let tabs = gBrowser.visibleTabs;
|
||||
for (let i = 0; i < tabs.length; ++i) {
|
||||
let uri = tabs[i].linkedBrowser.currentURI;
|
||||
|
||||
// skip redundant entries
|
||||
if (uri.spec in seenURIs)
|
||||
continue;
|
||||
|
||||
// add to the set of seen URIs
|
||||
seenURIs[uri.spec] = null;
|
||||
tabList.push(uri);
|
||||
}
|
||||
return tabList;
|
||||
get uniqueCurrentPages() {
|
||||
let uniquePages = {};
|
||||
let URIs = [];
|
||||
gBrowser.visibleTabs.forEach(function (tab) {
|
||||
let spec = tab.linkedBrowser.currentURI.spec;
|
||||
if (!tab.pinned && !(spec in uniquePages)) {
|
||||
uniquePages[spec] = null;
|
||||
URIs.push(tab.linkedBrowser.currentURI);
|
||||
}
|
||||
});
|
||||
return URIs;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -417,11 +408,23 @@ var PlacesCommandHook = {
|
||||
* window.
|
||||
*/
|
||||
bookmarkCurrentPages: function PCH_bookmarkCurrentPages() {
|
||||
var tabURIs = this._getUniqueTabInfo();
|
||||
PlacesUIUtils.showMinimalAddMultiBookmarkUI(tabURIs);
|
||||
let pages = this.uniqueCurrentPages;
|
||||
if (pages.length > 1) {
|
||||
PlacesUIUtils.showMinimalAddMultiBookmarkUI(pages);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates disabled state for the "Bookmark All Tabs" command.
|
||||
*/
|
||||
updateBookmarkAllTabsCommand:
|
||||
function PCH_updateBookmarkAllTabsCommand() {
|
||||
// Disable "Bookmark All Tabs" if there are less than two
|
||||
// "unique current pages".
|
||||
goSetCommandEnabled("Browser:BookmarkAllTabs",
|
||||
this.uniqueCurrentPages.length >= 2);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Adds a Live Bookmark to a feed associated with the current page.
|
||||
* @param url
|
||||
|
||||
Reference in New Issue
Block a user