[Pkg-mozext-commits] [nosquint] 08/13: Fix failed styling when DOM frame removed

David Prévot taffit at moszumanska.debian.org
Tue Apr 28 01:41:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag 2.1.7
in repository nosquint.

commit 529a7ae3ff49c9f6a3f9f4882dcc4ff46ee907fb
Author: Jason Tackaberry <tack at urandom.ca>
Date:   Sun Mar 31 19:54:26 2013 -0400

    Fix failed styling when DOM frame removed
    
    We handle DOMFrameContentLoaded and add stylers to new document
    objects as they appear.  If the DOM frame is removed, subsequent
    restyling will throw a "can't access dead object" exception.
    
    If a styler raises an error on a restyle, it is removed from the
    list of stylers.
---
 src/content/browser.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/content/browser.js b/src/content/browser.js
index b253971..e148539 100644
--- a/src/content/browser.js
+++ b/src/content/browser.js
@@ -561,8 +561,18 @@ NoSquint.browser = NoSquint.ns(function() { with (NoSquint) {
             stylers.push(this.getDocumentStyler(browser, doc));
 
         debug("style(): num stylers=" + stylers.length);
-        for (let styler in iter(stylers))
-            styler(style);
+        for (let i = stylers.length - 1; i >= 0; i--) {
+            // A styler may raise if it applies to a dead object (which
+            // happens if e.g. a DOM frame is dynamically removed).  If it
+            // fails, remove it from the list of active stylers for this
+            // browser.
+            try {
+                stylers[i](style);
+            } catch (e) {
+                debug("Failed to apply style: " + e);
+                stylers.splice(i, 1);
+            }
+        }
 
         if (browser == gBrowser.selectedBrowser)
             this.queueUpdateStatus();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/nosquint.git



More information about the Pkg-mozext-commits mailing list