File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,26 @@ export class Browser extends StatefulClass {
6969 frame . frame . addEventListener ( "load" , ( e ) => {
7070 tab . url = frame . client . url . href ;
7171 } ) ;
72+ let browser = this ;
73+
7274 frame . addEventListener ( "contextInit" , ( ctx ) => {
75+ ctx . client . Proxy ( "window.open" , {
76+ apply ( pctx ) {
77+ let tab = browser . newTab ( "_blank" ) ;
78+ tab . frame . go ( pctx . args [ 0 ] ) ;
79+
80+ // this is a bit jank: we need the global proxy NOW, but it will only load naturally after a few seconds
81+ const realContentWindow = tab . frame . frame . contentWindow ;
82+ // :(
83+ const ctor : any = ctx . client . constructor ;
84+ // see open.ts
85+ const newclient = new ctor ( realContentWindow ) ;
86+ newclient . hook ( ) ;
87+
88+ pctx . return ( newclient . globalProxy ) ;
89+ } ,
90+ } ) ;
91+
7392 const framedoc = ctx . window . document ;
7493
7594 framedoc . addEventListener ( "contextmenu" , ( e ) => {
You can’t perform that action at this time.
0 commit comments