Giter Site home page Giter Site logo

Comments (5)

fregante avatar fregante commented on August 22, 2024

Currently the application has to be careful not to import the messenger receiver until the rest of the setup has occurred.

That will be fixed for #74, which will make the messenger ignore communication until the first registerMethods call. The messenger will be “ready” when we call registerMethods, which we do once per context.

Having a secondary setMessengerReady() function means we still need to make sure to not add further registerMethods calls after that, so it has a similar risk. Given that we only have one messenger/methods.ts file per context, it’s not a problem at the moment.

from webext-messenger.

twschiller avatar twschiller commented on August 22, 2024

That will be fixed for #74, which will make the messenger ignore communication until the first registerMethods call.

IIRC, registerMethods is called by the initInternalApi. So this is implying that the initInternalApi call won't call registerMethods anymore?

Having a secondary setMessengerReady() function means we still need to make sure to not add further registerMethods calls after that, so it has a similar risk. Given that we only have one messenger/methods.ts file per context, it’s not a problem at the moment.

I'm OK to proceed either way. In both cases, I think the would be a warning to designate mis-use

  • Warn if registerMethods is called multiple times
  • Warn if registerMethods is called after setMessengerReady (if we choose to add that method)

What's an ETA on a fix? I'm planning the PixieBrix 1.7.5 release schedule

from webext-messenger.

fregante avatar fregante commented on August 22, 2024

Since you merged pixiebrix/pixiebrix-extension#4061, this is no longer a blocking issue. I will likely finish it tomorrow. Parcel (tests) are giving me grief so I had to take a break.

from webext-messenger.

twschiller avatar twschiller commented on August 22, 2024

this is no longer a blocking issue

It solves the case where it fails 100% of the time, but doesn't completely solve the problem (one user had actually been seeing the bug, or a related bug, reliably pre-1.7.4).

We've already deployed workarounds for our enterprise customers, so will look to get the real fix into the 1.7.5 release

from webext-messenger.

fregante avatar fregante commented on August 22, 2024

But I think this wouldn't fix what you're describing. We already have exactly one registerMethod call per context, which currently happens before any init function except for the content script (and that has been fixed by your recent PR).

Even if the private call happens long before registerMessenger, it still happens in the same tick, there is no chance that a message is received between a webext-messenger import and registerMessenger call currently. That's why this change is only to future-proof it rather than fixing current bugs.

from webext-messenger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.