File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1515 return ;
1616 }
1717
18- const ancestorOrigin = document .location .ancestorOrigins [0 ];
18+ const referrer = document .referrer ; // Available through Wizard. Empty string through Remix.
19+ const ancestorOrigins = document .location .ancestorOrigins ; // undefined on Firefox
20+
21+ const parentUrl = ancestorOrigins ?.[0 ] || referrer ;
1922
2023 if (dev ) {
2124 // add desired behaviour for dev mode.
2225 }
2326
2427 // in case we are developing locally, we want to use the wizard as the parent..
25- if (ancestorOrigin .includes (" wizard" ) || ancestorOrigin .includes (" localhost" )) {
28+ if (parentUrl .includes (" wizard" ) || parentUrl .includes (" localhost" )) {
2629 return parent = ' wizard' ;
2730 }
2831
29- if (ancestorOrigin .includes (" remix.ethereum" )) {
32+ // Remix on Firefox leads to empty parentUrl due to ancestorOrigins and referrer being unavailable.
33+ if (parentUrl .includes (" remix.ethereum" ) || ! parentUrl ) {
3034 return parent = ' remix' ;
3135 }
3236
You can’t perform that action at this time.
0 commit comments