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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker: reorganize components and refactor error handling #863

Merged
merged 6 commits into from Jul 10, 2019

Conversation

Projects
None yet
3 participants
@sohkai
Copy link
Member

commented Jul 8, 2019

Puts all of the WebWorker related components into worker/.

  • a8549e3: Just reorganizes the files
  • 9303050: Use an options object for the removeWorker() API (I think it's a bit more clear)
  • 13dc449: Reset the subscription pool when cancelling the aragon.js instance
  • e001f11: Refactor and improve error handling
  • fb51dd6: Some more comments 馃槃

sohkai added some commits Jul 8, 2019

@sohkai sohkai requested review from bpierre and AquiGorka Jul 8, 2019

})

// Reset pool
this.workers.clear()

This comment has been minimized.

Copy link
@sohkai

sohkai Jul 8, 2019

Author Member

Note that this is not strictly necessary based on our usage (we create a new instance on initialization), but it does feel safer :)

'error',
error => {
console.error('Error from worker for ${name} (loaded from ${scriptUrl}):', error.message, error)
window.parent.postMessage(

This comment has been minimized.

Copy link
@sohkai

sohkai Jul 8, 2019

Author Member

The big change here was to avoid passing the error through postMessage. Errors can't be copied through the Structured Cloning algorithm

false
)
window.addEventListener('message', ({ data, source }) => {
if (source === window.parent) {

This comment has been minimized.

Copy link
@sohkai

sohkai Jul 8, 2019

Author Member

This is also important; we need to check the source of the message, otherwise it could be another window sending information to this iframe.

@bpierre
Copy link
Member

left a comment

馃毧 馃毧 馃毧

Show resolved Hide resolved src/worker/WorkerSubscriptionPool.js Outdated
@AquiGorka
Copy link
Member

left a comment

馃殌 馃帀
When testing the original iframe worker I tested only on my dev setup, only to realise later on that an error was happening with the built code - just fyi.

@sohkai

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2019

Tested it with the production build locally and nothing seems out of the ordinary :).

@sohkai sohkai merged commit d714d11 into master Jul 10, 2019

8 checks passed

License Compliance All checks passed.
Details
WIP Ready for review
Details
build build
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
install install
Details
license/cla Contributor License Agreement is signed.
Details
lint lint
Details

@sohkai sohkai deleted the worker-reorganize branch Jul 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.