mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 15:17:29 +09:00
Dont rely on 'this' staying alive long enough for getting favicons.
This fixes #809.
This commit is contained in:
parent
c80a76aaf0
commit
45cb285411
2 changed files with 10 additions and 8 deletions
|
|
@ -597,6 +597,7 @@ TabWindow.prototype = {
|
||||||
"file", "chrome", "resource", "about"
|
"file", "chrome", "resource", "about"
|
||||||
]),
|
]),
|
||||||
onLinkIconAvailable: function (aBrowser, aIconURL) {
|
onLinkIconAvailable: function (aBrowser, aIconURL) {
|
||||||
|
let self = this;
|
||||||
let requestURL = null;
|
let requestURL = null;
|
||||||
if (aIconURL) {
|
if (aIconURL) {
|
||||||
let shouldRequestFaviconURL = true;
|
let shouldRequestFaviconURL = true;
|
||||||
|
|
@ -613,15 +614,15 @@ TabWindow.prototype = {
|
||||||
let isDefaultFavicon = !requestURL;
|
let isDefaultFavicon = !requestURL;
|
||||||
getFaviconAsImage(
|
getFaviconAsImage(
|
||||||
requestURL,
|
requestURL,
|
||||||
PrivateBrowsingUtils.isWindowPrivate(this.win),
|
PrivateBrowsingUtils.isWindowPrivate(self.win),
|
||||||
img => {
|
img => {
|
||||||
let index = this.tabbrowser.browsers.indexOf(aBrowser);
|
let index = self.tabbrowser.browsers.indexOf(aBrowser);
|
||||||
// Only add it if we've found the index and the URI is still the same.
|
// Only add it if we've found the index and the URI is still the same.
|
||||||
// The tab could have closed, and there's no guarantee the icons
|
// The tab could have closed, and there's no guarantee the icons
|
||||||
// will have finished fetching 'in order'.
|
// will have finished fetching 'in order'.
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
let tab = this.tabbrowser.tabs[index];
|
let tab = self.tabbrowser.tabs[index];
|
||||||
let preview = this.previews.get(tab);
|
let preview = self.previews.get(tab);
|
||||||
if (tab.getAttribute("image") == aIconURL ||
|
if (tab.getAttribute("image") == aIconURL ||
|
||||||
(!preview.icon && isDefaultFavicon)) {
|
(!preview.icon && isDefaultFavicon)) {
|
||||||
preview.icon = img;
|
preview.icon = img;
|
||||||
|
|
|
||||||
|
|
@ -595,6 +595,7 @@ TabWindow.prototype = {
|
||||||
"file", "chrome", "resource", "about"
|
"file", "chrome", "resource", "about"
|
||||||
]),
|
]),
|
||||||
onLinkIconAvailable: function (aBrowser, aIconURL) {
|
onLinkIconAvailable: function (aBrowser, aIconURL) {
|
||||||
|
let self = this;
|
||||||
let requestURL = null;
|
let requestURL = null;
|
||||||
if (aIconURL) {
|
if (aIconURL) {
|
||||||
let shouldRequestFaviconURL = true;
|
let shouldRequestFaviconURL = true;
|
||||||
|
|
@ -611,15 +612,15 @@ TabWindow.prototype = {
|
||||||
let isDefaultFavicon = !requestURL;
|
let isDefaultFavicon = !requestURL;
|
||||||
getFaviconAsImage(
|
getFaviconAsImage(
|
||||||
requestURL,
|
requestURL,
|
||||||
PrivateBrowsingUtils.isWindowPrivate(this.win),
|
PrivateBrowsingUtils.isWindowPrivate(self.win),
|
||||||
img => {
|
img => {
|
||||||
let index = this.tabbrowser.browsers.indexOf(aBrowser);
|
let index = self.tabbrowser.browsers.indexOf(aBrowser);
|
||||||
// Only add it if we've found the index and the URI is still the same.
|
// Only add it if we've found the index and the URI is still the same.
|
||||||
// The tab could have closed, and there's no guarantee the icons
|
// The tab could have closed, and there's no guarantee the icons
|
||||||
// will have finished fetching 'in order'.
|
// will have finished fetching 'in order'.
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
let tab = this.tabbrowser.tabs[index];
|
let tab = self.tabbrowser.tabs[index];
|
||||||
let preview = this.previews.get(tab);
|
let preview = self.previews.get(tab);
|
||||||
if (tab.getAttribute("image") == aIconURL ||
|
if (tab.getAttribute("image") == aIconURL ||
|
||||||
(!preview.icon && isDefaultFavicon)) {
|
(!preview.icon && isDefaultFavicon)) {
|
||||||
preview.icon = img;
|
preview.icon = img;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue