ClassCastException when registering ServiceWorker in Safari on MacOS X
ingosch opened this issue · 0 comments
ingosch commented
registration = (ServiceWorkerRegistration) object;
in setupRegistration method of ServiceWorkerManager throws a ClassCastException when using Safari on MacOS X.
I think this might be an internal problem with Safari and GWT.
Made a workaround using a native method casting the object.
public native ServiceWorkerRegistration castRegistration(JavaScriptObject o) /*-{
return o;
}-*/;
protected void setupRegistration() {
if (isServiceWorkerSupported()) {
Navigator.serviceWorker.register(getResource()).then(object -> {
logger.info("Service worker has been successfully registered");
registration = castRegistration((JavaScriptObject) object);
This works on all systems and browsers I've tested so far.