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

[GH-788] Made the check to determine whether the current web-worker is owned by PapaParse more reliable #937

Merged
merged 3 commits into from
Jun 14, 2022

Conversation

flakey-bit
Copy link
Contributor

This fixes #788

Previously, the assumption was if we're in a web-worker AND the worker was loaded from a blob, the worker must be ours.

@pokoli
Copy link
Collaborator

pokoli commented Jun 8, 2022

Hi @flakey-bit,

Thanks for working on this. I see there is an issue on your patch that match our test suite broken.
Could you have a look in order to fix it? TIA

@flakey-bit flakey-bit force-pushed the feature/GH-788-web-worker-ownership branch 2 times, most recently from ab87cf1 to f2fe81f Compare June 9, 2022 00:05
@flakey-bit
Copy link
Contributor Author

flakey-bit commented Jun 9, 2022

Hi @flakey-bit,

Thanks for working on this. I see there is an issue on your patch that match our test suite broken. Could you have a look in order to fix it? TIA

@pokoli

Can you link me to the test-suite build failure? never mind, I found it.

NB: I found there was an issue with my implementation so I've had another go at fixing it 🤞 - I've force-pushed to my branch, which should have updated the PR. See latest build queued here.

@flakey-bit
Copy link
Contributor Author

@pokoli

I've added a test case to cover this scenario. Please take a look

@pokoli
Copy link
Collaborator

pokoli commented Jun 10, 2022

Hi @flakey-bit,

Test failed on node12 which is unsuported by now.
I removed the support of node 12 on master branch, could you please rebase it?
If test passes I will merge it.

@flakey-bit flakey-bit force-pushed the feature/GH-788-web-worker-ownership branch from 57dbf5c to 76ac689 Compare June 10, 2022 10:27
@flakey-bit
Copy link
Contributor Author

@pokoli rebase is done

@pokoli
Copy link
Collaborator

pokoli commented Jun 10, 2022

@flakey-bit Tests are still broken, could you please have a look?

You can run them locally with: npm test

@flakey-bit
Copy link
Contributor Author

flakey-bit commented Jun 10, 2022 via email

flakey-bit and others added 3 commits June 11, 2022 19:07
…ker is owned by PapaParse more reliable - this fixes mholt#788

Previously, the assumption was if we're in a web-worker AND the worker was loaded from a blob, the worker *must* be ours.
…d (this fails prior to f2fe81f)

Added inside a new describe block for browser-specific tests (looks for existence of `window`). This test is browser-specific due to the way the script is being loaded into a web-worker using importScripts()
@flakey-bit flakey-bit force-pushed the feature/GH-788-web-worker-ownership branch from 76ac689 to 085778e Compare June 11, 2022 07:11
@flakey-bit
Copy link
Contributor Author

@pokoli have force-pushed again.

npm test is clean now (as is running npm run test-node and npm run test-mocha-headless-chrome separately.

Note I've included an additional to commit to allow the tests to use latest ECMAScript syntax (does not affect the targeting of the main library).

@flakey-bit
Copy link
Contributor Author

flakey-bit commented Jun 11, 2022

@Silic0nS0ldier can you also take a look at this? The approach will likely have implications for the move to ES6 modules (#875)

In particular, see the test case that this PR adds.

@pokoli
Copy link
Collaborator

pokoli commented Jun 13, 2022

@flakey-bit why is required to add the latest ECMAScript syntax? Does the test work without that?

@flakey-bit
Copy link
Contributor Author

@pokoli the test is currently written using async keyword, arrow functions, template strings etc.

Could rewrite the test not to use such features, but would probably make it harder to understand.

@Silic0nS0ldier
Copy link

@flakey-bit I've lost quite a bit of context since opening #875, but I don't see any reason for this to cause problems for ES6.

Not sure how relevant it will be here, but I did some work to solve the same problem with NodeJS worker threads some time ago. https://github.com/developit/web-worker/blob/9ee077b6c5df0acaf5d83d89e2087bd3a3b82b97/src/node.js#L138-L142

@pokoli pokoli merged commit 0772457 into mholt:master Jun 14, 2022
@flakey-bit flakey-bit deleted the feature/GH-788-web-worker-ownership branch June 14, 2022 07:51
@flakey-bit
Copy link
Contributor Author

@pokoli any chance of getting a new release out to NPM?

@pokoli
Copy link
Collaborator

pokoli commented Jun 16, 2022

@flakey-bit I will prefer to wait a little if there is something else to be included on the release.

@flakey-bit
Copy link
Contributor Author

@pokoli it would be awesome to get a release out if it's not too much trouble

I know it's a bit selfish of me, but part of the reason I picked up #788 was to allow us to integrate PapaParse into our application without resorting to patch-package 🙂

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

Successfully merging this pull request may close these issues.

Calling Papa.parse in worker with _config.worker = false calls postMessage
3 participants