[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 389/483: Topic 9391 - Content Security Policy can prevent preview from working (should inject <style> into the document, not <link>)

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:59 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 bf3bd78e906b25408b4b95a61b5cbc22767438cb
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Tue Jan 24 08:09:53 2012 +0100

    Topic 9391 - Content Security Policy can prevent preview from working (should inject <style> into the document, not <link>)
---
 chrome/content/composer.js | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/chrome/content/composer.js b/chrome/content/composer.js
index 566830f..3c038d5 100644
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -11,7 +11,7 @@ let nodeData;
 let selectedNode = null;
 let advancedMode = false;
 let treeView = null;
-let stylesheetURL;
+let stylesheetData;
 let previewStyle = null;
 let doc;
 
@@ -356,7 +356,7 @@ function updateExpression()
       curData = null;
   }
 
-  stylesheetURL = "data:text/css;charset=utf-8," + encodeURIComponent(expression + "{display: none !important;}");
+  stylesheetData = expression + "{display: none !important;}";
   expression = domainData.selected + "##" + expression;
 
   document.getElementById("expression").value = expression;
@@ -366,7 +366,7 @@ function updateExpression()
     tree.treeBoxObject.invalidateRow(tree.view.selection.currentIndex);
 
   if (previewStyle)
-    previewStyle.setAttribute("href", stylesheetURL);
+    previewStyle.textContent = stylesheetData;
 }
 
 function escapeChar(dummy, match)
@@ -536,12 +536,11 @@ function fillAttributes(nodeData) {
 function togglePreview(preview) {
   if (preview) {
     if (!previewStyle || !previewStyle.parentNode) {
-      previewStyle = doc.createElementNS("http://www.w3.org/1999/xhtml", "link");
-      previewStyle.setAttribute("rel", "stylesheet");
+      previewStyle = doc.createElementNS("http://www.w3.org/1999/xhtml", "style");
       previewStyle.setAttribute("type", "text/css");
       doc.documentElement.appendChild(previewStyle);
     }
-    previewStyle.setAttribute("href", stylesheetURL);
+    previewStyle.textContent = stylesheetData;
   }
   else {
     if (previewStyle && previewStyle.parentNode)

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