Commit graph

70 commits

Author SHA1 Message Date
scottlynotlie
6dd16cb775 Bug 1676736 - Use Assert.rejects to test exceptions in Remote browser chrome test r=jdescottes,webdriver-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D180723
2023-08-03 09:32:41 +00:00
Julian Descottes
6be485cf4e Bug 1841010 - [remote] Expose a NavigationManager instance on the RootMessageHandler r=webdriver-reviewers,jgraham
Depends on D180440

Differential Revision: https://phabricator.services.mozilla.com/D183768
2023-07-20 11:33:18 +00:00
Mark Banner
130a655906 Bug 1826062 - Automatic fixes for upgrading Prettier to 2.8.8. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,calu
Differential Revision: https://phabricator.services.mozilla.com/D177027
2023-05-20 12:26:53 +00:00
Mark Banner
8219a5c503 Bug 1826062 - Automatic fixes for Prettier 2.0.5 upgrade. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,owlish
Differential Revision: https://phabricator.services.mozilla.com/D177025
2023-05-20 12:26:49 +00:00
Julian Descottes
e1574164ba Bug 1831411 - [remote] Commands send to root modules from windowglobal should run in the parent r=webdriver-reviewers,Sasha
Depends on D177181

Quick summary:

Handling a command is mostly done in 2 steps
- first check if there is a module in the current layer which matches the command
- if yes: send the command to this module, if no: try to forward the command (using forwardCommand which has different implementations for each message handler)

The initial patch to allow windowglobal -> root communication was flawed, because it updated the ModuleCache to return "root" modules when the destination was of type ROOT. However that's not how MessageHandler modules are supposed to work. The ModuleCache should only ever return modules which can be loaded in the current "layer". So if we are in a windowglobal ModuleCache, we should never return a "root" module.

Instead the ModuleCache should return (and store) `null` for this load attempt, so that the MessageHandler can go to the `forwardCommand` step.
So here I slightly changed the ModuleCache implementation to have a single `#getModuleClass` private helper, which can quickly check if we are in a "not root" -> "root" scenario and just return null early.

Follow up: I think some of the logic currently kept in the module cache should move to the MessageHandler, and the ModuleCache should only care about caching module classes/instances. All the destination-to-folder logic is really tied to handling commands, so that should be done by the base MessageHandler class. Or at least it should be closer to the `handleCommand` implementation.

Differential Revision: https://phabricator.services.mozilla.com/D177202
2023-05-05 13:38:21 +00:00
Julian Descottes
69e1106abb Bug 1831373 - [remote] Remove all logic from ModuleRegistry classes r=webdriver-reviewers,whimboo
Depends on D177180

Differential Revision: https://phabricator.services.mozilla.com/D177181
2023-05-05 13:38:21 +00:00
Julian Descottes
ebaa1d12fb Bug 1831373 - [remote] Use a regular ModuleRegistry for MessageHandler browser mochitests r=webdriver-reviewers,whimboo
Depends on D177179

Differential Revision: https://phabricator.services.mozilla.com/D177180
2023-05-05 13:38:20 +00:00
Julian Descottes
fea56ca2b2 Bug 1830404 - [remote] Support sending message handler commands from windowglobal to root r=webdriver-reviewers,whimboo
Depends on D176713

Differential Revision: https://phabricator.services.mozilla.com/D176714
2023-05-02 20:11:50 +00:00
Julian Descottes
9fa2ad7bd9 Bug 1830404 - [remote] Rename transport helpers referring to frame r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D176713
2023-05-02 20:11:50 +00:00
Julian Descottes
c0f871815e Bug 1826366 - [remote] Manual fixes for valid-jsdoc in remote r=webdriver-reviewers,whimboo
Depends on D174738

Differential Revision: https://phabricator.services.mozilla.com/D174739
2023-04-05 16:25:48 +00:00
Julian Descottes
7ccbffb9f7 Bug 1826366 - [remote] Apply lint --fix for valid-jsdoc in remote r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D174738
2023-04-05 16:25:47 +00:00
Julian Descottes
0232a50aa5 Bug 1823670 - [messagehandler] Destroy MessageHandlers when pages move to BFCache r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D173132
2023-03-22 13:18:22 +00:00
Frazier Odhiambo
9ac5475c8f Bug 1816664 Rename addSessionData/removeSessionData methods of RootMessageHandler to addSessionDataItem/removeSessionDataItem r=webdriver-reviewers,Sasha
Differential Revision: https://phabricator.services.mozilla.com/D172513
2023-03-21 07:57:31 +00:00
Frazier Odhiambo
cad57921d1 Bug 1810101 - [remote] Use add_task() instead of add_test() for xpcshell tests. r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D170809
2023-02-28 07:32:29 +00:00
Alexandra Borovova
231b3e98e0 Bug 1810687 - [messagehandler] Group SessionData initial updates by moduleName and category. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D169312
2023-02-10 08:12:07 +00:00
Mark Banner
8b2a7a80c7 Bug 1812977 - Remove now unnecessary import-globals-from statements in other directories. r=Gijs,webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D168074
2023-01-30 19:33:39 +00:00
Julian Descottes
987247c956 Bug 1806820 - [remote] Refactor session data broadcast test r=webdriver-reviewers,Sasha,whimboo
The current test had complicated logic in the test module "command.sys.mjs" which means we were asserting the test module more than the actual behavior of MessageHandler/SessionData.

Instead, we use a simpler test module, and precisely assert all the updates we receive for session data updates. Also taking the opportunity to add some tests when updating session data items from several categories.

Differential Revision: https://phabricator.services.mozilla.com/D166969
2023-01-20 11:09:08 +00:00
Gijs Kruitbosch
8be066753c Bug 1810995 - update BrowserTestUtils.loadURI consumers to use loadURIString (automated) - other directories - r=Standard8,webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D167154
2023-01-19 20:16:43 +00:00
Alexandra Borovova
7b40f31aa5 Bug 1741834 - [messagehandler] Support transactions when using sessionData. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D163957
2022-12-21 13:31:36 +00:00
Mark Banner
9189ff3f6f Bug 1798018 - Convert consumers of toolkit/modules/tests to import ES modules direct. r=Gijs,webdriver-reviewers,extension-reviewers,settings-reviewers,credential-management-reviewers,sgalich
Differential Revision: https://phabricator.services.mozilla.com/D160664
2022-11-01 13:26:38 +00:00
Julian Descottes
d1f7dbe55e Bug 1790468 - [remote] Convert /remote/shared JSM modules to ESM r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D158293
2022-09-30 11:08:06 +00:00
Julian Descottes
84dec7594d Bug 1763137 - [messagehandler] Filter events based on context descriptor used to subscribe to them r=webdriver-reviewers,whimboo
Depends on D155070

Differential Revision: https://phabricator.services.mozilla.com/D155243
2022-09-02 12:04:15 +00:00
Julian Descottes
d4bc15c1be Bug 1786255 - [messagehandler] Apply session data to Root layer modules r=webdriver-reviewers,whimboo
Depends on D155059

In order for all events to really use similar codepaths, they should not use different subscription mechanism.

Setting an event in SessionData should be the entry point for all modules to decide to update their listeners or not.
Therefore we will also call _applySessionData on root modules which support this.

Next patch will start using this for the browsingContext.contextCreated event.

Differential Revision: https://phabricator.services.mozilla.com/D155060
2022-08-30 11:53:47 +00:00
Julian Descottes
c2b9c6fa6a Bug 1786255 - [messagehandler] RootMessageHandler _applySessionData should return the session data update r=webdriver-reviewers,whimboo
The current version returns the return value of the command (which can be a broadcast, depending on the provided descriptor).
This makes it impossible to know what to consistently expect as a return value.

It seems it was only used for a test assertion, so rewrite the test and cleanup the return value

Differential Revision: https://phabricator.services.mozilla.com/D155059
2022-08-30 11:53:47 +00:00
Julian Descottes
7d8eb136be Bug 1783177 - [messagehandler] Merge internal and protocol events r=webdriver-reviewers,whimboo
We no longer distinguish between internal and protocol events within the framework.
All events now have the same behavior:
- emitted both under their own name and under the name message-handler-event
- bubble up to the root message handler
- the session which owns the RootMessageHandler does not listen for those events

The emitProtocolEvent has been moved to the RootMessageHandler only and can be used to emit events under a specific name "message-handler-protocol-event".
Only those events will be sent over to the actual client.

Internally the session module now keeps track of which events have already been subscribed to, to avoid forwarding duplicated events.
In a followup this will be centralized over in the EventsDispatcher, which can now play a bigger role.

Note that in the same way as for commands, there is still an implicit notion of "internal event", as in "an event which can not be subscribed to by consumers".
For commands this is done by having a "_" before the command name.
For events this is done by listing or not the event in the "supportedEvents" static array of the Module.

Differential Revision: https://phabricator.services.mozilla.com/D155025
2022-08-26 14:21:28 +00:00
Alexandra Borovova
147e207e97 Bug 1775463 - Allow windowglobal-in-root modules to intercept events from their corresponding windowglobal module. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D150107
2022-07-04 06:01:59 +00:00
Julian Descottes
9b0cc99afd Bug 1764314 - [remote] Allow MessageHandler commands to be retried upon AbortError r=webdriver-reviewers,whimboo
Depends on D147713

This adds a "retryOnAbort" property on MessageHandler Commands.
When set to true, this will allow the FrameTransport to retry a command up to 10 times in case of an AbortError.
Difference with Marionette, this doesn't attempt to detect BrowsingContexts in bfcache, because retrying commands
does not make sense in bfcache (this is not a temporary state, retrying in a loop will most likely not help).

A browser mochitest is added to cover various retry scenarios.

Differential Revision: https://phabricator.services.mozilla.com/D147715
2022-06-02 18:42:04 +00:00
Gabriele Svelto
fd3fc54c5d Bug 1771875 - Add BrowserTestUtils.reloadTab() and use it everywhere r=mconley,webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D147732
2022-06-01 09:34:05 +00:00
Alexandra Borovova
e97bcb6bf6 Bug 1760900 - Ensure a correct error message when trying to call an unknown internal command. r=jdescottes,webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D144021
2022-04-21 11:49:29 +00:00
Julian Descottes
07b6609d7d Bug 1730642 - [webdriver-bidi] Implement a basic browsingContext.navigate command r=webdriver-reviewers,whimboo
Depends on D142514

Differential Revision: https://phabricator.services.mozilla.com/D141583
2022-04-07 13:27:25 +00:00
Julian Descottes
e3c22ecafc Bug 1730642 - [remote] Extract internal event logic to a dedicated class r=webdriver-reviewers,whimboo
Depends on D142513

Differential Revision: https://phabricator.services.mozilla.com/D142514
2022-04-07 13:27:25 +00:00
Julian Descottes
3982c53c50 Bug 1730642 - [remote] Emit internal MessageHandler events with their original name r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D142513
2022-04-07 13:27:24 +00:00
Henrik Skupin
3362fd3db8 Bug 1758572 - [webdriver-bidi] Use "Module" suffix for all internal WebDriver BiDi module class names. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D140722
2022-03-10 14:13:23 +00:00
Julian Descottes
53cfc89b09 Bug 1756809 - [remote] Add basic navigation helper to RootMessageHandler r=webdriver-reviewers,whimboo
Depends on D138900

Differential Revision: https://phabricator.services.mozilla.com/D138958
2022-03-04 18:54:19 +00:00
Julian Descottes
3e305ab637 Bug 1756809 - [remote] Emit DOMContentLoaded as an internal event from WindowGlobalMessageHandler r=webdriver-reviewers,whimboo
Depends on D140343

Differential Revision: https://phabricator.services.mozilla.com/D138900
2022-03-04 18:54:19 +00:00
Julian Descottes
c539f17573 Bug 1758124 - [remote] Rename CONTEXT_DESCRIPTOR_TYPES to follow enum guidelines r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D140343
2022-03-04 15:59:22 +00:00
Mark Banner
ce31f4c0a4 Bug 1756563 - Define the WebExtension browser in-line for messagehandler head files. r=jdescottes,webdriver-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D139815
2022-02-28 13:07:35 +00:00
Julian Descottes
1aac6c54cd Bug 1753939 - [remote] Filter out webextensions in FrameContextUtils::isBrowsingContextCompatible r=rpl,webdriver-reviewers,whimboo
Depends on D138523

Given our current broadcast logic, we should not stumble on webextension contexts during broadcast.
This is because getAllBrowsingContextsInSubtree will not cross process boundaries.

Nevertheless, adding explicit support for WebExtensions in our filter method should be ok, with the added test.
Whenever we lift the JSWindowActor restrictions and rely on isBrowsingContextCompatible for filtering this will help avoid regressions.

Differential Revision: https://phabricator.services.mozilla.com/D138531
2022-02-14 23:07:45 +00:00
Julian Descottes
a881d0f446 Bug 1753939 - [remote] Do not create message handlers for webextension contexts r=webdriver-reviewers,rpl,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D138523
2022-02-14 23:07:45 +00:00
Julian Descottes
0c179363d6 Bug 1747107 - [remote] Replace FrameContextUtils::getOsPid with isParentProcess r=webdriver-reviewers,jgraham,whimboo. CLOSED TREE
Differential Revision: https://phabricator.services.mozilla.com/D134663
2022-02-01 14:35:25 +00:00
Butkovits Atila
c4f5279fc3 Backed out changeset 083b25b3bb4a (bug 1747107) for causing assertion failures at nsHttpChannel.cpp. CLOSED TREE 2022-02-01 21:16:16 +02:00
Julian Descottes
30b25ec353 Bug 1747107 - [remote] Replace FrameContextUtils::getOsPid with isParentProcess r=webdriver-reviewers,jgraham,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D134663
2022-02-01 14:35:25 +00:00
Henrik Skupin
23875862ae Bug 1749675 - [remote] Don't apply session data for modules that don't exist for a given destination. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D134266
2022-01-20 07:28:38 +00:00
Julian Descottes
892ae10673 Bug 1747222 - [remote] Move browsing context APIs from browser.js and WindowManager to TabManager r=webdriver-reviewers,whimboo
Depends on D135414

Differential Revision: https://phabricator.services.mozilla.com/D135415
2022-01-14 21:19:53 +00:00
Julian Descottes
7d8052e4a0 Bug 1747222 - [remote] Migrate TOP BROWSING CONTEXT to use custom UUID instead of browserId r=webdriver-reviewers,whimboo
We are not supporting the TOP_BROWSING_CONTEXT yet in BiDi, but message handler already supports it, and assumes browser ids. But as discussed we will need to use custom UUIDs, and on the side have a mapping between browser ids and UUIDs, as browserids might be available late.

Differential Revision: https://phabricator.services.mozilla.com/D135414
2022-01-14 21:19:53 +00:00
Henrik Skupin
beb1f69ae7 Bug 1749507 - [remote] Emit internal event when window global message handler has been initialized. r=webdriver-reviewers,jdescottes
Before an instance of a WindowGlobalMessageHandler is ready to be used the
initial session data needs to be applied. Because this happens asynchronously
an internal "window-global-handler-created" event will be used for which the
root message handler or any other module can listen for.

Differential Revision: https://phabricator.services.mozilla.com/D134265
2022-01-13 09:46:33 +00:00
Henrik Skupin
d85900994d Bug 1749507 - [remote] Add support for internal message handler events. r=webdriver-reviewers,jdescottes
There are two kind of events that can be used by module implementations
to pass information within the message handler framework.

First, with internal events the different modules and the message handlers
themselves can send around information eg. informing the parent process
about specific DOM events happening in the child process. These events
are not intended to be sent to external clients.

Second, with protocol events the different modules can send events with
a payload as specified in the appropriate protocol. These events shouldn't
be intercepted, modified, or ignored and will be sent to external clients.

Differential Revision: https://phabricator.services.mozilla.com/D134264
2022-01-13 09:46:32 +00:00
Julian Descottes
78e5eb0c46 Bug 1742491 - [remote] Filter out parent process frames in MessageHandlerFrameChild r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D131897
2021-12-17 09:48:50 +00:00
Julian Descottes
3893d96e96 Bug 1694145 - [remote] Add removeSessionData API to RootMessageHandler r=webdriver-reviewers,whimboo
Depends on D132150

Adds a new API to RootMessageHandler which will be necessary to implement _unsubscribeEvent on root/log.jsm
Expand the current browser mochitest for session data to cover the new API.

Differential Revision: https://phabricator.services.mozilla.com/D132152
2021-12-02 19:21:44 +00:00
Julian Descottes
216a21b4b6 Bug 1743083 - [remote] Instantiate MessageHandler modules after constructor has returned r=webdriver-reviewers,whimboo
Depends on D132064

Differential Revision: https://phabricator.services.mozilla.com/D132229
2021-11-26 13:42:43 +00:00