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
Service Worker overwriting window object causes crash #2538
Comments
|
Hello,
I'm afraid we cannot say anything regarding this solution until we reproduce the issue ourselves. Could you please share a simple project (or a public URL)? We'll examine it and check for a suitable solution. If your project is private, you can use our mailbox (support@devexpress.com). However, since your website sits behind a proxy and requires authentication, we will not be able to access it. Our policy prevents us from accessing a customer’s internal resources without a prior written approval from the entity that owns the server/web resource. If you want us to research the problem further, we’ll need access to the server/web resource. Please ask the website owner to send us (support@devexpress.com) a written confirmation. It must permit DevExpress personnel to remotely access the website and its internal resources for research/testing/and debugging purposes. |
|
@Farfurix : Uploaded a reproducible to https://lemokla.de/service_worker_hammerhead/index.html
Possible Code solution is maintained in the first post (using instanceof, instead of just checking the window object), Code: app.js sw.js worker.js |
|
@timostark |
|
It fixed partially in #2533 |






Hi All,
First i am very sorry, for the bad bug report. The scenario is happening specifically with SAP Analytics Cloud (Major Analytics solution by SAP). Everything here is of course properitary. I hope the technical details and possible solution are good enough to understand the issue.
Generally: Cloud Analytics is heavily relying on service workers. This seems to cause issues.
Summary
Crash during startup, in case a service worker is (partly) filling the window object.
Technical Reason for crash
Native Methods nodeFirstChildGetter is undefined when using XHR requests in service-worker.

As a service worker does not have a window.Node/HTMLElement object, the resolve method shouldn't be called after all. The code for this logic is already available - The problem seems to be that the caller (resolve) is not detecting that it is inside a worker thread (see following screenshot).

The reason for this, is that the window object was partly overwritten (with DedicatedWorkerGlobalScope - so the actual "self" object). If I open the application directly, it shows the same behavior inside the worker thread. Therefore the window object is overwritten / defined by the service worker.

Now I am really not sure about the service worker specification. Is a service worker allowed to overwrite any window method? Adjusting the code to:


solves the issue and the application simply starts up..
Alternative (yes the ts-ignore is ofc bullshit):
What do you think? Is that a valid solution (maybe including Node and other window objects you are accessing..)
Thanks for any feedback,
Timo
The text was updated successfully, but these errors were encountered: