You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/03/12 21:56:05 UTC

[GitHub] [cordova-android] josiahbryan opened a new issue #688: Web Worker in cordova

josiahbryan opened a new issue #688: Web Worker in cordova
URL: https://github.com/apache/cordova-android/issues/688
 
 
   # Bug Report
   
   ## Problem
   
   I can't seem to get my cordova app to execute even a simple web worker, even though the same web worker works in the Chrome browser on the same device. 
   
   (Android device, Google Pixel 3, running Android 9, latest patch level. The app was built in PhoneGap build with `cli-8.0.0`)
   
   Setup in the main thread:
   ```
   const worker = new Worker('/fake.worker.js');
   worker.postMessage(1337);
   worker.addEventListener('message', event => console.log("[myWorker] received event from myWorker:", event));
   ```
   
   And the `/fake.worker.js` file is just this, no transpilation:
   ```
   /* eslint-disable no-restricted-globals */
   console.log("fake.worker booted");
   self.addEventListener("message", startCounter);
   
   function startCounter(event) {
       console.log(event.data, self)
   	let initial = event.data;
   	console.log("fake.worker counter started:", initial);
   	
       setInterval(() => this.postMessage(initial++), 1000);
   }
   ```
   
   Bottom line, the console never shows anything from the worker, either from the main thread or from the worker thread's `console.log` statements. 
   
   While attached to the device and remote debugging, I can see that `('Worker' in window) === true` and that the Network tab of the remote console that the `fake.worker.js` file is indeed loaded. (Serving the file via `ngrok` from my development laptop - after connecting to the remote console, I changed the location of the web view with `window.location.href = 'https://....ngrok...'`.) 
   
   ### What is expected to happen?
   
   Web Worker should boot and at minimum, console should show: `fake.worker booted`
   
   ### What does actually happen?
   
   Nothing, no errors, nothing. Valid Worker object is created, but no events and no console output happens.
   
   ## Information
   
   * N/A
   
   ### Command or Code
   
   * Code above
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   
   * Android 9.0, latest patch (March 5)
   * PhoneGap `cli-8.0.0`
   * Built with PhoneGap build
   
   ### Version information
   
   * PhoneGap `cli-8.0.0` (android ver 7.0.0)
   * Android 9.0
   * No plugins relevant
   
   ## Checklist
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version **NB cannot use >`cli-8.0.0` due to plugin compat**
   - [x] I included all the necessary information above
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org