2 <title>popup helper
</title>
5 const search
= decodeURIComponent(window
.location
.search
.replace("?", ""));
6 const steps
= search
.split("|");
8 async
function proceedTest() {
10 const step
= steps
.shift();
12 if (step
.startsWith("report=")) {
13 const id
= step
.split("=")[1];
14 const stashURL
= new URL("window-name-stash.py", location
);
15 stashURL
.searchParams
.set('id', id
);
16 stashURL
.searchParams
.set('value', window
.name
);
18 await
fetch(stashURL
, { method
: "POST" });
22 if (step
=== "close") {
27 if (step
=== "cross") {
28 const url
= new URL(window
.location
);
29 url
.host
= "{{hosts[alt][]}}:{{ports[https][0]}}";
30 url
.search
= "?" + steps
.join("|");
31 window
.location
= url
.href
;
35 if (step
=== "same") {
36 const url
= new URL(window
.location
);
37 url
.host
= "{{host}}:{{ports[https][0]}}";
38 url
.search
= "?" + steps
.join("|");
39 window
.location
= url
.href
;
44 const url
= new URL(window
.location
);
45 url
.host
= "{{hosts[][www]}}:{{ports[https][0]}}";
46 url
.search
= "?" + steps
.join("|");
47 window
.location
= url
.href
;
51 if (step
=== "closeOpener") {
53 window
.opener
.close();
58 if (step
.startsWith("navOpener=")) {
63 let url
= step
.split("=")[1];
64 window
.opener
.location
.href
= url
;
69 if (step
=== "open") {
70 const url
= new URL(window
.location
);
71 url
.host
= "{{host}}:{{ports[https][0]}}";
72 url
.search
= "?" + steps
.join("|");
77 if (step
.startsWith("reportOpener=")) {
78 const id
= step
.split("=")[1];
79 const stashURL
= new URL("window-name-stash.py", location
);
80 stashURL
.searchParams
.set('id', id
);
81 stashURL
.searchParams
.set('value', window
.opener
.name
);
83 await
fetch(stashURL
, { method
: "POST" });
87 if (step
.startsWith("set=")) {
88 window
.name
= step
.split("=")[1];
92 if (step
.startsWith("setDomain=")) {
93 document
.domain
= step
.split("=")[1];
97 throw new Error("Unsupported step!");