Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException when registering ServiceWorker in Safari on MacOS X #1015

Open
ingosch opened this issue Sep 7, 2021 · 0 comments
Open

Comments

@ingosch
Copy link

ingosch commented Sep 7, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant