fixed self defense code no to hook URLs opened by the client

This commit is contained in:
LAX1DUDE 2022-07-22 19:08:27 -07:00
parent b0406bdf7d
commit eddde27c20
9 changed files with 66065 additions and 66051 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1927,7 +1927,7 @@ public class EaglerAdapterImpl2 {
}
}
public static final void openLink(String url) {
win.open(url, "_blank");
SelfDefence.openWindowIgnore(url, "_blank");
}
public static final void redirectTo(String url) {
Window.current().getLocation().setFullURL(url);

View File

@ -18,6 +18,7 @@ import org.teavm.jso.dom.xml.NodeList;
public class SelfDefence {
private static HTMLCanvasElement canvas = null;
private static boolean ignoreNextWindow = false;
@JSFunctor
private static interface NewWindowCallback extends JSObject {
@ -48,11 +49,19 @@ public class SelfDefence {
injectWindowCapture(new NewWindowCallback() {
@Override
public void call(Window newWindow) {
capturedChildWindows.add(newWindow);
if(!ignoreNextWindow) {
capturedChildWindows.add(newWindow);
}
ignoreNextWindow = false;
}
});
}
public static void openWindowIgnore(String url, String name) {
ignoreNextWindow = true;
Window.current().open(url, name);
}
private static void run(Window win) {
try {
run0(win);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long