[Pkg-mozext-commits] [firebug] 60/68: Issue 6464: Only allow a subset of CSS with %c

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 22:45:55 UTC 2014


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

taffit pushed a commit to tag fbtest-1.11.4
in repository firebug.

commit d2b869fbc30b6fee01231a0673f9b7ff998f4a77
Author: Simon Lindholm <simon.lindholm10 at gmail.com>
Date:   Tue May 21 23:13:07 2013 +0200

    Issue 6464: Only allow a subset of CSS with %c
    
    http://code.google.com/p/fbug/issues/detail?id=6464
---
 extension/content/firebug/console/consolePanel.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/extension/content/firebug/console/consolePanel.js b/extension/content/firebug/console/consolePanel.js
index 1fb3aef..cc003c1 100644
--- a/extension/content/firebug/console/consolePanel.js
+++ b/extension/content/firebug/console/consolePanel.js
@@ -25,6 +25,7 @@ function(Obj, Firebug, FirebugReps, Locale, Events, Css, Dom, Search, Menu, Opti
 var versionChecker = Xpcom.CCSV("@mozilla.org/xpcom/version-comparator;1", "nsIVersionComparator");
 var appInfo = Xpcom.CCSV("@mozilla.org/xre/app-info;1", "nsIXULAppInfo");
 var firefox15AndHigher = versionChecker.compare(appInfo.version, "15") >= 0;
+var reAllowedCss = /^(-moz-)?(background|border|color|font|line|margin|padding|text)/;
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
@@ -536,6 +537,19 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
             nodeSpan.appendChild(node);
         }
 
+        function addStyle(node, css)
+        {
+            var dummyEl = node.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml", "div");
+            dummyEl.setAttribute("style", css);
+            node.setAttribute("style", "");
+            for (var i = 0; i < dummyEl.style.length; i++)
+            {
+                var prop = dummyEl.style[i];
+                if (reAllowedCss.test(prop))
+                    node.style.setProperty(prop, dummyEl.style.getPropertyValue(prop));
+            }
+        }
+
         if (!objects || !objects.length)
         {
             // Make sure the log-row has proper height (even if empty).
@@ -611,7 +625,7 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
 
             // Apply custom style if available.
             if (lastStyle && node)
-                node.setAttribute("style", lastStyle);
+                addStyle(node, lastStyle);
 
             node = null;
         }

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



More information about the Pkg-mozext-commits mailing list