Loading browser/components/tabview/storage.js +0 −14 Original line number Diff line number Diff line Loading @@ -123,20 +123,6 @@ let Storage = { return existingData; }, // ---------- // Function: getTabState // Returns the current state of the given tab. getTabState: function Storage_getTabState(tab) { Utils.assert(tab, "tab"); let tabState; try { tabState = JSON.parse(this._sessionStore.getTabState(tab)); } catch (e) {} return tabState; }, // ---------- // Function: saveGroupItem // Saves the data for a single groupItem, associated with a specific window. Loading browser/components/tabview/tabitems.js +27 −47 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ function TabItem(tab, options) { this._reconnected = false; this.isDragging = false; this.isStacked = false; this.url = ""; // Read off the total vertical and horizontal padding on the tab container // and cache this value, as it must be the same for every TabItem. Loading Loading @@ -199,14 +200,21 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { // be called at browser startup with the cached data avaliable. // // Parameters: // tabData - the tab data // imageData - the image data showCachedData: function TabItem_showCachedData(imageData) { showCachedData: function TabItem_showCachedData(tabData, imageData) { this._cachedImageData = imageData; this.$cachedThumb.attr("src", this._cachedImageData).show(); this.$canvas.css({opacity: 0}); let {title, url} = this.getTabState(); this.$tabTitle.text(title).attr("title", title ? title + "\n" + url : url); let label = ""; let title; if (tabData.title) { label = tabData.title; title = label + "\n" + tabData.url; } else { title = tabData.url; } this.$tabTitle.text(label).attr("title", title); this._sendToSubscribers("showingCachedData"); }, Loading @@ -226,7 +234,9 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { // Get data to be used for persistent storage of this object. getStorageData: function TabItem_getStorageData() { let data = { groupID: (this.parent ? this.parent.id : 0) url: this.tab.linkedBrowser.currentURI.spec, groupID: (this.parent ? this.parent.id : 0), title: this.tab.label }; if (this.parent && this.parent.getActiveTab() == this) data.active = true; Loading @@ -250,46 +260,12 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { } }, // ---------- // Function: _getCurrentTabStateEntry // Returns the current tab state's active history entry. _getCurrentTabStateEntry: function TabItem__getCurrentTabStateEntry() { let tabState = Storage.getTabState(this.tab); if (tabState) { let index = (tabState.index || tabState.entries.length) - 1; if (index in tabState.entries) return tabState.entries[index]; } return null; }, // ---------- // Function: getTabState // Returns the current tab state, i.e. the title and URL of the active // history entry. getTabState: function TabItem_getTabState() { let entry = this._getCurrentTabStateEntry(); let title = ""; let url = ""; if (entry) { if (entry.title) title = entry.title; url = entry.url; } else { url = this.tab.linkedBrowser.currentURI.spec; } return {title: title, url: url}; }, // ---------- // Function: loadThumbnail // Loads the tabItems thumbnail. loadThumbnail: function TabItem_loadThumbnail() { loadThumbnail: function TabItem_loadThumbnail(tabData) { Utils.assert(tabData, "invalid or missing argument <tabData>"); let self = this; function TabItem_loadThumbnail_callback(error, imageData) { Loading @@ -309,11 +285,11 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { // what the cache is from, OR the loaded URL is blank, which means // that the page hasn't loaded yet. let currentUrl = self.tab.linkedBrowser.currentURI.spec; if (self.getTabState().url == currentUrl || currentUrl == "about:blank") self.showCachedData(imageData); if (tabData.url == currentUrl || currentUrl == "about:blank") self.showCachedData(tabData, imageData); } ThumbnailStorage.loadThumbnail(this.getTabState().url, TabItem_loadThumbnail_callback); ThumbnailStorage.loadThumbnail(tabData.url, TabItem_loadThumbnail_callback); }, // ---------- Loading Loading @@ -394,7 +370,7 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { let groupItem; if (tabData && TabItems.storageSanity(tabData)) { this.loadThumbnail(); this.loadThumbnail(tabData); if (this.parent) this.parent.remove(this, {immediately: true}); Loading Loading @@ -958,7 +934,7 @@ let TabItems = { return ( tab.linkedBrowser.contentDocument.readyState == 'complete' && !(tab.linkedBrowser.contentDocument.URL == 'about:blank' && tab._tabViewTabItem.getTabState().url != 'about:blank') tab._tabViewTabItem.url != 'about:blank') ); }, Loading Loading @@ -1037,6 +1013,10 @@ let TabItems = { // ___ URL let tabUrl = tab.linkedBrowser.currentURI.spec; if (tabUrl != tabItem.url) { tabItem.url = tabUrl; tabItem.save(); } tabItem.$container.attr("title", label + "\n" + tabUrl); // ___ Make sure the tab is complete and ready for updating. Loading Loading
browser/components/tabview/storage.js +0 −14 Original line number Diff line number Diff line Loading @@ -123,20 +123,6 @@ let Storage = { return existingData; }, // ---------- // Function: getTabState // Returns the current state of the given tab. getTabState: function Storage_getTabState(tab) { Utils.assert(tab, "tab"); let tabState; try { tabState = JSON.parse(this._sessionStore.getTabState(tab)); } catch (e) {} return tabState; }, // ---------- // Function: saveGroupItem // Saves the data for a single groupItem, associated with a specific window. Loading
browser/components/tabview/tabitems.js +27 −47 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ function TabItem(tab, options) { this._reconnected = false; this.isDragging = false; this.isStacked = false; this.url = ""; // Read off the total vertical and horizontal padding on the tab container // and cache this value, as it must be the same for every TabItem. Loading Loading @@ -199,14 +200,21 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { // be called at browser startup with the cached data avaliable. // // Parameters: // tabData - the tab data // imageData - the image data showCachedData: function TabItem_showCachedData(imageData) { showCachedData: function TabItem_showCachedData(tabData, imageData) { this._cachedImageData = imageData; this.$cachedThumb.attr("src", this._cachedImageData).show(); this.$canvas.css({opacity: 0}); let {title, url} = this.getTabState(); this.$tabTitle.text(title).attr("title", title ? title + "\n" + url : url); let label = ""; let title; if (tabData.title) { label = tabData.title; title = label + "\n" + tabData.url; } else { title = tabData.url; } this.$tabTitle.text(label).attr("title", title); this._sendToSubscribers("showingCachedData"); }, Loading @@ -226,7 +234,9 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { // Get data to be used for persistent storage of this object. getStorageData: function TabItem_getStorageData() { let data = { groupID: (this.parent ? this.parent.id : 0) url: this.tab.linkedBrowser.currentURI.spec, groupID: (this.parent ? this.parent.id : 0), title: this.tab.label }; if (this.parent && this.parent.getActiveTab() == this) data.active = true; Loading @@ -250,46 +260,12 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { } }, // ---------- // Function: _getCurrentTabStateEntry // Returns the current tab state's active history entry. _getCurrentTabStateEntry: function TabItem__getCurrentTabStateEntry() { let tabState = Storage.getTabState(this.tab); if (tabState) { let index = (tabState.index || tabState.entries.length) - 1; if (index in tabState.entries) return tabState.entries[index]; } return null; }, // ---------- // Function: getTabState // Returns the current tab state, i.e. the title and URL of the active // history entry. getTabState: function TabItem_getTabState() { let entry = this._getCurrentTabStateEntry(); let title = ""; let url = ""; if (entry) { if (entry.title) title = entry.title; url = entry.url; } else { url = this.tab.linkedBrowser.currentURI.spec; } return {title: title, url: url}; }, // ---------- // Function: loadThumbnail // Loads the tabItems thumbnail. loadThumbnail: function TabItem_loadThumbnail() { loadThumbnail: function TabItem_loadThumbnail(tabData) { Utils.assert(tabData, "invalid or missing argument <tabData>"); let self = this; function TabItem_loadThumbnail_callback(error, imageData) { Loading @@ -309,11 +285,11 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { // what the cache is from, OR the loaded URL is blank, which means // that the page hasn't loaded yet. let currentUrl = self.tab.linkedBrowser.currentURI.spec; if (self.getTabState().url == currentUrl || currentUrl == "about:blank") self.showCachedData(imageData); if (tabData.url == currentUrl || currentUrl == "about:blank") self.showCachedData(tabData, imageData); } ThumbnailStorage.loadThumbnail(this.getTabState().url, TabItem_loadThumbnail_callback); ThumbnailStorage.loadThumbnail(tabData.url, TabItem_loadThumbnail_callback); }, // ---------- Loading Loading @@ -394,7 +370,7 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), { let groupItem; if (tabData && TabItems.storageSanity(tabData)) { this.loadThumbnail(); this.loadThumbnail(tabData); if (this.parent) this.parent.remove(this, {immediately: true}); Loading Loading @@ -958,7 +934,7 @@ let TabItems = { return ( tab.linkedBrowser.contentDocument.readyState == 'complete' && !(tab.linkedBrowser.contentDocument.URL == 'about:blank' && tab._tabViewTabItem.getTabState().url != 'about:blank') tab._tabViewTabItem.url != 'about:blank') ); }, Loading Loading @@ -1037,6 +1013,10 @@ let TabItems = { // ___ URL let tabUrl = tab.linkedBrowser.currentURI.spec; if (tabUrl != tabItem.url) { tabItem.url = tabUrl; tabItem.save(); } tabItem.$container.attr("title", label + "\n" + tabUrl); // ___ Make sure the tab is complete and ready for updating. Loading