[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 15/483: Fix escaping of { and }

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:22 UTC 2015


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

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

commit 67ded0cf53873845999f520813c7d23863171a2f
Author: Wladimir Palant <trev at gtchat.de>
Date:   Tue Jan 9 13:43:06 2007 +0000

    Fix escaping of { and }
    
    --HG--
    extra : convert_revision : svn%3Ad8bf93c1-8190-44a8-bb31-1ea94378a4df/trunk%40612
---
 chrome/content/composer.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/chrome/content/composer.js b/chrome/content/composer.js
index e5078b5..213d996 100644
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -42,11 +42,6 @@ function NodeData(node, parentNode) {
   this.attributes = [];
   for (var i = 0; i < node.attributes.length; i++) {
     var attribute = node.attributes[i];
-
-    // Ignore attribute names containing { or } - limitation of ABP
-    if (/[{}]/.test(attribute.name))
-      continue;
-
     var data = {name: attribute.name, value: attribute.value, selected: attribute.value, checked: false};
     if (data.name == "id" || data.name == "class")
       this.attributes.unshift(data);
@@ -129,7 +124,14 @@ function updateExpression() {
 
         if (expressionSimple != null)
           expressionSimple += "(" + attr.name + op + attr.value + ")";
-        expressionRaw += "[" + attr.name.replace(/([^\w\-])/g, "\\$1") + op + '"' + attr.value.replace(/"/g, '\\"') + '"' + "]";
+
+        var escapedName = attr.name.replace(/([^\w\-])/g, "\\$1")
+                                   .replace(/\\\{/g, "\\7B ")
+                                   .replace(/\\\}/g, "\\7D ");
+        var escapedValue = attr.value.replace(/"/g, '\\"')
+                                     .replace(/\{/, "\\7B ")
+                                     .replace(/\}/, "\\7D ");
+        expressionRaw += "[" + escapedName + op + '"' + escapedValue + '"' + "]";
       }
       else if (attr.checked) {
         expressionSimple = null;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git



More information about the Pkg-mozext-commits mailing list