зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1830404 - [remote] Rename transport helpers referring to frame r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D176713
This commit is contained in:
Родитель
a70ca307a7
Коммит
9fa2ad7bd9
|
@ -50,8 +50,8 @@ remote.jar:
|
|||
content/shared/messagehandler/transports/js-window-actors/MessageHandlerFrameActor.sys.mjs (shared/messagehandler/transports/js-window-actors/MessageHandlerFrameActor.sys.mjs)
|
||||
content/shared/messagehandler/transports/js-window-actors/MessageHandlerFrameChild.sys.mjs (shared/messagehandler/transports/js-window-actors/MessageHandlerFrameChild.sys.mjs)
|
||||
content/shared/messagehandler/transports/js-window-actors/MessageHandlerFrameParent.sys.mjs (shared/messagehandler/transports/js-window-actors/MessageHandlerFrameParent.sys.mjs)
|
||||
content/shared/messagehandler/transports/FrameContextUtils.sys.mjs (shared/messagehandler/transports/FrameContextUtils.sys.mjs)
|
||||
content/shared/messagehandler/transports/FrameTransport.sys.mjs (shared/messagehandler/transports/FrameTransport.sys.mjs)
|
||||
content/shared/messagehandler/transports/BrowsingContextUtils.sys.mjs (shared/messagehandler/transports/BrowsingContextUtils.sys.mjs)
|
||||
content/shared/messagehandler/transports/RootTransport.sys.mjs (shared/messagehandler/transports/RootTransport.sys.mjs)
|
||||
|
||||
# shared modules (WebDriver HTTP / BiDi only)
|
||||
content/shared/webdriver/Actions.sys.mjs (shared/webdriver/Actions.sys.mjs)
|
||||
|
|
|
@ -7,8 +7,8 @@ import { MessageHandler } from "chrome://remote/content/shared/messagehandler/Me
|
|||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
FrameTransport:
|
||||
"chrome://remote/content/shared/messagehandler/transports/FrameTransport.sys.mjs",
|
||||
RootTransport:
|
||||
"chrome://remote/content/shared/messagehandler/transports/RootTransport.sys.mjs",
|
||||
SessionData:
|
||||
"chrome://remote/content/shared/messagehandler/sessiondata/SessionData.sys.mjs",
|
||||
SessionDataMethod:
|
||||
|
@ -23,7 +23,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
* layers (at the moment WindowGlobalMessageHandlers in content processes).
|
||||
*/
|
||||
export class RootMessageHandler extends MessageHandler {
|
||||
#frameTransport;
|
||||
#rootTransport;
|
||||
#sessionData;
|
||||
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ export class RootMessageHandler extends MessageHandler {
|
|||
constructor(sessionId) {
|
||||
super(sessionId, null);
|
||||
|
||||
this.#frameTransport = new lazy.FrameTransport(this);
|
||||
this.#rootTransport = new lazy.RootTransport(this);
|
||||
this.#sessionData = new lazy.SessionData(this);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ export class RootMessageHandler extends MessageHandler {
|
|||
|
||||
/**
|
||||
* Forward the provided command to WINDOW_GLOBAL MessageHandlers via the
|
||||
* FrameTransport.
|
||||
* RootTransport.
|
||||
*
|
||||
* @param {Command} command
|
||||
* The command to forward. See type definition in MessageHandler.js
|
||||
|
@ -116,7 +116,7 @@ export class RootMessageHandler extends MessageHandler {
|
|||
forwardCommand(command) {
|
||||
switch (command.destination.type) {
|
||||
case lazy.WindowGlobalMessageHandler.type:
|
||||
return this.#frameTransport.forwardCommand(command);
|
||||
return this.#rootTransport.forwardCommand(command);
|
||||
default:
|
||||
throw new Error(
|
||||
`Cannot forward command to "${command.destination.type}" from "${this.constructor.type}".`
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
"use strict";
|
||||
|
||||
const { isBrowsingContextCompatible } = ChromeUtils.importESModule(
|
||||
"chrome://remote/content/shared/messagehandler/transports/FrameContextUtils.sys.mjs"
|
||||
"chrome://remote/content/shared/messagehandler/transports/BrowsingContextUtils.sys.mjs"
|
||||
);
|
||||
const TEST_COM_PAGE = "https://example.com/document-builder.sjs?html=com";
|
||||
const TEST_NET_PAGE = "https://example.net/document-builder.sjs?html=net";
|
||||
|
||||
// Test helpers from FrameContextUtils in various processes.
|
||||
// Test helpers from BrowsingContextUtils in various processes.
|
||||
add_task(async function() {
|
||||
const tab1 = BrowserTestUtils.addTab(gBrowser, TEST_COM_PAGE);
|
||||
const contentBrowser1 = tab1.linkedBrowser;
|
||||
|
@ -81,13 +81,16 @@ async function checkBrowsingContextCompatible(browser, browserId, expected) {
|
|||
browser,
|
||||
[browserId, expected],
|
||||
(_browserId, _expected) => {
|
||||
const FrameContextUtils = ChromeUtils.importESModule(
|
||||
"chrome://remote/content/shared/messagehandler/transports/FrameContextUtils.sys.mjs"
|
||||
const BrowsingContextUtils = ChromeUtils.importESModule(
|
||||
"chrome://remote/content/shared/messagehandler/transports/BrowsingContextUtils.sys.mjs"
|
||||
);
|
||||
is(
|
||||
FrameContextUtils.isBrowsingContextCompatible(content.browsingContext, {
|
||||
browserId: _browserId,
|
||||
}),
|
||||
BrowsingContextUtils.isBrowsingContextCompatible(
|
||||
content.browsingContext,
|
||||
{
|
||||
browserId: _browserId,
|
||||
}
|
||||
),
|
||||
_expected
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
ContextDescriptorType:
|
||||
"chrome://remote/content/shared/messagehandler/MessageHandler.sys.mjs",
|
||||
isBrowsingContextCompatible:
|
||||
"chrome://remote/content/shared/messagehandler/transports/FrameContextUtils.sys.mjs",
|
||||
"chrome://remote/content/shared/messagehandler/transports/BrowsingContextUtils.sys.mjs",
|
||||
Log: "chrome://remote/content/shared/Log.sys.mjs",
|
||||
MessageHandlerFrameActor:
|
||||
"chrome://remote/content/shared/messagehandler/transports/js-window-actors/MessageHandlerFrameActor.sys.mjs",
|
||||
|
@ -22,20 +22,20 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () => lazy.Log.get());
|
|||
const MAX_RETRY_ATTEMPTS = 10;
|
||||
|
||||
/**
|
||||
* FrameTransport is intended to be used from a ROOT MessageHandler to communicate
|
||||
* RootTransport is intended to be used from a ROOT MessageHandler to communicate
|
||||
* with WINDOW_GLOBAL MessageHandlers via the MessageHandlerFrame JSWindow
|
||||
* actors.
|
||||
*/
|
||||
export class FrameTransport {
|
||||
export class RootTransport {
|
||||
/**
|
||||
* @param {MessageHandler} messageHandler
|
||||
* The MessageHandler instance which owns this FrameTransport instance.
|
||||
* The MessageHandler instance which owns this RootTransport instance.
|
||||
*/
|
||||
constructor(messageHandler) {
|
||||
this._messageHandler = messageHandler;
|
||||
|
||||
// FrameTransport will rely on the MessageHandlerFrame JSWindow actors.
|
||||
// Make sure they are registered when instanciating a FrameTransport.
|
||||
// RootTransport will rely on the MessageHandlerFrame JSWindow actors.
|
||||
// Make sure they are registered when instanciating a RootTransport.
|
||||
lazy.MessageHandlerFrameActor.register();
|
||||
}
|
||||
|
||||
|
@ -126,14 +126,14 @@ export class FrameTransport {
|
|||
|
||||
if (++attempts > MAX_RETRY_ATTEMPTS) {
|
||||
lazy.logger.trace(
|
||||
`FrameTransport reached the limit of retry attempts (${MAX_RETRY_ATTEMPTS})` +
|
||||
`RootTransport reached the limit of retry attempts (${MAX_RETRY_ATTEMPTS})` +
|
||||
` for command ${name} and browsing context ${webProgress.browsingContext.id}.`
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
|
||||
lazy.logger.trace(
|
||||
`FrameTransport retrying command ${name} for ` +
|
||||
`RootTransport retrying command ${name} for ` +
|
||||
`browsing context ${webProgress.browsingContext.id}, attempt: ${attempts}.`
|
||||
);
|
||||
await new Promise(resolve => Services.tm.dispatchToMainThread(resolve));
|
|
@ -6,7 +6,7 @@ const lazy = {};
|
|||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
isBrowsingContextCompatible:
|
||||
"chrome://remote/content/shared/messagehandler/transports/FrameContextUtils.sys.mjs",
|
||||
"chrome://remote/content/shared/messagehandler/transports/BrowsingContextUtils.sys.mjs",
|
||||
MessageHandlerRegistry:
|
||||
"chrome://remote/content/shared/messagehandler/MessageHandlerRegistry.sys.mjs",
|
||||
WindowGlobalMessageHandler:
|
||||
|
@ -15,7 +15,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
|
||||
/**
|
||||
* Child actor for the MessageHandlerFrame JSWindowActor. The
|
||||
* MessageHandlerFrame actor is used by FrameTransport to communicate between
|
||||
* MessageHandlerFrame actor is used by RootTransport to communicate between
|
||||
* ROOT MessageHandlers and WINDOW_GLOBAL MessageHandlers.
|
||||
*/
|
||||
export class MessageHandlerFrameChild extends JSWindowActorChild {
|
||||
|
|
|
@ -22,7 +22,7 @@ XPCOMUtils.defineLazyGetter(lazy, "WebDriverError", () => {
|
|||
|
||||
/**
|
||||
* Parent actor for the MessageHandlerFrame JSWindowActor. The
|
||||
* MessageHandlerFrame actor is used by FrameTransport to communicate between
|
||||
* MessageHandlerFrame actor is used by RootTransport to communicate between
|
||||
* ROOT MessageHandlers and WINDOW_GLOBAL MessageHandlers.
|
||||
*/
|
||||
export class MessageHandlerFrameParent extends JSWindowActorParent {
|
||||
|
|
Загрузка…
Ссылка в новой задаче