@@ -896,6 +896,7 @@ describeWithEnvironment('FreestylerPanel', () => {
896896 const menuItem = findMenuItemWithLabel ( contextMenu . defaultSection ( ) , 'No past conversations' ) ;
897897 assert ( menuItem ) ;
898898 } ) ;
899+
899900 describe ( 'cross-origin' , ( ) => {
900901 it ( 'blocks input on cross origin requests' , async ( ) => {
901902 const networkRequest = sinon . createStubInstance ( SDK . NetworkRequest . NetworkRequest , {
@@ -934,6 +935,76 @@ describeWithEnvironment('FreestylerPanel', () => {
934935 blockedByCrossOrigin : true ,
935936 } ) ) ;
936937 } ) ;
938+
939+ it ( 'should be able to continue same-origin requests' , async ( ) => {
940+ const stub = getGetHostConfigStub ( {
941+ devToolsFreestyler : {
942+ enabled : true ,
943+ } ,
944+ } ) ;
945+ panel = new Freestyler . FreestylerPanel ( mockView , {
946+ aidaClient : getTestAidaClient ( ) ,
947+ aidaAvailability : Host . AidaClient . AidaAccessPreconditions . AVAILABLE ,
948+ syncInfo : getTestSyncInfo ( ) ,
949+ } ) ;
950+ UI . Context . Context . instance ( ) . setFlavor (
951+ ElementsPanel . ElementsPanel . ElementsPanel ,
952+ sinon . createStubInstance ( ElementsPanel . ElementsPanel . ElementsPanel ) ) ;
953+
954+ panel . handleAction ( 'freestyler.elements-floating-button' ) ;
955+ mockView . lastCall . args [ 0 ] . onTextSubmit ( 'test' ) ;
956+ await drainMicroTasks ( ) ;
957+
958+ assert . deepEqual ( mockView . lastCall . args [ 0 ] . messages , [
959+ {
960+ entity : Freestyler . ChatMessageEntity . USER ,
961+ text : 'test' ,
962+ } ,
963+ {
964+ answer : 'test' ,
965+ entity : Freestyler . ChatMessageEntity . MODEL ,
966+ rpcId : undefined ,
967+ suggestions : undefined ,
968+ steps : [ ] ,
969+ } ,
970+ ] ) ;
971+
972+ UI . Context . Context . instance ( ) . setFlavor (
973+ ElementsPanel . ElementsPanel . ElementsPanel ,
974+ sinon . createStubInstance ( ElementsPanel . ElementsPanel . ElementsPanel ) ) ;
975+
976+ panel . handleAction ( 'freestyler.elements-floating-button' ) ;
977+ mockView . lastCall . args [ 0 ] . onTextSubmit ( 'test2' ) ;
978+ await drainMicroTasks ( ) ;
979+
980+ assert . strictEqual ( mockView . lastCall . args [ 0 ] . isReadOnly , false ) ;
981+ assert . deepEqual ( mockView . lastCall . args [ 0 ] . messages , [
982+ {
983+ entity : Freestyler . ChatMessageEntity . USER ,
984+ text : 'test' ,
985+ } ,
986+ {
987+ answer : 'test' ,
988+ entity : Freestyler . ChatMessageEntity . MODEL ,
989+ rpcId : undefined ,
990+ suggestions : undefined ,
991+ steps : [ ] ,
992+ } ,
993+ {
994+ entity : Freestyler . ChatMessageEntity . USER ,
995+ text : 'test2' ,
996+ } ,
997+ {
998+ answer : 'test' ,
999+ entity : Freestyler . ChatMessageEntity . MODEL ,
1000+ rpcId : undefined ,
1001+ suggestions : undefined ,
1002+ steps : [ ] ,
1003+ } ,
1004+ ] ) ;
1005+
1006+ stub . restore ( ) ;
1007+ } ) ;
9371008 } ) ;
9381009
9391010 describe ( 'auto agent selection for panels' , ( ) => {
0 commit comments