mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 532173 - Don't sync tabs of some pages (weave firstrun, about:blank)
Ignore certain filtered urls when creating a list of tabs for remote machines.
This commit is contained in:
parent
0a30c91bc0
commit
eab5c8f980
@ -49,6 +49,8 @@ Cu.import("resource://weave/trackers.js");
|
||||
Cu.import("resource://weave/type_records/tabs.js");
|
||||
Cu.import("resource://weave/engines/clientData.js");
|
||||
|
||||
const filteredUrls = /^(about:blank|chrome:\/\/weave\/.*)$/i;
|
||||
|
||||
function TabEngine() {
|
||||
this._init();
|
||||
}
|
||||
@ -128,7 +130,8 @@ TabStore.prototype = {
|
||||
return id == Clients.clientID;
|
||||
},
|
||||
|
||||
getAllTabs: function getAllTabs() {
|
||||
|
||||
getAllTabs: function getAllTabs(filter) {
|
||||
// Iterate through each tab of each window
|
||||
let allTabs = [];
|
||||
let wins = Svc.WinMediator.getEnumerator("navigator:browser");
|
||||
@ -141,9 +144,15 @@ TabStore.prototype = {
|
||||
// Extract various pieces of tab data
|
||||
Array.forEach(tabs, function(tab) {
|
||||
let browser = tab.linkedBrowser || tab.browser;
|
||||
let url = browser.currentURI.spec;
|
||||
|
||||
// Filter out some urls if necessary
|
||||
if (filter && filteredUrls.test(url))
|
||||
return;
|
||||
|
||||
allTabs.push({
|
||||
title: browser.contentTitle || "",
|
||||
urlHistory: [browser.currentURI.spec],
|
||||
urlHistory: [url],
|
||||
icon: browser.mIconURL || "",
|
||||
lastUsed: tab.lastUsed || 0
|
||||
});
|
||||
@ -158,7 +167,7 @@ TabStore.prototype = {
|
||||
record.clientName = Clients.clientName;
|
||||
|
||||
// Sort tabs in descending-used order to grab the most recently used
|
||||
record.tabs = this.getAllTabs().sort(function(a, b) {
|
||||
record.tabs = this.getAllTabs(true).sort(function(a, b) {
|
||||
return b.lastUsed - a.lastUsed;
|
||||
}).slice(0, 25);
|
||||
record.tabs.forEach(function(tab) {
|
||||
|
Loading…
Reference in New Issue
Block a user