You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by hi...@apache.org on 2025/04/19 11:50:02 UTC

(royale-asjs) branch examples/TDJ_localresources updated: Fix error incorrect type event in FileReference.mxml Some browsers, like Chrome, have tightened their security policies. We make sure to simulate opening the record selector by clicking on the active element.

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

hiedra pushed a commit to branch examples/TDJ_localresources
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/examples/TDJ_localresources by this push:
     new 9222282204 Fix error incorrect type event in FileReference.mxml Some browsers, like Chrome, have tightened their security policies. We make sure to simulate opening the record selector by clicking on the active element.
9222282204 is described below

commit 9222282204ba1a4f9a396ed45a675d79b31cb83b
Author: mjesteve <mj...@iest.com>
AuthorDate: Sat Apr 19 13:50:39 2025 +0200

    Fix error incorrect type event in FileReference.mxml
    Some browsers, like Chrome, have tightened their security policies. We make sure to simulate opening the record selector by clicking on the active element.
---
 .../FileReference/src/main/royale/FileReference.mxml       |  2 +-
 .../royale/org/apache/royale/file/beads/FileBrowser.as     | 14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/examples/mxroyale/FileReference/src/main/royale/FileReference.mxml b/examples/mxroyale/FileReference/src/main/royale/FileReference.mxml
index b3efb50790..ec43cb37f0 100644
--- a/examples/mxroyale/FileReference/src/main/royale/FileReference.mxml
+++ b/examples/mxroyale/FileReference/src/main/royale/FileReference.mxml
@@ -32,7 +32,7 @@ limitations under the License.
 		private var uploadURL:URLRequest;
 		private var file:FileReference;
 
-		private function clickHandler(event:MouseEvent):void
+		private function clickHandler(event:Event):void
 		{
 		    uploadURL = new URLRequest();
 		    uploadURL.url = "http://www.[yourDomain].com/yourUploadHandlerScript.cfm";
diff --git a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileBrowser.as b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileBrowser.as
index 01347aa7fa..a966dfbb00 100644
--- a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileBrowser.as
+++ b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileBrowser.as
@@ -81,7 +81,7 @@ package org.apache.royale.file.beads
 			delegate = document.createElement('input') as WrappedHTMLElement;
 			delegate.setAttribute('type', 'file');
 			goog.events.listen(delegate, 'change', fileChangeHandler);
-			}
+		}
 		
 		/**
 		 *  @private
@@ -135,10 +135,18 @@ package org.apache.royale.file.beads
 				window.addEventListener("keydown", keyHandler);
 				window.addEventListener("mousemove", mouseHandler);
 				window.addEventListener("mousedown", mouseHandler);
-				delegate.click();
+				focusedButton.addEventListener("click", clickHandler);	
+				focusedButton.click();
+				focusedButton.removeEventListener("click", clickHandler);	
 			}
 		}
 		
+		COMPILE::JS
+		private function clickHandler(e:Object):void
+		{
+			delegate.click();
+		}
+		
 		COMPILE::JS
 		private function blurHandler(e:Object):void
 		{
@@ -147,7 +155,7 @@ package org.apache.royale.file.beads
 			cleanupWindow();
 		}
 
-		public static const CANCEL_TIMEOUT:Number = 150;
+		public static const CANCEL_TIMEOUT:Number = 250;
 		
 		COMPILE::JS
 		private function focusHandler(e:Object):void