[Pkg-mozext-commits] [adblock-plus] 09/28: Issue 1273 - Worked around WebKit getter misoptimization on Safari 8

David Prévot taffit at moszumanska.debian.org
Wed Nov 12 02:09:49 UTC 2014


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

taffit pushed a commit to branch master
in repository adblock-plus.

commit 75b6dbf0d9af0cf6ba41d58dfd22bd48132bb458
Author: Sebastian Noack <sebastian at adblockplug.org>
Date:   Wed Aug 27 15:53:12 2014 +0200

    Issue 1273 - Worked around WebKit getter misoptimization on Safari 8
---
 lib/elemHide.js      |  8 +-------
 lib/filterClasses.js | 12 ++++++++++++
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/lib/elemHide.js b/lib/elemHide.js
index cc3bcf4..c844284 100644
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -401,13 +401,7 @@ let ElemHide = exports.ElemHide =
     for (let key in filterByKey)
     {
       let filter = filterByKey[key];
-
-      // it is important to always access filter.domains
-      // here, even if it isn't used, in order to
-      // workaround WebKit bug 132872, also see #419
-      let domains = filter.domains;
-
-      if (specificOnly && (!domains || domains[""]))
+      if (specificOnly && (!filter.domains || filter.domains[""]))
         continue;
 
       if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain))
diff --git a/lib/filterClasses.js b/lib/filterClasses.js
index 2df8781..c120938 100644
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -324,6 +324,12 @@ ActiveFilter.prototype =
    */
   get domains()
   {
+    // Despite this property being cached, the getter is called
+    // several times on Safari, due to WebKit bug 132872
+    let prop = Object.getOwnPropertyDescriptor(this, "domains");
+    if (prop)
+      return prop.value;
+
     let domains = null;
 
     if (this.domainSource)
@@ -514,6 +520,12 @@ RegExpFilter.prototype =
    */
   get regexp()
   {
+    // Despite this property being cached, the getter is called
+    // several times on Safari, due to WebKit bug 132872
+    let prop = Object.getOwnPropertyDescriptor(this, "regexp");
+    if (prop)
+      return prop.value;
+
     // Remove multiple wildcards
     let source = this.regexpSource
       .replace(/\*+/g, "*")        // remove multiple wildcards

-- 
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