apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.66k stars 1.54k forks source link

Web Worker breaking change between cordova-android 12 and 13 #1747

Open mzealey opened 4 hours ago

mzealey commented 4 hours ago

I'm not sure if this is a bug report or more of a useful note to help others in the future...

I have an app which is using new Worker('file.worker.js) to load a webworker from the cordova build. This was working just fine in cordova-android 12, and seems to be working fine on some devices with cordova-android 13 (including, frustratingly, SDK 30/34 emulators). However on some end-user devices including my own this resource loading just gets blocked with no explanation. I have <preference name="AndroidInsecureFileModeEnabled" value="true" /> set etc and historically there have been no problems.

I cannot see any way to get this working still using the default file: cordova loading, however in my case the fix seems to be relatively simple - I just had to use the below to move from file: uri access to the inbuilt webserver:

      <content src="https://localhost/index.html" />

This obviously messes with localStorage etc settings that users already did, which is somewhat frustrating, but at least the user interface now works correctly.

I cannot see this documented anywhere; it may well be due to the targetSdk upgrade but it feels to me like a breaking change (as per above, only on some devices), which should be added to the release notes.

mzealey commented 4 hours ago

Actually I'm a little unsure if it's between 12-13 or from an earlier version - based on user reports and rollout %ages it may have been broken earlier than this on some devices.