File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -447,6 +447,9 @@ class App extends PDFObject {
447
447
cMsg = cMsg . cMsg ;
448
448
}
449
449
cMsg = ( cMsg || "" ) . toString ( ) ;
450
+ if ( ! cMsg ) {
451
+ return 0 ;
452
+ }
450
453
nType =
451
454
typeof nType !== "number" || isNaN ( nType ) || nType < 0 || nType > 3
452
455
? 0
Original file line number Diff line number Diff line change @@ -607,6 +607,52 @@ describe("Scripting", function () {
607
607
value = await myeval ( `app.platform = "hello"` ) ;
608
608
expect ( value ) . toEqual ( "app.platform is read-only" ) ;
609
609
} ) ;
610
+
611
+ it ( "shouldn't display an alert" , async ( ) => {
612
+ const refId = getId ( ) ;
613
+ const data = {
614
+ objects : {
615
+ field : [
616
+ {
617
+ id : refId ,
618
+ value : "" ,
619
+ actions : {
620
+ Validate : [ `app.alert(event.value);` ] ,
621
+ } ,
622
+ type : "text" ,
623
+ name : "MyField" ,
624
+ } ,
625
+ ] ,
626
+ } ,
627
+ appInfo : { language : "en-US" , platform : "Linux x86_64" } ,
628
+ calculationOrder : [ ] ,
629
+ dispatchEventName : "_dispatchMe" ,
630
+ } ;
631
+
632
+ sandbox . createSandbox ( data ) ;
633
+ await sandbox . dispatchEventInSandbox ( {
634
+ id : refId ,
635
+ value : "hello" ,
636
+ name : "Keystroke" ,
637
+ willCommit : true ,
638
+ } ) ;
639
+ expect ( send_queue . has ( "alert" ) ) . toEqual ( true ) ;
640
+ expect ( send_queue . get ( "alert" ) ) . toEqual ( {
641
+ command : "alert" ,
642
+ value : "hello" ,
643
+ } ) ;
644
+ send_queue . delete ( refId ) ;
645
+ send_queue . delete ( "alert" ) ;
646
+
647
+ await sandbox . dispatchEventInSandbox ( {
648
+ id : refId ,
649
+ value : "" ,
650
+ name : "Keystroke" ,
651
+ willCommit : true ,
652
+ } ) ;
653
+ expect ( send_queue . has ( "alert" ) ) . toEqual ( false ) ;
654
+ send_queue . delete ( refId ) ;
655
+ } ) ;
610
656
} ) ;
611
657
612
658
describe ( "AForm" , function ( ) {
You can’t perform that action at this time.
0 commit comments