summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-01-02 00:24:43 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-01-02 00:24:43 +0100
commit8a10092b53d54b8cbbd1e7004c0121f2563306d9 (patch)
tree7abfe4f042e2c3be1ca49b36469e5aa652f6e2d6
parent78ad9498a2ed27b9938744d061d65f3d82e88199 (diff)
downloadUXP-8a10092b53d54b8cbbd1e7004c0121f2563306d9.tar
UXP-8a10092b53d54b8cbbd1e7004c0121f2563306d9.tar.gz
UXP-8a10092b53d54b8cbbd1e7004c0121f2563306d9.tar.lz
UXP-8a10092b53d54b8cbbd1e7004c0121f2563306d9.tar.xz
UXP-8a10092b53d54b8cbbd1e7004c0121f2563306d9.zip
Dont rely on 'this' staying alive long enough for getting favicons.
This fixes #809.
-rw-r--r--application/basilisk/modules/WindowsPreviewPerTab.jsm9
-rw-r--r--application/palemoon/modules/WindowsPreviewPerTab.jsm9
2 files changed, 10 insertions, 8 deletions
diff --git a/application/basilisk/modules/WindowsPreviewPerTab.jsm b/application/basilisk/modules/WindowsPreviewPerTab.jsm
index 6586b5d3b..81c2f229f 100644
--- a/application/basilisk/modules/WindowsPreviewPerTab.jsm
+++ b/application/basilisk/modules/WindowsPreviewPerTab.jsm
@@ -597,6 +597,7 @@ TabWindow.prototype = {
"file", "chrome", "resource", "about"
]),
onLinkIconAvailable: function (aBrowser, aIconURL) {
+ let self = this;
let requestURL = null;
if (aIconURL) {
let shouldRequestFaviconURL = true;
@@ -613,15 +614,15 @@ TabWindow.prototype = {
let isDefaultFavicon = !requestURL;
getFaviconAsImage(
requestURL,
- PrivateBrowsingUtils.isWindowPrivate(this.win),
+ PrivateBrowsingUtils.isWindowPrivate(self.win),
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.
// The tab could have closed, and there's no guarantee the icons
// will have finished fetching 'in order'.
if (index != -1) {
- let tab = this.tabbrowser.tabs[index];
- let preview = this.previews.get(tab);
+ let tab = self.tabbrowser.tabs[index];
+ let preview = self.previews.get(tab);
if (tab.getAttribute("image") == aIconURL ||
(!preview.icon && isDefaultFavicon)) {
preview.icon = img;
diff --git a/application/palemoon/modules/WindowsPreviewPerTab.jsm b/application/palemoon/modules/WindowsPreviewPerTab.jsm
index 243a00aae..4b5030ad4 100644
--- a/application/palemoon/modules/WindowsPreviewPerTab.jsm
+++ b/application/palemoon/modules/WindowsPreviewPerTab.jsm
@@ -595,6 +595,7 @@ TabWindow.prototype = {
"file", "chrome", "resource", "about"
]),
onLinkIconAvailable: function (aBrowser, aIconURL) {
+ let self = this;
let requestURL = null;
if (aIconURL) {
let shouldRequestFaviconURL = true;
@@ -611,15 +612,15 @@ TabWindow.prototype = {
let isDefaultFavicon = !requestURL;
getFaviconAsImage(
requestURL,
- PrivateBrowsingUtils.isWindowPrivate(this.win),
+ PrivateBrowsingUtils.isWindowPrivate(self.win),
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.
// The tab could have closed, and there's no guarantee the icons
// will have finished fetching 'in order'.
if (index != -1) {
- let tab = this.tabbrowser.tabs[index];
- let preview = this.previews.get(tab);
+ let tab = self.tabbrowser.tabs[index];
+ let preview = self.previews.get(tab);
if (tab.getAttribute("image") == aIconURL ||
(!preview.icon && isDefaultFavicon)) {
preview.icon = img;