From 0e078e536d8630e0823a488c6d1cdb222b0b01bb Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 11 Aug 2017 14:26:15 -0400 Subject: [PATCH] eliminate validation warning on AMO: avoid innerHTML --- platform/chromium/vapi-common.js | 6 ----- platform/firefox/vapi-common.js | 24 ----------------- src/cloud-ui.html | 20 ++++++++++++++ src/document-blocked.html | 1 + src/js/cloud-ui.js | 46 +++++++++++++++++--------------- 5 files changed, 45 insertions(+), 52 deletions(-) create mode 100644 src/cloud-ui.html diff --git a/platform/chromium/vapi-common.js b/platform/chromium/vapi-common.js index 28419f3ca..f49f5e420 100644 --- a/platform/chromium/vapi-common.js +++ b/platform/chromium/vapi-common.js @@ -67,12 +67,6 @@ vAPI.download = function(details) { /******************************************************************************/ -vAPI.insertHTML = function(node, html) { - node.innerHTML = html; -}; - -/******************************************************************************/ - vAPI.getURL = chrome.runtime.getURL; /******************************************************************************/ diff --git a/platform/firefox/vapi-common.js b/platform/firefox/vapi-common.js index 1ee769987..d5b0abae3 100644 --- a/platform/firefox/vapi-common.js +++ b/platform/firefox/vapi-common.js @@ -75,30 +75,6 @@ vAPI.download = function(details) { /******************************************************************************/ -vAPI.insertHTML = (function() { - const parser = Components.classes['@mozilla.org/parserutils;1'] - .getService(Components.interfaces.nsIParserUtils); - - // https://github.com/gorhill/uBlock/issues/845 - // Apparently dashboard pages execute with `about:blank` principal. - - return function(node, html) { - while ( node.firstChild ) { - node.removeChild(node.firstChild); - } - - node.appendChild(parser.parseFragment( - html, - parser.SanitizerAllowStyle, - false, - Services.io.newURI('about:blank', null, null), - document.documentElement - )); - }; -})(); - -/******************************************************************************/ - vAPI.getURL = function(path) { return 'chrome://' + location.host + '/content/' + path.replace(/^\/+/, ''); }; diff --git a/src/cloud-ui.html b/src/cloud-ui.html new file mode 100644 index 000000000..0d11edeab --- /dev/null +++ b/src/cloud-ui.html @@ -0,0 +1,20 @@ + + + + + + + + + +  + + +
+
+

+

+

+
+ + diff --git a/src/document-blocked.html b/src/document-blocked.html index ca24ee7b1..40c03aa3b 100644 --- a/src/document-blocked.html +++ b/src/document-blocked.html @@ -1,6 +1,7 @@ +