nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.35k stars 3.88k forks source link

Removing a webview element deletes temporary folder #7517

Open escatg opened 4 years ago

escatg commented 4 years ago

NWJS Version : 0.46.3 Operating System : Windows 10

Expected behavior

After removing a webview element from the DOM, we can create another one, add it to the DOM, and load the same page again into it.

Actual behavior

After the webview element is removed from the DOM and garbage collected, some or all files from the temporary directory (unzip of application files) are deleted. This means assets like css, images are missing and it is not possible to load the same page in a new webview.

We can see that as soon as the chromium process dedicated to the webview stops, the deletion starts. Procmon confirms it is nw.exe that is deleting files.

Could it be a result of that change a83eb54 from #5208 ?

rogerwang commented 4 years ago

Thanks for reporting. Could you please provide a full sample (not code snippets) so I can reproduce?

rogerwang commented 4 years ago

As a workaround, you can redistribute your app in the way that nw.exe resides in the same directory tree of package.json.

escatg commented 4 years ago

app.zip

Here is a minimal sample with which the bug can be reproduced on Windows. It can take several tries, but after the second window containing a webview closes, the temporary nw folder is often emptied.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.