From e437d80133c96096460bf9418f17f25a65a2db46 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 25 Jul 2018 12:34:50 +0200 Subject: Use try/catch in PageThumbs writeData to deal with null data from caller. Quick fix for #670 --- toolkit/components/thumbnails/PageThumbs.jsm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'toolkit/components/thumbnails/PageThumbs.jsm') diff --git a/toolkit/components/thumbnails/PageThumbs.jsm b/toolkit/components/thumbnails/PageThumbs.jsm index 9bd3ae4b3..b0affee92 100644 --- a/toolkit/components/thumbnails/PageThumbs.jsm +++ b/toolkit/components/thumbnails/PageThumbs.jsm @@ -609,7 +609,15 @@ this.PageThumbsStorage = { writeData: function Storage_writeData(aURL, aData, aNoOverwrite) { let path = this.getFilePathForURL(aURL); this.ensurePath(); - aData = new Uint8Array(aData); + + // XXX: We try/catch here since 'null' isn't accepted until we implement + // ES2017's new Uint8Array(); allowance. + try { + aData = new Uint8Array(aData); + } catch(e) { + aData = new Uint8Array(0); + } + let msg = [ path, aData, -- cgit v1.2.3 From 19b35e92511718fb5cfe653df535e072c7ccd748 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 25 Jul 2018 13:45:48 +0200 Subject: Use a fixed thumbnail placeholder for blank thumbs (failed to capture). --- toolkit/components/thumbnails/PageThumbs.jsm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'toolkit/components/thumbnails/PageThumbs.jsm') diff --git a/toolkit/components/thumbnails/PageThumbs.jsm b/toolkit/components/thumbnails/PageThumbs.jsm index b0affee92..4b343c605 100644 --- a/toolkit/components/thumbnails/PageThumbs.jsm +++ b/toolkit/components/thumbnails/PageThumbs.jsm @@ -28,6 +28,9 @@ const MAX_THUMBNAIL_AGE_SECS = 172800; // 2 days == 60*60*24*2 == 172800 secs. */ const THUMBNAIL_DIRECTORY = "thumbnails"; +// contains base64 version of a placeholder thumbnail +#include "blankthumb.inc" + Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); Cu.import("resource://gre/modules/PromiseWorker.jsm", this); Cu.import("resource://gre/modules/Promise.jsm", this); -- cgit v1.2.3 From 9fc1381e11a0a6adcd3be93b1d0524fd5336282b Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 26 Jul 2018 21:45:34 +0200 Subject: Fix #include and potentially undefined Capture.options object. --- toolkit/components/thumbnails/PageThumbs.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolkit/components/thumbnails/PageThumbs.jsm') diff --git a/toolkit/components/thumbnails/PageThumbs.jsm b/toolkit/components/thumbnails/PageThumbs.jsm index 4b343c605..5c7754b31 100644 --- a/toolkit/components/thumbnails/PageThumbs.jsm +++ b/toolkit/components/thumbnails/PageThumbs.jsm @@ -29,7 +29,7 @@ const MAX_THUMBNAIL_AGE_SECS = 172800; // 2 days == 60*60*24*2 == 172800 secs. const THUMBNAIL_DIRECTORY = "thumbnails"; // contains base64 version of a placeholder thumbnail -#include "blankthumb.inc" +#include blankthumb.inc Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); Cu.import("resource://gre/modules/PromiseWorker.jsm", this); -- cgit v1.2.3