@@ -77,15 +77,15 @@ describe('executeTool', () => {
7777 } )
7878
7979 it ( 'validates navigation URLs before touching the session' , async ( ) => {
80- const grant = vi . spyOn ( session , 'grantSiteOriginForAgentNavigation ' )
80+ const prepare = vi . spyOn ( session , 'prepareExplicitNavigation ' )
8181 const result = await driver . executeTool ( 'chat-test' , 'browser_navigate' , {
8282 url : 'file:///etc/passwd' ,
8383 } )
8484 expect ( result ) . toEqual ( {
8585 ok : false ,
8686 error : 'URL must be absolute and start with http:// or https://' ,
8787 } )
88- expect ( grant ) . not . toHaveBeenCalled ( )
88+ expect ( prepare ) . not . toHaveBeenCalled ( )
8989 } )
9090
9191 it ( 'reports missing required parameters by name' , async ( ) => {
@@ -94,8 +94,7 @@ describe('executeTool', () => {
9494 expect ( result . error ) . toMatch ( / M i s s i n g r e q u i r e d p a r a m e t e r " u r l " / )
9595 } )
9696
97- it ( 'grants only SSRF-checked agent navigation destinations before loading them' , async ( ) => {
98- const grant = vi . spyOn ( session , 'grantSiteOriginForAgentNavigation' )
97+ it ( 'loads SSRF-checked agent navigation destinations' , async ( ) => {
9998 const navigations = [
10099 [ 'browser_navigate' , 'http://127.0.0.1:4011/navigate' ] ,
101100 [ 'browser_open_url' , 'http://127.0.0.1:4012/open' ] ,
@@ -106,9 +105,9 @@ describe('executeTool', () => {
106105 await expect ( driver . executeTool ( 'chat-test' , tool , { url } ) ) . resolves . toMatchObject ( {
107106 ok : true ,
108107 } )
109- expect ( grant ) . toHaveBeenCalledWith ( expect . anything ( ) , url )
108+ const contents = session . requireAutomationTab ( ) . view . webContents
109+ expect ( contents . loadURL ) . toHaveBeenCalledWith ( url )
110110 }
111- expect ( grant ) . toHaveBeenCalledTimes ( navigations . length )
112111 } )
113112
114113 it ( 'keeps the 400ms hydration grace without rediscovering a completed load' , async ( ) => {
@@ -1140,8 +1139,8 @@ describe('executeTool', () => {
11401139 expect ( respond ) . toHaveBeenCalledWith ( 'request-1' , true )
11411140 } )
11421141
1143- it ( 'routes an exact renderer site decision through the scoped session boundary ' , async ( ) => {
1144- const respond = vi . spyOn ( session , 'respondToSitePermission' ) . mockReturnValue ( true )
1142+ it ( 'ignores retired site decisions without changing tab ownership ' , async ( ) => {
1143+ const claim = vi . spyOn ( session , 'claimActiveTabForUser' )
11451144
11461145 await driver . handlePanelAction ( 'chat-test' , {
11471146 action : 'respond-site-permission' ,
@@ -1153,22 +1152,18 @@ describe('executeTool', () => {
11531152 requestId : 'request-2' ,
11541153 } )
11551154
1156- expect ( respond ) . toHaveBeenCalledOnce ( )
1157- expect ( respond ) . toHaveBeenCalledWith ( 'request-1' , true )
1155+ expect ( claim ) . not . toHaveBeenCalled ( )
11581156 } )
11591157
1160- it ( 'grants only the exact origin entered through the user omnibox' , async ( ) => {
1158+ it ( 'loads the exact URL entered through the user omnibox' , async ( ) => {
11611159 await driver . executeTool ( 'chat-test' , 'browser_open_tab' , { } )
11621160 const contents = session . requireTab ( ) . view . webContents
1163- const grant = vi . spyOn ( session , 'grantSiteOriginForUserNavigation' )
11641161
11651162 await driver . handlePanelAction ( 'chat-test' , {
11661163 action : 'navigate' ,
11671164 url : 'https://docs.example/private?token=secret' ,
11681165 } )
11691166
1170- expect ( grant ) . toHaveBeenCalledOnce ( )
1171- expect ( grant ) . toHaveBeenCalledWith ( contents , 'https://docs.example/private?token=secret' )
11721167 expect ( contents . loadURL ) . toHaveBeenCalledWith ( 'https://docs.example/private?token=secret' )
11731168 } )
11741169
0 commit comments