You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2021/12/26 10:10:16 UTC

[royale-asjs] branch feature/sanitize updated: Added classes but doesn't work when minified

This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch feature/sanitize
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/feature/sanitize by this push:
     new 37b973d  Added classes but doesn't work when minified
37b973d is described below

commit 37b973d1439a57c173a249db622201415808a698
Author: Harbs <ha...@in-tools.com>
AuthorDate: Sun Dec 26 12:09:57 2021 +0200

    Added classes but doesn't work when minified
---
 frameworks/downloads.xml                             |  6 +++++-
 .../{sanitizeHtml.as => InternalHtmlSanitizer.as}    | 13 ++++++-------
 .../string/{sanitizeHtml.as => InternalSafeHtml.as}  | 14 ++++++--------
 .../string/{sanitizeUrl.as => InternalSafeUrl.as}    | 20 ++++++++++++--------
 .../org/apache/royale/utils/string/sanitizeHtml.as   |  6 +-----
 .../org/apache/royale/utils/string/sanitizeUrl.as    |  6 +-----
 6 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/frameworks/downloads.xml b/frameworks/downloads.xml
index d364edb..780f297 100644
--- a/frameworks/downloads.xml
+++ b/frameworks/downloads.xml
@@ -299,7 +299,7 @@
                 <exclude name="closure/goog/asserts/asserts.js"/>
                 <exclude name="closure/goog/base.js"/>
                 <exclude name="closure/goog/deps.js"/>
-                <exclude name="closure/goog/debug/debug.js"/>
+                <exclude name="closure/goog/debug/**"/>
                 <exclude name="closure/goog/debug/entrypointregistry.js"/>
                 <exclude name="closure/goog/debug/error.js"/>
                 <exclude name="closure/goog/debug/errorcontext.js"/>
@@ -329,6 +329,10 @@
                 <!-- need dependencies for sanitizing html -->
                 <exclude name="closure/goog/html/**"/>
                 <exclude name="closure/goog/dom/**"/>
+                <exclude name="closure/goog/functions/**"/>
+                <exclude name="closure/goog/math/**"/>
+                <exclude name="closure/goog/useragent/**"/>
+                <exclude name="closure/goog/log/**"/>
                 <exclude name="closure/goog/i18n/bidi.js"/>
                 <exclude name="closure/goog/string/typedstring.js"/>
                 <exclude name="closure/goog/string/const.js"/>
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/InternalHtmlSanitizer.as
similarity index 83%
copy from frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as
copy to frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/InternalHtmlSanitizer.as
index 360ef63..7ae05fe 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/InternalHtmlSanitizer.as
@@ -22,17 +22,16 @@ package org.apache.royale.utils.string
 		import goog.html.sanitizer.HtmlSanitizer;
 		import goog.html.SafeHtml;
 	}
-
-	public function sanitizeHtml(html:String):String
+	COMPILE::JS
+	internal class InternalHtmlSanitizer extends HtmlSanitizer
 	{
-		COMPILE::JS
+		public function InternalHtmlSanitizer()
 		{
-			return SafeHtml.unwrap(HtmlSanitizer.sanitize(html));
+			super();
 		}
-		//TODO sanitize in swf
-		COMPILE::SWF
+		public static function sanitize(html:String):SafeHtml
 		{
-			return html;
+			return HtmlSanitizer.sanitize(html);
 		}
 	}
 }
\ No newline at end of file
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/InternalSafeHtml.as
similarity index 82%
copy from frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as
copy to frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/InternalSafeHtml.as
index 360ef63..3864ab9 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/InternalSafeHtml.as
@@ -19,20 +19,18 @@
 package org.apache.royale.utils.string
 {
 	COMPILE::JS{
-		import goog.html.sanitizer.HtmlSanitizer;
 		import goog.html.SafeHtml;
 	}
-
-	public function sanitizeHtml(html:String):String
+	COMPILE::JS
+	internal class InternalSafeHtml extends goog.html.SafeHtml
 	{
-		COMPILE::JS
+		public function InternalSafeHtml()
 		{
-			return SafeHtml.unwrap(HtmlSanitizer.sanitize(html));
+			
 		}
-		//TODO sanitize in swf
-		COMPILE::SWF
+		public static function unwrap(safeHtml:SafeHtml):String
 		{
-			return html;
+			return SafeHtml.unwrap(safeHtml);
 		}
 	}
 }
\ No newline at end of file
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeUrl.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/InternalSafeUrl.as
similarity index 75%
copy from frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeUrl.as
copy to frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/InternalSafeUrl.as
index cd4151d..1b5c16b 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeUrl.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/InternalSafeUrl.as
@@ -20,17 +20,21 @@ package org.apache.royale.utils.string
 {
 	COMPILE::JS{
 		import goog.html.SafeUrl;
-		import goog.html.SafeUrl;
 	}
-	public function sanitizeUrl(url:String):String
+	COMPILE::JS
+	internal class InternalSafeUrl extends goog.html.SafeUrl
 	{
-		COMPILE::JS{
-			return SafeUrl.unwrap(SafeUrl.sanitize(url));
+		public function InternalSafeUrl(value:String, token:Object)
+		{	
+			super(value, token);
+		}
+		public static function unwrap(safeURL:SafeUrl):String
+		{
+			return SafeUrl.unwrap(safeURL);
 		}
-
-		//TODO sanitize in swf
-		COMPILE::SWF{
-			return url;
+		public static function sanitize(url:String):SafeUrl
+		{
+			return SafeUrl.sanitize(url);
 		}
 	}
 }
\ No newline at end of file
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as
index 360ef63..9756c48 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeHtml.as
@@ -18,16 +18,12 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.utils.string
 {
-	COMPILE::JS{
-		import goog.html.sanitizer.HtmlSanitizer;
-		import goog.html.SafeHtml;
-	}
 
 	public function sanitizeHtml(html:String):String
 	{
 		COMPILE::JS
 		{
-			return SafeHtml.unwrap(HtmlSanitizer.sanitize(html));
+			return InternalSafeHtml.unwrap(InternalHtmlSanitizer.sanitize(html));
 		}
 		//TODO sanitize in swf
 		COMPILE::SWF
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeUrl.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeUrl.as
index cd4151d..6c91548 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeUrl.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/sanitizeUrl.as
@@ -18,14 +18,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.utils.string
 {
-	COMPILE::JS{
-		import goog.html.SafeUrl;
-		import goog.html.SafeUrl;
-	}
 	public function sanitizeUrl(url:String):String
 	{
 		COMPILE::JS{
-			return SafeUrl.unwrap(SafeUrl.sanitize(url));
+			return InternalSafeUrl.unwrap(InternalSafeUrl.sanitize(url));
 		}
 
 		//TODO sanitize in swf