Open Bug 1752393 Opened 3 years ago Updated 1 year ago

create definitive finished flag for top level synchronous execution in background script

Categories

(WebExtensions :: General, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: mixedpuppy, Unassigned)

References

Details

(Whiteboard: [addons-jira])

For persistent listeners, we need to be assured of the time that top level execution is completed prior to any potential asynchronous execution. We currently use context.listenerPromises set as null for that flag. However, there is a potential race between the finish of execution and the notification that the background has started. It would be better to have a specific flag.

notes:

it would be better to detect in the child process if the addListener should be persisted or not, where we can verify that without potential races:
    in this particular case, a races may be due to things happening in separate processes and messages sent over different IPC channels without any guarantees that the order of the messages received in the parent process will always be the same order they were sent from the child process, as an example "Extension:ExtensionViewLoaded" is sent over the messagemanager channels while addListener goes through the JSWindowActor/JSProcessActor messaging channels)

the addListener requests sent to the parent process will then include an explicit property to signal if the event is supposed to be persisted or not, which will make the check here more explicit than checking !!this.context.listenerPromises (which looks more like a side-effect of the fact that in ext-backgroundPage nullify it once it got the "Extension:ExtensionViewLoaded" message for the background context).
Type: enhancement → task
You need to log in before you can comment on or make changes to this bug.