[Pkg-mozext-commits] [adblock-plus] 21/98: Issue 4227 - Add some checks to consider edge conditions when element hiding stylesheet is applied
David Prévot
taffit at moszumanska.debian.org
Tue Oct 24 01:30:14 UTC 2017
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 5214496e74f9065d8446cb8165f9a5485e0fb4e6
Author: Wladimir Palant <trev at adblockplus.org>
Date: Wed Jul 6 15:47:30 2016 +0200
Issue 4227 - Add some checks to consider edge conditions when element hiding stylesheet is applied
---
lib/child/elemHide.js | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/lib/child/elemHide.js b/lib/child/elemHide.js
index 036f4d8..e1d1fec 100644
--- a/lib/child/elemHide.js
+++ b/lib/child/elemHide.js
@@ -333,6 +333,12 @@ let observer = {
filterType
}) =>
{
+ if (Cu.isDeadWrapper(subject))
+ {
+ // We are too late, the window is gone already.
+ return;
+ }
+
if (enabled)
{
if (!this.sheet)
@@ -343,7 +349,18 @@ let observer = {
let utils = subject.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
- utils.addSheet(this.sheet, Ci.nsIStyleSheetService.USER_SHEET);
+ try
+ {
+ utils.addSheet(this.sheet, Ci.nsIStyleSheetService.USER_SHEET);
+ }
+ catch (e)
+ {
+ // Ignore NS_ERROR_ILLEGAL_VALUE - it will be thrown if we try to add
+ // the stylesheet multiple times to the same document (the observer
+ // will be notified twice for some documents).
+ if (e.result != Cr.NS_ERROR_ILLEGAL_VALUE)
+ throw e;
+ }
}
else if (filter)
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list