@@ -86,6 +86,12 @@ describe("previewWindowOpenAction", () => {
8686 ) . toBe ( "popup" ) ;
8787 } ) ;
8888
89+ it ( "opens HTTP links in preview tabs" , ( ) => {
90+ for ( const disposition of [ "foreground-tab" , "background-tab" ] as const ) {
91+ expect ( PreviewManager . previewWindowOpenAction ( details ( { disposition } ) ) ) . toBe ( "new-tab" ) ;
92+ }
93+ } ) ;
94+
8995 it ( "keeps a form POST with a body on the in-place path" , ( ) => {
9096 const postBody = { data : [ ] , contentType : "application/x-www-form-urlencoded" } ;
9197 expect (
@@ -106,17 +112,19 @@ describe("previewWindowOpenAction", () => {
106112 } ) ;
107113
108114 it ( "denies local and inline schemes that no page could open in place itself" , ( ) => {
109- // `loadURL` is a browser-initiated load, so `data:` would get past the check that
110- // stops a page from opening it as a top-level document.
111115 for ( const url of [
112- "file:///etc/passwd" ,
113116 "data:text/html,<h1>hi</h1>" ,
117+ "DaTa:text/html,<h1>hi</h1>" ,
118+ "file:///etc/passwd" ,
114119 "javascript:alert(1)" ,
115120 "view-source:https://example.com" ,
116121 "chrome://gpu" ,
122+ "about:srcdoc" ,
123+ "devtools://devtools/bundled/inspector.html" ,
124+ "filesystem:https://example.com/temporary/page.html" ,
117125 "not a url" ,
118126 ] ) {
119- for ( const disposition of [ "new-window" , "foreground-tab" ] as const ) {
127+ for ( const disposition of [ "new-window" , "foreground-tab" , "background-tab" ] as const ) {
120128 expect ( PreviewManager . previewWindowOpenAction ( details ( { url, disposition } ) ) ) . toBe ( "deny" ) ;
121129 }
122130 }
0 commit comments