fixed self defense code no to hook URLs opened by the client
This commit is contained in:
parent
b0406bdf7d
commit
eddde27c20
88573
javascript/classes.js
88573
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
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
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user