Skip to content

Commit

Permalink
jso apis: make global objects available in WebWorker contexts (no har…
Browse files Browse the repository at this point in the history
…dcoded window)
  • Loading branch information
tryone144 committed Jan 24, 2024
1 parent 9280992 commit 5ea0862
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions jso/apis/src/main/java/org/teavm/jso/browser/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ public final void postMessage(JSObject message, JSObject... transfer) {
@JSProperty
public abstract double getDevicePixelRatio();

@JSBody(params = "s", script = "return window.atob(s);")
@JSBody(params = "s", script = "return atob(s);")
public static native String atob(String s);

@JSBody(params = "s", script = "return window.btoa(s);")
@JSBody(params = "s", script = "return btoa(s);")
public static native String btoa(String s);
}
4 changes: 2 additions & 2 deletions jso/apis/src/main/java/org/teavm/jso/crypto/Crypto.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import org.teavm.jso.typedarrays.Uint8ClampedArray;

public abstract class Crypto implements JSObject {
@JSBody(script = "return window.crypto != null;")
@JSBody(script = "return crypto != null;")
public static native boolean isSupported();

@JSBody(script = "return window.crypto;")
@JSBody(script = "return crypto;")
public static native Crypto current();

public abstract String randomUUID();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public static IDBFactory getInstance() {
return factory;
}

@JSBody(script = "return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || "
+ "window.msIndexedDB;")
@JSBody(script = "return indexedDB || mozIndexedDB || webkitIndexedDB || msIndexedDB;")
static native IDBFactory getInstanceImpl();

public abstract IDBOpenDBRequest open(String name, int version);
Expand Down

0 comments on commit 5ea0862

Please sign in to comment.