From 8cb90829ccf18f95cd75d8419c84729c754a8e83 Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Sun, 14 Feb 2021 14:24:27 +0000 Subject: [PATCH] Bug 1690474 - [remote] Move CDP specific code to cdp/. r=remote-protocol-reviewers,jdescottes Differential Revision: https://phabricator.services.mozilla.com/D104574 --- .eslintignore | 2 +- remote/{ => cdp}/Connection.jsm | 2 +- remote/{ => cdp}/Error.jsm | 4 +- remote/{ => cdp}/JSONHandler.jsm | 6 +- remote/{ => cdp}/Protocol.jsm | 0 remote/{ => cdp}/RecommendedPreferences.jsm | 0 remote/{ => cdp}/StreamRegistry.jsm | 2 +- .../domains/ContentProcessDomain.jsm | 2 +- remote/cdp/domains/ContentProcessDomains.jsm | 25 +++++ remote/{ => cdp}/domains/Domain.jsm | 0 remote/{ => cdp}/domains/DomainCache.jsm | 4 +- remote/cdp/domains/ParentProcessDomains.jsm | 24 +++++ remote/{ => cdp}/domains/content/DOM.jsm | 2 +- .../{ => cdp}/domains/content/Emulation.jsm | 2 +- remote/{ => cdp}/domains/content/Input.jsm | 2 +- remote/{ => cdp}/domains/content/Log.jsm | 2 +- remote/{ => cdp}/domains/content/Network.jsm | 2 +- remote/{ => cdp}/domains/content/Page.jsm | 2 +- .../{ => cdp}/domains/content/Performance.jsm | 2 +- remote/{ => cdp}/domains/content/Runtime.jsm | 4 +- remote/{ => cdp}/domains/content/Security.jsm | 2 +- .../content/runtime/ExecutionContext.jsm | 0 remote/{ => cdp}/domains/parent/Browser.jsm | 2 +- remote/{ => cdp}/domains/parent/Emulation.jsm | 2 +- remote/{ => cdp}/domains/parent/IO.jsm | 4 +- remote/{ => cdp}/domains/parent/Input.jsm | 2 +- remote/{ => cdp}/domains/parent/Network.jsm | 2 +- remote/{ => cdp}/domains/parent/Page.jsm | 8 +- remote/{ => cdp}/domains/parent/Security.jsm | 2 +- remote/{ => cdp}/domains/parent/Target.jsm | 6 +- .../domains/parent/page/DialogHandler.jsm | 0 .../{ => cdp}/observers/ChannelEventSink.jsm | 0 .../{ => cdp}/observers/ContextObserver.jsm | 0 .../{ => cdp}/observers/NetworkObserver.jsm | 2 +- remote/{ => cdp}/observers/TargetObserver.jsm | 0 .../sessions/ContentProcessSession.jsm | 6 +- .../{ => cdp}/sessions/MainProcessSession.jsm | 2 +- remote/{ => cdp}/sessions/Session.jsm | 6 +- remote/{ => cdp}/sessions/TabSession.jsm | 4 +- remote/{ => cdp}/sessions/frame-script.js | 2 +- .../{ => cdp}/targets/MainProcessTarget.jsm | 4 +- remote/{ => cdp}/targets/TabTarget.jsm | 4 +- remote/{ => cdp}/targets/Target.jsm | 2 +- remote/{ => cdp}/targets/TargetList.jsm | 6 +- remote/components/RemoteAgent.jsm | 7 +- remote/doc/Architecture.md | 32 +++--- remote/domains/ContentProcessDomains.jsm | 25 ----- remote/domains/ParentProcessDomains.jsm | 24 ----- remote/jar.mn | 99 +++++++++---------- remote/moz.build | 47 ++++----- remote/test/browser/head.js | 2 +- remote/test/browser/input/head.js | 2 +- remote/test/browser/io/head.js | 2 +- remote/test/unit/test_Connection.js | 2 +- remote/test/unit/test_DomainCache.js | 4 +- remote/test/unit/test_Error.js | 2 +- remote/test/unit/test_Session.js | 2 +- remote/test/unit/test_StreamRegistry.js | 2 +- tools/lint/rejected-words.yml | 2 +- 59 files changed, 207 insertions(+), 204 deletions(-) rename remote/{ => cdp}/Connection.jsm (99%) rename remote/{ => cdp}/Error.jsm (95%) rename remote/{ => cdp}/JSONHandler.jsm (94%) rename remote/{ => cdp}/Protocol.jsm (100%) rename remote/{ => cdp}/RecommendedPreferences.jsm (100%) rename remote/{ => cdp}/StreamRegistry.jsm (98%) rename remote/{ => cdp}/domains/ContentProcessDomain.jsm (92%) create mode 100644 remote/cdp/domains/ContentProcessDomains.jsm rename remote/{ => cdp}/domains/Domain.jsm (100%) rename remote/{ => cdp}/domains/DomainCache.jsm (97%) create mode 100644 remote/cdp/domains/ParentProcessDomains.jsm rename remote/{ => cdp}/domains/content/DOM.jsm (99%) rename remote/{ => cdp}/domains/content/Emulation.jsm (93%) rename remote/{ => cdp}/domains/content/Input.jsm (96%) rename remote/{ => cdp}/domains/content/Log.jsm (97%) rename remote/{ => cdp}/domains/content/Network.jsm (89%) rename remote/{ => cdp}/domains/content/Page.jsm (99%) rename remote/{ => cdp}/domains/content/Performance.jsm (91%) rename remote/{ => cdp}/domains/content/Runtime.jsm (99%) rename remote/{ => cdp}/domains/content/Security.jsm (91%) rename remote/{ => cdp}/domains/content/runtime/ExecutionContext.jsm (100%) rename remote/{ => cdp}/domains/parent/Browser.jsm (94%) rename remote/{ => cdp}/domains/parent/Emulation.jsm (99%) rename remote/{ => cdp}/domains/parent/IO.jsm (97%) rename remote/{ => cdp}/domains/parent/Input.jsm (98%) rename remote/{ => cdp}/domains/parent/Network.jsm (99%) rename remote/{ => cdp}/domains/parent/Page.jsm (99%) rename remote/{ => cdp}/domains/parent/Security.jsm (96%) rename remote/{ => cdp}/domains/parent/Target.jsm (96%) rename remote/{ => cdp}/domains/parent/page/DialogHandler.jsm (100%) rename remote/{ => cdp}/observers/ChannelEventSink.jsm (100%) rename remote/{ => cdp}/observers/ContextObserver.jsm (100%) rename remote/{ => cdp}/observers/NetworkObserver.jsm (99%) rename remote/{ => cdp}/observers/TargetObserver.jsm (100%) rename remote/{ => cdp}/sessions/ContentProcessSession.jsm (94%) rename remote/{ => cdp}/sessions/MainProcessSession.jsm (90%) rename remote/{ => cdp}/sessions/Session.jsm (93%) rename remote/{ => cdp}/sessions/TabSession.jsm (96%) rename remote/{ => cdp}/sessions/frame-script.js (85%) rename remote/{ => cdp}/targets/MainProcessTarget.jsm (92%) rename remote/{ => cdp}/targets/TabTarget.jsm (97%) rename remote/{ => cdp}/targets/Target.jsm (97%) rename remote/{ => cdp}/targets/TargetList.jsm (95%) delete mode 100644 remote/domains/ContentProcessDomains.jsm delete mode 100644 remote/domains/ParentProcessDomains.jsm diff --git a/.eslintignore b/.eslintignore index c1f0da558791..56f072895693 100644 --- a/.eslintignore +++ b/.eslintignore @@ -158,7 +158,7 @@ modules/libpref/test/unit/*data/ python/ # These are (mainly) imported code that we don't want to lint to make imports easier. -remote/Protocol.jsm +remote/cdp/Protocol.jsm remote/test/browser/chrome-remote-interface.js # services/ exclusions diff --git a/remote/Connection.jsm b/remote/cdp/Connection.jsm similarity index 99% rename from remote/Connection.jsm rename to remote/cdp/Connection.jsm index 991ebac109c5..27472e9a8d89 100644 --- a/remote/Connection.jsm +++ b/remote/cdp/Connection.jsm @@ -15,7 +15,7 @@ const { truncate } = ChromeUtils.import( ); const { Log } = ChromeUtils.import("chrome://remote/content/shared/Log.jsm"); const { UnknownMethodError } = ChromeUtils.import( - "chrome://remote/content/Error.jsm" + "chrome://remote/content/cdp/Error.jsm" ); XPCOMUtils.defineLazyGetter(this, "log", Log.get); diff --git a/remote/Error.jsm b/remote/cdp/Error.jsm similarity index 95% rename from remote/Error.jsm rename to remote/cdp/Error.jsm index 191c5c651378..1fc338a5d6df 100644 --- a/remote/Error.jsm +++ b/remote/cdp/Error.jsm @@ -51,8 +51,8 @@ class RemoteAgentError extends Error { * The error must be of this form: * * {"message": "TypeError: foo is not a function\n - * execute@chrome://remote/content/sessions/Session.jsm:73:39\n - * onMessage@chrome://remote/content/sessions/TabSession.jsm:65:20"} + * execute@chrome://remote/content/cdp/sessions/Session.jsm:73:39\n + * onMessage@chrome://remote/content/cdp/sessions/TabSession.jsm:65:20"} * * This approach has the notable deficiency that it cannot deal * with causes to errors because of the unstructured nature of CDP diff --git a/remote/JSONHandler.jsm b/remote/cdp/JSONHandler.jsm similarity index 94% rename from remote/JSONHandler.jsm rename to remote/cdp/JSONHandler.jsm index 8a6308f5fdc9..3e7a2fe303d2 100644 --- a/remote/JSONHandler.jsm +++ b/remote/cdp/JSONHandler.jsm @@ -12,9 +12,11 @@ const { HTTP_404, HTTP_505 } = ChromeUtils.import( "chrome://remote/content/server/HTTPD.jsm" ); const { Log } = ChromeUtils.import("chrome://remote/content/shared/Log.jsm"); -const { Protocol } = ChromeUtils.import("chrome://remote/content/Protocol.jsm"); +const { Protocol } = ChromeUtils.import( + "chrome://remote/content/cdp/Protocol.jsm" +); const { RemoteAgentError } = ChromeUtils.import( - "chrome://remote/content/Error.jsm" + "chrome://remote/content/cdp/Error.jsm" ); class JSONHandler { diff --git a/remote/Protocol.jsm b/remote/cdp/Protocol.jsm similarity index 100% rename from remote/Protocol.jsm rename to remote/cdp/Protocol.jsm diff --git a/remote/RecommendedPreferences.jsm b/remote/cdp/RecommendedPreferences.jsm similarity index 100% rename from remote/RecommendedPreferences.jsm rename to remote/cdp/RecommendedPreferences.jsm diff --git a/remote/StreamRegistry.jsm b/remote/cdp/StreamRegistry.jsm similarity index 98% rename from remote/StreamRegistry.jsm rename to remote/cdp/StreamRegistry.jsm index af292c672275..db1d9d5944fe 100644 --- a/remote/StreamRegistry.jsm +++ b/remote/cdp/StreamRegistry.jsm @@ -20,7 +20,7 @@ XPCOMUtils.defineLazyServiceGetters(this, { }); const { UnsupportedError } = ChromeUtils.import( - "chrome://remote/content/Error.jsm" + "chrome://remote/content/cdp/Error.jsm" ); class StreamRegistry { diff --git a/remote/domains/ContentProcessDomain.jsm b/remote/cdp/domains/ContentProcessDomain.jsm similarity index 92% rename from remote/domains/ContentProcessDomain.jsm rename to remote/cdp/domains/ContentProcessDomain.jsm index 9ef2622805bb..5ef72a8c07df 100644 --- a/remote/domains/ContentProcessDomain.jsm +++ b/remote/cdp/domains/ContentProcessDomain.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["ContentProcessDomain"]; const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); class ContentProcessDomain extends Domain { diff --git a/remote/cdp/domains/ContentProcessDomains.jsm b/remote/cdp/domains/ContentProcessDomains.jsm new file mode 100644 index 000000000000..76710eed95cf --- /dev/null +++ b/remote/cdp/domains/ContentProcessDomains.jsm @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +var EXPORTED_SYMBOLS = ["ContentProcessDomains"]; + +const { XPCOMUtils } = ChromeUtils.import( + "resource://gre/modules/XPCOMUtils.jsm" +); + +const ContentProcessDomains = {}; + +XPCOMUtils.defineLazyModuleGetters(ContentProcessDomains, { + DOM: "chrome://remote/content/cdp/domains/content/DOM.jsm", + Emulation: "chrome://remote/content/cdp/domains/content/Emulation.jsm", + Input: "chrome://remote/content/cdp/domains/content/Input.jsm", + Log: "chrome://remote/content/cdp/domains/content/Log.jsm", + Network: "chrome://remote/content/cdp/domains/content/Network.jsm", + Page: "chrome://remote/content/cdp/domains/content/Page.jsm", + Performance: "chrome://remote/content/cdp/domains/content/Performance.jsm", + Runtime: "chrome://remote/content/cdp/domains/content/Runtime.jsm", + Security: "chrome://remote/content/cdp/domains/content/Security.jsm", +}); diff --git a/remote/domains/Domain.jsm b/remote/cdp/domains/Domain.jsm similarity index 100% rename from remote/domains/Domain.jsm rename to remote/cdp/domains/Domain.jsm diff --git a/remote/domains/DomainCache.jsm b/remote/cdp/domains/DomainCache.jsm similarity index 97% rename from remote/domains/DomainCache.jsm rename to remote/cdp/domains/DomainCache.jsm index 8f240d7c89dd..fab42a11a253 100644 --- a/remote/domains/DomainCache.jsm +++ b/remote/cdp/domains/DomainCache.jsm @@ -7,10 +7,10 @@ var EXPORTED_SYMBOLS = ["DomainCache"]; const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); const { UnknownMethodError } = ChromeUtils.import( - "chrome://remote/content/Error.jsm" + "chrome://remote/content/cdp/Error.jsm" ); /** diff --git a/remote/cdp/domains/ParentProcessDomains.jsm b/remote/cdp/domains/ParentProcessDomains.jsm new file mode 100644 index 000000000000..da1c65247206 --- /dev/null +++ b/remote/cdp/domains/ParentProcessDomains.jsm @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +var EXPORTED_SYMBOLS = ["ParentProcessDomains"]; + +const { XPCOMUtils } = ChromeUtils.import( + "resource://gre/modules/XPCOMUtils.jsm" +); + +const ParentProcessDomains = {}; + +XPCOMUtils.defineLazyModuleGetters(ParentProcessDomains, { + Browser: "chrome://remote/content/cdp/domains/parent/Browser.jsm", + Emulation: "chrome://remote/content/cdp/domains/parent/Emulation.jsm", + Input: "chrome://remote/content/cdp/domains/parent/Input.jsm", + IO: "chrome://remote/content/cdp/domains/parent/IO.jsm", + Network: "chrome://remote/content/cdp/domains/parent/Network.jsm", + Page: "chrome://remote/content/cdp/domains/parent/Page.jsm", + Security: "chrome://remote/content/cdp/domains/parent/Security.jsm", + Target: "chrome://remote/content/cdp/domains/parent/Target.jsm", +}); diff --git a/remote/domains/content/DOM.jsm b/remote/cdp/domains/content/DOM.jsm similarity index 99% rename from remote/domains/content/DOM.jsm rename to remote/cdp/domains/content/DOM.jsm index a771dfbffb15..c3182c12bd83 100644 --- a/remote/domains/content/DOM.jsm +++ b/remote/cdp/domains/content/DOM.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["DOM"]; const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomain.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" ); class DOM extends ContentProcessDomain { diff --git a/remote/domains/content/Emulation.jsm b/remote/cdp/domains/content/Emulation.jsm similarity index 93% rename from remote/domains/content/Emulation.jsm rename to remote/cdp/domains/content/Emulation.jsm index efe6d336cbe4..481662ebb555 100644 --- a/remote/domains/content/Emulation.jsm +++ b/remote/cdp/domains/content/Emulation.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["Emulation"]; const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomain.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" ); class Emulation extends ContentProcessDomain { diff --git a/remote/domains/content/Input.jsm b/remote/cdp/domains/content/Input.jsm similarity index 96% rename from remote/domains/content/Input.jsm rename to remote/cdp/domains/content/Input.jsm index 7be69c57d33a..34d3d12aa0a7 100644 --- a/remote/domains/content/Input.jsm +++ b/remote/cdp/domains/content/Input.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["Input"]; const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomain.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" ); class Input extends ContentProcessDomain { diff --git a/remote/domains/content/Log.jsm b/remote/cdp/domains/content/Log.jsm similarity index 97% rename from remote/domains/content/Log.jsm rename to remote/cdp/domains/content/Log.jsm index 316f1adfebdc..aec785be635c 100644 --- a/remote/domains/content/Log.jsm +++ b/remote/cdp/domains/content/Log.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["Log"]; const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomain.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" ); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); diff --git a/remote/domains/content/Network.jsm b/remote/cdp/domains/content/Network.jsm similarity index 89% rename from remote/domains/content/Network.jsm rename to remote/cdp/domains/content/Network.jsm index 3f83e2c967ac..f2c07cbbe56d 100644 --- a/remote/domains/content/Network.jsm +++ b/remote/cdp/domains/content/Network.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["Network"]; const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomain.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" ); class Network extends ContentProcessDomain { diff --git a/remote/domains/content/Page.jsm b/remote/cdp/domains/content/Page.jsm similarity index 99% rename from remote/domains/content/Page.jsm rename to remote/cdp/domains/content/Page.jsm index 8a3c85ce26f4..9ea294f466c8 100644 --- a/remote/domains/content/Page.jsm +++ b/remote/cdp/domains/content/Page.jsm @@ -11,7 +11,7 @@ const { XPCOMUtils } = ChromeUtils.import( ); const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomain.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" ); XPCOMUtils.defineLazyServiceGetter( diff --git a/remote/domains/content/Performance.jsm b/remote/cdp/domains/content/Performance.jsm similarity index 91% rename from remote/domains/content/Performance.jsm rename to remote/cdp/domains/content/Performance.jsm index 2252ba3759e1..865fa5a3daf5 100644 --- a/remote/domains/content/Performance.jsm +++ b/remote/cdp/domains/content/Performance.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["Performance"]; const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomain.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" ); class Performance extends ContentProcessDomain { diff --git a/remote/domains/content/Runtime.jsm b/remote/cdp/domains/content/Runtime.jsm similarity index 99% rename from remote/domains/content/Runtime.jsm rename to remote/cdp/domains/content/Runtime.jsm index d62f270dd059..13dbdb0bd357 100644 --- a/remote/domains/content/Runtime.jsm +++ b/remote/cdp/domains/content/Runtime.jsm @@ -13,10 +13,10 @@ const { addDebuggerToGlobal } = ChromeUtils.import( const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomain.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" ); const { ExecutionContext } = ChromeUtils.import( - "chrome://remote/content/domains/content/runtime/ExecutionContext.jsm" + "chrome://remote/content/cdp/domains/content/runtime/ExecutionContext.jsm" ); const { executeSoon } = ChromeUtils.import( "chrome://remote/content/shared/Sync.jsm" diff --git a/remote/domains/content/Security.jsm b/remote/cdp/domains/content/Security.jsm similarity index 91% rename from remote/domains/content/Security.jsm rename to remote/cdp/domains/content/Security.jsm index 7131df4fa969..957220caf8a4 100644 --- a/remote/domains/content/Security.jsm +++ b/remote/cdp/domains/content/Security.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["Security"]; const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomain.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" ); class Security extends ContentProcessDomain { diff --git a/remote/domains/content/runtime/ExecutionContext.jsm b/remote/cdp/domains/content/runtime/ExecutionContext.jsm similarity index 100% rename from remote/domains/content/runtime/ExecutionContext.jsm rename to remote/cdp/domains/content/runtime/ExecutionContext.jsm diff --git a/remote/domains/parent/Browser.jsm b/remote/cdp/domains/parent/Browser.jsm similarity index 94% rename from remote/domains/parent/Browser.jsm rename to remote/cdp/domains/parent/Browser.jsm index 9e496e52f64c..8ff2eb1cbd57 100644 --- a/remote/domains/parent/Browser.jsm +++ b/remote/cdp/domains/parent/Browser.jsm @@ -8,7 +8,7 @@ var EXPORTED_SYMBOLS = ["Browser"]; const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); class Browser extends Domain { diff --git a/remote/domains/parent/Emulation.jsm b/remote/cdp/domains/parent/Emulation.jsm similarity index 99% rename from remote/domains/parent/Emulation.jsm rename to remote/cdp/domains/parent/Emulation.jsm index 14a0f0263601..504a02373b52 100644 --- a/remote/domains/parent/Emulation.jsm +++ b/remote/cdp/domains/parent/Emulation.jsm @@ -9,7 +9,7 @@ var EXPORTED_SYMBOLS = ["Emulation"]; const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm"); const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); const MAX_WINDOW_SIZE = 10000000; diff --git a/remote/domains/parent/IO.jsm b/remote/cdp/domains/parent/IO.jsm similarity index 97% rename from remote/domains/parent/IO.jsm rename to remote/cdp/domains/parent/IO.jsm index c6213cf862fb..0ad400218bde 100644 --- a/remote/domains/parent/IO.jsm +++ b/remote/cdp/domains/parent/IO.jsm @@ -15,10 +15,10 @@ XPCOMUtils.defineLazyModuleGetters(this, { }); const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); const { StreamRegistry } = ChromeUtils.import( - "chrome://remote/content/StreamRegistry.jsm" + "chrome://remote/content/cdp/StreamRegistry.jsm" ); const DEFAULT_CHUNK_SIZE = 10 * 1024 * 1024; diff --git a/remote/domains/parent/Input.jsm b/remote/cdp/domains/parent/Input.jsm similarity index 98% rename from remote/domains/parent/Input.jsm rename to remote/cdp/domains/parent/Input.jsm index 93a4bc527741..d6dcce3f5601 100644 --- a/remote/domains/parent/Input.jsm +++ b/remote/cdp/domains/parent/Input.jsm @@ -9,7 +9,7 @@ var EXPORTED_SYMBOLS = ["Input"]; const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); class Input extends Domain { diff --git a/remote/domains/parent/Network.jsm b/remote/cdp/domains/parent/Network.jsm similarity index 99% rename from remote/domains/parent/Network.jsm rename to remote/cdp/domains/parent/Network.jsm index 16850f397de4..b7bf74bb7f3f 100644 --- a/remote/domains/parent/Network.jsm +++ b/remote/cdp/domains/parent/Network.jsm @@ -15,7 +15,7 @@ const { XPCOMUtils } = ChromeUtils.import( XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]); const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); const MAX_COOKIE_EXPIRY = Number.MAX_SAFE_INTEGER; diff --git a/remote/domains/parent/Page.jsm b/remote/cdp/domains/parent/Page.jsm similarity index 99% rename from remote/domains/parent/Page.jsm rename to remote/cdp/domains/parent/Page.jsm index ec8cf4df27c3..131c33932d3f 100644 --- a/remote/domains/parent/Page.jsm +++ b/remote/cdp/domains/parent/Page.jsm @@ -22,16 +22,16 @@ const { clearInterval, setInterval } = ChromeUtils.import( ); const { DialogHandler } = ChromeUtils.import( - "chrome://remote/content/domains/parent/page/DialogHandler.jsm" + "chrome://remote/content/cdp/domains/parent/page/DialogHandler.jsm" ); const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); const { UnsupportedError } = ChromeUtils.import( - "chrome://remote/content/Error.jsm" + "chrome://remote/content/cdp/Error.jsm" ); const { streamRegistry } = ChromeUtils.import( - "chrome://remote/content/domains/parent/IO.jsm" + "chrome://remote/content/cdp/domains/parent/IO.jsm" ); const { PollPromise } = ChromeUtils.import( "chrome://remote/content/shared/Sync.jsm" diff --git a/remote/domains/parent/Security.jsm b/remote/cdp/domains/parent/Security.jsm similarity index 96% rename from remote/domains/parent/Security.jsm rename to remote/cdp/domains/parent/Security.jsm index 5114dd106965..a5c942d5b973 100644 --- a/remote/domains/parent/Security.jsm +++ b/remote/cdp/domains/parent/Security.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["Security"]; const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); const { Preferences } = ChromeUtils.import( diff --git a/remote/domains/parent/Target.jsm b/remote/cdp/domains/parent/Target.jsm similarity index 96% rename from remote/domains/parent/Target.jsm rename to remote/cdp/domains/parent/Target.jsm index 086a2c7c10e0..f4d846a54686 100644 --- a/remote/domains/parent/Target.jsm +++ b/remote/cdp/domains/parent/Target.jsm @@ -20,16 +20,16 @@ const { ContextualIdentityService } = ChromeUtils.import( "resource://gre/modules/ContextualIdentityService.jsm" ); const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); const { MainProcessTarget } = ChromeUtils.import( - "chrome://remote/content/targets/MainProcessTarget.jsm" + "chrome://remote/content/cdp/targets/MainProcessTarget.jsm" ); const { TabManager } = ChromeUtils.import( "chrome://remote/content/shared/TabManager.jsm" ); const { TabSession } = ChromeUtils.import( - "chrome://remote/content/sessions/TabSession.jsm" + "chrome://remote/content/cdp/sessions/TabSession.jsm" ); const { WindowManager } = ChromeUtils.import( "chrome://remote/content/shared/WindowManager.jsm" diff --git a/remote/domains/parent/page/DialogHandler.jsm b/remote/cdp/domains/parent/page/DialogHandler.jsm similarity index 100% rename from remote/domains/parent/page/DialogHandler.jsm rename to remote/cdp/domains/parent/page/DialogHandler.jsm diff --git a/remote/observers/ChannelEventSink.jsm b/remote/cdp/observers/ChannelEventSink.jsm similarity index 100% rename from remote/observers/ChannelEventSink.jsm rename to remote/cdp/observers/ChannelEventSink.jsm diff --git a/remote/observers/ContextObserver.jsm b/remote/cdp/observers/ContextObserver.jsm similarity index 100% rename from remote/observers/ContextObserver.jsm rename to remote/cdp/observers/ContextObserver.jsm diff --git a/remote/observers/NetworkObserver.jsm b/remote/cdp/observers/NetworkObserver.jsm similarity index 99% rename from remote/observers/NetworkObserver.jsm rename to remote/cdp/observers/NetworkObserver.jsm index fa1954180b86..abd595a071d9 100644 --- a/remote/observers/NetworkObserver.jsm +++ b/remote/cdp/observers/NetworkObserver.jsm @@ -16,7 +16,7 @@ const { CommonUtils } = ChromeUtils.import( "resource://services-common/utils.js" ); const { ChannelEventSinkFactory } = ChromeUtils.import( - "chrome://remote/content/observers/ChannelEventSink.jsm" + "chrome://remote/content/cdp/observers/ChannelEventSink.jsm" ); const CC = Components.Constructor; diff --git a/remote/observers/TargetObserver.jsm b/remote/cdp/observers/TargetObserver.jsm similarity index 100% rename from remote/observers/TargetObserver.jsm rename to remote/cdp/observers/TargetObserver.jsm diff --git a/remote/sessions/ContentProcessSession.jsm b/remote/cdp/sessions/ContentProcessSession.jsm similarity index 94% rename from remote/sessions/ContentProcessSession.jsm rename to remote/cdp/sessions/ContentProcessSession.jsm index 1aaa822001bd..2771dd4772bf 100644 --- a/remote/sessions/ContentProcessSession.jsm +++ b/remote/cdp/sessions/ContentProcessSession.jsm @@ -7,16 +7,16 @@ var EXPORTED_SYMBOLS = ["ContentProcessSession"]; const { ContentProcessDomains } = ChromeUtils.import( - "chrome://remote/content/domains/ContentProcessDomains.jsm" + "chrome://remote/content/cdp/domains/ContentProcessDomains.jsm" ); const { DomainCache } = ChromeUtils.import( - "chrome://remote/content/domains/DomainCache.jsm" + "chrome://remote/content/cdp/domains/DomainCache.jsm" ); ChromeUtils.defineModuleGetter( this, "ContextObserver", - "chrome://remote/content/observers/ContextObserver.jsm" + "chrome://remote/content/cdp/observers/ContextObserver.jsm" ); class ContentProcessSession { diff --git a/remote/sessions/MainProcessSession.jsm b/remote/cdp/sessions/MainProcessSession.jsm similarity index 90% rename from remote/sessions/MainProcessSession.jsm rename to remote/cdp/sessions/MainProcessSession.jsm index 826cb740610d..e9cbd299e5f1 100644 --- a/remote/sessions/MainProcessSession.jsm +++ b/remote/cdp/sessions/MainProcessSession.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["MainProcessSession"]; const { Session } = ChromeUtils.import( - "chrome://remote/content/sessions/Session.jsm" + "chrome://remote/content/cdp/sessions/Session.jsm" ); /** diff --git a/remote/sessions/Session.jsm b/remote/cdp/sessions/Session.jsm similarity index 93% rename from remote/sessions/Session.jsm rename to remote/cdp/sessions/Session.jsm index 9c964ab99f1c..c490ccc6a646 100644 --- a/remote/sessions/Session.jsm +++ b/remote/cdp/sessions/Session.jsm @@ -7,14 +7,14 @@ var EXPORTED_SYMBOLS = ["Session"]; const { ParentProcessDomains } = ChromeUtils.import( - "chrome://remote/content/domains/ParentProcessDomains.jsm" + "chrome://remote/content/cdp/domains/ParentProcessDomains.jsm" ); const { DomainCache } = ChromeUtils.import( - "chrome://remote/content/domains/DomainCache.jsm" + "chrome://remote/content/cdp/domains/DomainCache.jsm" ); const { NetworkObserver } = ChromeUtils.import( - "chrome://remote/content/observers/NetworkObserver.jsm" + "chrome://remote/content/cdp/observers/NetworkObserver.jsm" ); /** diff --git a/remote/sessions/TabSession.jsm b/remote/cdp/sessions/TabSession.jsm similarity index 96% rename from remote/sessions/TabSession.jsm rename to remote/cdp/sessions/TabSession.jsm index d5135c1a1632..1a4649bd3318 100644 --- a/remote/sessions/TabSession.jsm +++ b/remote/cdp/sessions/TabSession.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["TabSession"]; const { Session } = ChromeUtils.import( - "chrome://remote/content/sessions/Session.jsm" + "chrome://remote/content/cdp/sessions/Session.jsm" ); /** @@ -40,7 +40,7 @@ class TabSession extends Session { this.mm.addMessageListener("remote:error", this); this.mm.loadFrameScript( - "chrome://remote/content/sessions/frame-script.js", + "chrome://remote/content/cdp/sessions/frame-script.js", false ); } diff --git a/remote/sessions/frame-script.js b/remote/cdp/sessions/frame-script.js similarity index 85% rename from remote/sessions/frame-script.js rename to remote/cdp/sessions/frame-script.js index ef0c5047c5f2..03c45079764f 100644 --- a/remote/sessions/frame-script.js +++ b/remote/cdp/sessions/frame-script.js @@ -5,7 +5,7 @@ "use strict"; const { ContentProcessSession } = ChromeUtils.import( - "chrome://remote/content/sessions/ContentProcessSession.jsm" + "chrome://remote/content/cdp/sessions/ContentProcessSession.jsm" ); /* global content, docShell */ diff --git a/remote/targets/MainProcessTarget.jsm b/remote/cdp/targets/MainProcessTarget.jsm similarity index 92% rename from remote/targets/MainProcessTarget.jsm rename to remote/cdp/targets/MainProcessTarget.jsm index aaa9eebc6990..337e807f8c20 100644 --- a/remote/targets/MainProcessTarget.jsm +++ b/remote/cdp/targets/MainProcessTarget.jsm @@ -7,10 +7,10 @@ var EXPORTED_SYMBOLS = ["MainProcessTarget"]; const { Target } = ChromeUtils.import( - "chrome://remote/content/targets/Target.jsm" + "chrome://remote/content/cdp/targets/Target.jsm" ); const { MainProcessSession } = ChromeUtils.import( - "chrome://remote/content/sessions/MainProcessSession.jsm" + "chrome://remote/content/cdp/sessions/MainProcessSession.jsm" ); const { RemoteAgent } = ChromeUtils.import( "chrome://remote/content/components/RemoteAgent.jsm" diff --git a/remote/targets/TabTarget.jsm b/remote/cdp/targets/TabTarget.jsm similarity index 97% rename from remote/targets/TabTarget.jsm rename to remote/cdp/targets/TabTarget.jsm index 381b519a5f0c..bc5ebaff4ba9 100644 --- a/remote/targets/TabTarget.jsm +++ b/remote/cdp/targets/TabTarget.jsm @@ -7,11 +7,11 @@ var EXPORTED_SYMBOLS = ["TabTarget"]; const { Target } = ChromeUtils.import( - "chrome://remote/content/targets/Target.jsm" + "chrome://remote/content/cdp/targets/Target.jsm" ); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { TabSession } = ChromeUtils.import( - "chrome://remote/content/sessions/TabSession.jsm" + "chrome://remote/content/cdp/sessions/TabSession.jsm" ); const { XPCOMUtils } = ChromeUtils.import( "resource://gre/modules/XPCOMUtils.jsm" diff --git a/remote/targets/Target.jsm b/remote/cdp/targets/Target.jsm similarity index 97% rename from remote/targets/Target.jsm rename to remote/cdp/targets/Target.jsm index b413b4b22064..9e29cf3210ae 100644 --- a/remote/targets/Target.jsm +++ b/remote/cdp/targets/Target.jsm @@ -7,7 +7,7 @@ var EXPORTED_SYMBOLS = ["Target"]; const { Connection } = ChromeUtils.import( - "chrome://remote/content/Connection.jsm" + "chrome://remote/content/cdp/Connection.jsm" ); const { WebSocketTransport } = ChromeUtils.import( "chrome://remote/content/server/WebSocketTransport.jsm" diff --git a/remote/targets/TargetList.jsm b/remote/cdp/targets/TargetList.jsm similarity index 95% rename from remote/targets/TargetList.jsm rename to remote/cdp/targets/TargetList.jsm index 7117fbbee457..d74b4bf3fa06 100644 --- a/remote/targets/TargetList.jsm +++ b/remote/cdp/targets/TargetList.jsm @@ -10,13 +10,13 @@ const { EventEmitter } = ChromeUtils.import( "resource://gre/modules/EventEmitter.jsm" ); const { TabTarget } = ChromeUtils.import( - "chrome://remote/content/targets/TabTarget.jsm" + "chrome://remote/content/cdp/targets/TabTarget.jsm" ); const { MainProcessTarget } = ChromeUtils.import( - "chrome://remote/content/targets/MainProcessTarget.jsm" + "chrome://remote/content/cdp/targets/MainProcessTarget.jsm" ); const { TabObserver } = ChromeUtils.import( - "chrome://remote/content/observers/TargetObserver.jsm" + "chrome://remote/content/cdp/observers/TargetObserver.jsm" ); class TargetList { diff --git a/remote/components/RemoteAgent.jsm b/remote/components/RemoteAgent.jsm index e711c0530c63..19a451fe4cb8 100644 --- a/remote/components/RemoteAgent.jsm +++ b/remote/components/RemoteAgent.jsm @@ -13,11 +13,12 @@ const { XPCOMUtils } = ChromeUtils.import( XPCOMUtils.defineLazyModuleGetters(this, { HttpServer: "chrome://remote/content/server/HTTPD.jsm", - JSONHandler: "chrome://remote/content/JSONHandler.jsm", + JSONHandler: "chrome://remote/content/cdp/JSONHandler.jsm", Log: "chrome://remote/content/shared/Log.jsm", Preferences: "resource://gre/modules/Preferences.jsm", - RecommendedPreferences: "chrome://remote/content/RecommendedPreferences.jsm", - TargetList: "chrome://remote/content/targets/TargetList.jsm", + RecommendedPreferences: + "chrome://remote/content/cdp/RecommendedPreferences.jsm", + TargetList: "chrome://remote/content/cdp/targets/TargetList.jsm", }); XPCOMUtils.defineLazyGetter(this, "log", Log.get); diff --git a/remote/doc/Architecture.md b/remote/doc/Architecture.md index e1569d0a0424..799e11ce5968 100644 --- a/remote/doc/Architecture.md +++ b/remote/doc/Architecture.md @@ -17,7 +17,7 @@ To do that this component glue together three main high level components: This will be used to implement the various http endpoints of CDP. There is a few static URL implemented by `JSONHandler` and one dynamic URL per target. - * `JSONHandler` + * `cdp/JSONHandler` This implements the following three static http endpoints: * /json/version: Returns information about the runtime as well as the url of the browser target websocket url. @@ -31,19 +31,19 @@ To do that this component glue together three main high level components: We have a future intention to fix this and report only what Firefox implements. You can connect to these websocket URL in order to debug things. - * `targets/TargetList` + * `cdp/targets/TargetList` This component is responsible of maintaining the list of all debuggable targets. For now it can be either: * The main browser target A special target which allows to inspect the browser, but not any particular tab. - This is implemented by `targets/MainProcessTarget` and is instantiated on startup. + This is implemented by `cdp/targets/MainProcessTarget` and is instantiated on startup. * Tab targets - Each opened tab will have a related `targets/TabTarget` instantiated on their opening, + Each opened tab will have a related `cdp/targets/TabTarget` instantiated on their opening, or on server startup for already opened ones. Each target aims at focusing on one particular context. This context is typically running in one particular environment. This can be a particular process or thread. In the future, we will most likely support targets for workers and add-ons. - All targets inherit from `targets/Target`. + All targets inherit from `cdp/targets/Target`. Connecting to Websocket endpoints --------------------------------- @@ -54,7 +54,7 @@ Once a HTTP request happens, `server/HTTPD` will call the `handle` method on the For static endpoints registered by `JSONHandler`, this will call `JSONHandler:handle` and return a JSON string as http body. For target's endpoint, it is slightly more complicated as it requires a special handshake to morph the HTTP connection into a WebSocket one. The WebSocket is then going to be long lived and be used to inspect the target over time. -When a request is made to a target URL, `targets/Target:handle` is called and: +When a request is made to a target URL, `cdp/targets/Target:handle` is called and: * delegate the complex HTTP to WebSocket handshake operation to `server/WebSocketHandshake:upgrade` In return we retrieve a WebSocket object. @@ -71,14 +71,14 @@ When a request is made to a target URL, `targets/Target:handle` is called and: A connection may have more than one session attached to it. * instantiate the default session - The session is specific to each target kind and all of them inherit from `session/Session`. - For example, tabs targets uses `session/TabSession` and the main browser target uses `session/MainProcessSession`. - Which session class is used is defined by the Target subclass’ constructor, which pass a session class reference to targets/Target:constructor. + The session is specific to each target kind and all of them inherit from `cdp/session/Session`. + For example, tabs targets uses `cdp/session/TabSession` and the main browser target uses `cdp/session/MainProcessSession`. + Which session class is used is defined by the Target subclass’ constructor, which pass a session class reference to `cdp/targets/Target:constructor`. A session is mostly responsible of accommodating the eventual cross process/cross thread aspects of the target. - The code we are currently describing (`targets/Target:handle`) is running in the parent process. + The code we are currently describing (`cdp/targets/Target:handle`) is running in the parent process. The session class receive CDP commands from the connection and first try to execute the Domain commands in the parent process. Then, if the target actually runs in some other context, the session tries to forward this command to this other context, which can be a thread or a process. - Typically, the `sessions/TabSession` forward the CDP command to the content process where the tab is running. + Typically, the `cdp/sessions/TabSession` forward the CDP command to the content process where the tab is running. It also redirects back the command response as well as Domain events from that process back to the parent process in order to forward them to the connection. Sessions will be using the `DomainCache` class as a helper to manage a list of Domain implementations in a given context. @@ -89,7 +89,7 @@ Debugging additional Targets From a given connection you can know about the other potential targets. You typically do that via `Target.setDiscoverTargets()`, which will emit `Target.targetCreated` events providing a target ID. You may create a new session for the new target by handing the ID to `Target.attachToTarget()`, which will return a session ID. -"Target" here is a reference to the CDP Domain implemented in `domains/parent/Target.jsm`. That is different from `targets/Target` +"Target" here is a reference to the CDP Domain implemented in `cdp/domains/parent/Target.jsm`. That is different from `cdp/targets/Target` class which is an implementation detail of the Remote Agent. Then, there is two ways to communicate with the other targets: @@ -103,7 +103,7 @@ Then, there is two ways to communicate with the other targets: This client will re-use the same WebSocket connection, but every single CDP packet will contain an additional `sessionId` attribute. This helps distinguish packets which relate to the original target as well as the multiple additional targets you may attach to. -In both cases, `Target.attachToTarget()` is special as it will spawn `session/TabSession` for the tab you are attaching to. +In both cases, `Target.attachToTarget()` is special as it will spawn `cdp/session/TabSession` for the tab you are attaching to. This is the codepath creating non-default session. The default session is related to the target you originally connected to, so that you don't need any ID for this one. When you want to debug more than one target over a single connection you need additional sessions, which will have a unique ID. @@ -119,11 +119,11 @@ The main and startup code of the Remote agent code runs in the parent process. The handling of the command line as well as all the HTTP and WebSocket work is all done in the parent process. The browser target is also all implemented in the parent process. But when it comes to a tab target, as the tab runs in the content process, we have to run code there as well. -Let's start from the `sessions/TabSession` class, which has already been described. +Let's start from the `cdp/sessions/TabSession` class, which has already been described. We receive here JSON packets from the WebSocket connection and we are in the parent process. In this class, we route the messages to the parent process domains first. If there is no implementation of the domain or the particular method, -we forward the command to a `session/ContentProcessSession` which runs in the tab's content process. +we forward the command to a `cdp/session/ContentProcessSession` which runs in the tab's content process. These two Session classes will interact with each other in order to forward back the returned value of the method we just called, as well as piping back any event being sent by a Domain implemented in any of the two processes. @@ -161,4 +161,4 @@ Organizational chart of all the classes ``` [1] Target is inherited by TabTarget and MainProcessTarget. [2] Session is inherited by TabSession and MainProcessSession. - [3] Domain is inherited by Log, Page, Browser, Target.... i.e. all domain implementations. From both domains/parent and domains/content folders. + [3] Domain is inherited by Log, Page, Browser, Target.... i.e. all domain implementations. From both cdp/domains/parent and cdp/domains/content folders. diff --git a/remote/domains/ContentProcessDomains.jsm b/remote/domains/ContentProcessDomains.jsm deleted file mode 100644 index f00404402f5f..000000000000 --- a/remote/domains/ContentProcessDomains.jsm +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -var EXPORTED_SYMBOLS = ["ContentProcessDomains"]; - -const { XPCOMUtils } = ChromeUtils.import( - "resource://gre/modules/XPCOMUtils.jsm" -); - -const ContentProcessDomains = {}; - -XPCOMUtils.defineLazyModuleGetters(ContentProcessDomains, { - DOM: "chrome://remote/content/domains/content/DOM.jsm", - Emulation: "chrome://remote/content/domains/content/Emulation.jsm", - Input: "chrome://remote/content/domains/content/Input.jsm", - Log: "chrome://remote/content/domains/content/Log.jsm", - Network: "chrome://remote/content/domains/content/Network.jsm", - Page: "chrome://remote/content/domains/content/Page.jsm", - Performance: "chrome://remote/content/domains/content/Performance.jsm", - Runtime: "chrome://remote/content/domains/content/Runtime.jsm", - Security: "chrome://remote/content/domains/content/Security.jsm", -}); diff --git a/remote/domains/ParentProcessDomains.jsm b/remote/domains/ParentProcessDomains.jsm deleted file mode 100644 index 90bfdef388be..000000000000 --- a/remote/domains/ParentProcessDomains.jsm +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -var EXPORTED_SYMBOLS = ["ParentProcessDomains"]; - -const { XPCOMUtils } = ChromeUtils.import( - "resource://gre/modules/XPCOMUtils.jsm" -); - -const ParentProcessDomains = {}; - -XPCOMUtils.defineLazyModuleGetters(ParentProcessDomains, { - Browser: "chrome://remote/content/domains/parent/Browser.jsm", - Emulation: "chrome://remote/content/domains/parent/Emulation.jsm", - Input: "chrome://remote/content/domains/parent/Input.jsm", - IO: "chrome://remote/content/domains/parent/IO.jsm", - Network: "chrome://remote/content/domains/parent/Network.jsm", - Page: "chrome://remote/content/domains/parent/Page.jsm", - Security: "chrome://remote/content/domains/parent/Security.jsm", - Target: "chrome://remote/content/domains/parent/Target.jsm", -}); diff --git a/remote/jar.mn b/remote/jar.mn index 187689a4d813..4d272f7e807b 100644 --- a/remote/jar.mn +++ b/remote/jar.mn @@ -6,59 +6,56 @@ remote.jar: % content remote %content/ content/components/RemoteAgent.jsm (components/RemoteAgent.jsm) - content/Connection.jsm (Connection.jsm) - content/Error.jsm (Error.jsm) - content/JSONHandler.jsm (JSONHandler.jsm) - content/Protocol.jsm (Protocol.jsm) - content/RecommendedPreferences.jsm (RecommendedPreferences.jsm) - content/StreamRegistry.jsm (StreamRegistry.jsm) - - # observers - content/observers/ChannelEventSink.jsm (observers/ChannelEventSink.jsm) - content/observers/ContextObserver.jsm (observers/ContextObserver.jsm) - content/observers/NetworkObserver.jsm (observers/NetworkObserver.jsm) - content/observers/TargetObserver.jsm (observers/TargetObserver.jsm) - - # sessions - content/sessions/frame-script.js (sessions/frame-script.js) - content/sessions/ContentProcessSession.jsm (sessions/ContentProcessSession.jsm) - content/sessions/MainProcessSession.jsm (sessions/MainProcessSession.jsm) - content/sessions/Session.jsm (sessions/Session.jsm) - content/sessions/TabSession.jsm (sessions/TabSession.jsm) - - # targets - content/targets/MainProcessTarget.jsm (targets/MainProcessTarget.jsm) - content/targets/TabTarget.jsm (targets/TabTarget.jsm) - content/targets/Target.jsm (targets/Target.jsm) - content/targets/TargetList.jsm (targets/TargetList.jsm) - + ## CDP ## + content/cdp/Connection.jsm (cdp/Connection.jsm) + content/cdp/Error.jsm (cdp/Error.jsm) + content/cdp/JSONHandler.jsm (cdp/JSONHandler.jsm) + content/cdp/Protocol.jsm (cdp/Protocol.jsm) + content/cdp/RecommendedPreferences.jsm (cdp/RecommendedPreferences.jsm) + content/cdp/StreamRegistry.jsm (cdp/StreamRegistry.jsm) # domains - content/domains/ContentProcessDomain.jsm (domains/ContentProcessDomain.jsm) - content/domains/ContentProcessDomains.jsm (domains/ContentProcessDomains.jsm) - content/domains/Domain.jsm (domains/Domain.jsm) - content/domains/DomainCache.jsm (domains/DomainCache.jsm) - content/domains/ParentProcessDomains.jsm (domains/ParentProcessDomains.jsm) - content/domains/content/DOM.jsm (domains/content/DOM.jsm) - content/domains/content/Emulation.jsm (domains/content/Emulation.jsm) - content/domains/content/Input.jsm (domains/content/Input.jsm) - content/domains/content/Log.jsm (domains/content/Log.jsm) - content/domains/content/Network.jsm (domains/content/Network.jsm) - content/domains/content/Page.jsm (domains/content/Page.jsm) - content/domains/content/Performance.jsm (domains/content/Performance.jsm) - content/domains/content/Runtime.jsm (domains/content/Runtime.jsm) - content/domains/content/runtime/ExecutionContext.jsm (domains/content/runtime/ExecutionContext.jsm) - content/domains/content/Security.jsm (domains/content/Security.jsm) - content/domains/parent/Browser.jsm (domains/parent/Browser.jsm) - content/domains/parent/Emulation.jsm (domains/parent/Emulation.jsm) - content/domains/parent/Input.jsm (domains/parent/Input.jsm) - content/domains/parent/IO.jsm (domains/parent/IO.jsm) - content/domains/parent/Network.jsm (domains/parent/Network.jsm) - content/domains/parent/Page.jsm (domains/parent/Page.jsm) - content/domains/parent/page/DialogHandler.jsm (domains/parent/page/DialogHandler.jsm) - content/domains/parent/Security.jsm (domains/parent/Security.jsm) - content/domains/parent/Target.jsm (domains/parent/Target.jsm) + content/cdp/domains/ContentProcessDomain.jsm (cdp/domains/ContentProcessDomain.jsm) + content/cdp/domains/ContentProcessDomains.jsm (cdp/domains/ContentProcessDomains.jsm) + content/cdp/domains/Domain.jsm (cdp/domains/Domain.jsm) + content/cdp/domains/DomainCache.jsm (cdp/domains/DomainCache.jsm) + content/cdp/domains/ParentProcessDomains.jsm (cdp/domains/ParentProcessDomains.jsm) + content/cdp/domains/content/DOM.jsm (cdp/domains/content/DOM.jsm) + content/cdp/domains/content/Emulation.jsm (cdp/domains/content/Emulation.jsm) + content/cdp/domains/content/Input.jsm (cdp/domains/content/Input.jsm) + content/cdp/domains/content/Log.jsm (cdp/domains/content/Log.jsm) + content/cdp/domains/content/Network.jsm (cdp/domains/content/Network.jsm) + content/cdp/domains/content/Page.jsm (cdp/domains/content/Page.jsm) + content/cdp/domains/content/Performance.jsm (cdp/domains/content/Performance.jsm) + content/cdp/domains/content/Runtime.jsm (cdp/domains/content/Runtime.jsm) + content/cdp/domains/content/runtime/ExecutionContext.jsm (cdp/domains/content/runtime/ExecutionContext.jsm) + content/cdp/domains/content/Security.jsm (cdp/domains/content/Security.jsm) + content/cdp/domains/parent/Browser.jsm (cdp/domains/parent/Browser.jsm) + content/cdp/domains/parent/Emulation.jsm (cdp/domains/parent/Emulation.jsm) + content/cdp/domains/parent/Input.jsm (cdp/domains/parent/Input.jsm) + content/cdp/domains/parent/IO.jsm (cdp/domains/parent/IO.jsm) + content/cdp/domains/parent/Network.jsm (cdp/domains/parent/Network.jsm) + content/cdp/domains/parent/Page.jsm (cdp/domains/parent/Page.jsm) + content/cdp/domains/parent/page/DialogHandler.jsm (cdp/domains/parent/page/DialogHandler.jsm) + content/cdp/domains/parent/Security.jsm (cdp/domains/parent/Security.jsm) + content/cdp/domains/parent/Target.jsm (cdp/domains/parent/Target.jsm) + # observers + content/cdp/observers/ChannelEventSink.jsm (cdp/observers/ChannelEventSink.jsm) + content/cdp/observers/ContextObserver.jsm (cdp/observers/ContextObserver.jsm) + content/cdp/observers/NetworkObserver.jsm (cdp/observers/NetworkObserver.jsm) + content/cdp/observers/TargetObserver.jsm (cdp/observers/TargetObserver.jsm) + # sessions + content/cdp/sessions/frame-script.js (cdp/sessions/frame-script.js) + content/cdp/sessions/ContentProcessSession.jsm (cdp/sessions/ContentProcessSession.jsm) + content/cdp/sessions/MainProcessSession.jsm (cdp/sessions/MainProcessSession.jsm) + content/cdp/sessions/Session.jsm (cdp/sessions/Session.jsm) + content/cdp/sessions/TabSession.jsm (cdp/sessions/TabSession.jsm) + # targets + content/cdp/targets/MainProcessTarget.jsm (cdp/targets/MainProcessTarget.jsm) + content/cdp/targets/TabTarget.jsm (cdp/targets/TabTarget.jsm) + content/cdp/targets/Target.jsm (cdp/targets/Target.jsm) + content/cdp/targets/TargetList.jsm (cdp/targets/TargetList.jsm) - # transport layer + # transport layer (http / websocket) content/server/HTTPD.jsm (../netwerk/test/httpserver/httpd.js) content/server/WebSocketHandshake.jsm (server/WebSocketHandshake.jsm) content/server/WebSocketTransport.jsm (server/WebSocketTransport.jsm) diff --git a/remote/moz.build b/remote/moz.build index 8de96753da08..bf59bb7f6d6c 100644 --- a/remote/moz.build +++ b/remote/moz.build @@ -9,30 +9,33 @@ DIRS += [ JAR_MANIFESTS += ["jar.mn"] +with Files("cdp/domains/**/Browser.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Browser") +with Files("cdp/domains/**/DOM.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: DOM") +with Files("cdp/domains/**/Emulation.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Emulation") +with Files("cdp/domains/**/Input.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Input") +with Files("cdp/domains/**/Log.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Log") +with Files("cdp/domains/**/Network.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Network") +with Files("cdp/domains/**/Page.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Page") +with Files("cdp/domains/**/Performance.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Performance") +with Files("cdp/domains/**/Runtime.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Runtime") +with Files("cdp/domains/**/Security.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Security") +with Files("cdp/domains/**/Target.jsm"): + BUG_COMPONENT = ("Remote Protocol", "CDP: Target") +with Files("cdp/**"): + BUG_COMPONENT = ("Remote Protocol", "CDP") + with Files("**"): BUG_COMPONENT = ("Remote Protocol", "Agent") -with Files("domains/**/Emulation.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Emulation") -with Files("domains/**/DOM.jsm"): - BUG_COMPONENT = ("Remote Protocol", "DOM") -with Files("domains/**/Input.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Input") -with Files("domains/**/Log.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Log") -with Files("domains/**/Network.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Network") -with Files("domains/**/Page.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Page") -with Files("domains/**/Performance.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Performance") -with Files("domains/**/Runtime.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Runtime") -with Files("domains/**/Security.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Security") -with Files("domains/**/Browser.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Browser") -with Files("domains/**/Target.jsm"): - BUG_COMPONENT = ("Remote Protocol", "Target") with Files("doc/**"): SCHEDULES.exclusive = ["docs"] diff --git a/remote/test/browser/head.js b/remote/test/browser/head.js index 4331dfc74394..86f21a66467f 100644 --- a/remote/test/browser/head.js +++ b/remote/test/browser/head.js @@ -9,7 +9,7 @@ const { RemoteAgent } = ChromeUtils.import( "chrome://remote/content/components/RemoteAgent.jsm" ); const { RemoteAgentError } = ChromeUtils.import( - "chrome://remote/content/Error.jsm" + "chrome://remote/content/cdp/Error.jsm" ); const TIMEOUT_MULTIPLIER = SpecialPowers.isDebugBuild ? 4 : 1; diff --git a/remote/test/browser/input/head.js b/remote/test/browser/input/head.js index 7bdc52685749..910532f85a30 100644 --- a/remote/test/browser/input/head.js +++ b/remote/test/browser/input/head.js @@ -11,7 +11,7 @@ Services.scriptloader.loadSubScript( ); const { Input: I } = ChromeUtils.import( - "chrome://remote/content/domains/parent/Input.jsm" + "chrome://remote/content/cdp/domains/parent/Input.jsm" ); const { alt, ctrl, meta, shift } = I.Modifier; diff --git a/remote/test/browser/io/head.js b/remote/test/browser/io/head.js index 566ef690ee4b..d3f530805a15 100644 --- a/remote/test/browser/io/head.js +++ b/remote/test/browser/io/head.js @@ -11,7 +11,7 @@ Services.scriptloader.loadSubScript( ); const { streamRegistry } = ChromeUtils.import( - "chrome://remote/content/domains/parent/IO.jsm" + "chrome://remote/content/cdp/domains/parent/IO.jsm" ); async function registerFileStream(contents, options = {}) { diff --git a/remote/test/unit/test_Connection.js b/remote/test/unit/test_Connection.js index 093daea338e1..2ca439046408 100644 --- a/remote/test/unit/test_Connection.js +++ b/remote/test/unit/test_Connection.js @@ -4,7 +4,7 @@ "use strict"; const { Connection } = ChromeUtils.import( - "chrome://remote/content/Connection.jsm" + "chrome://remote/content/cdp/Connection.jsm" ); add_test(function test_Connection_splitMethod() { diff --git a/remote/test/unit/test_DomainCache.js b/remote/test/unit/test_DomainCache.js index e54ebbc31475..33c29c481a13 100644 --- a/remote/test/unit/test_DomainCache.js +++ b/remote/test/unit/test_DomainCache.js @@ -4,10 +4,10 @@ "use strict"; const { Domain } = ChromeUtils.import( - "chrome://remote/content/domains/Domain.jsm" + "chrome://remote/content/cdp/domains/Domain.jsm" ); const { DomainCache } = ChromeUtils.import( - "chrome://remote/content/domains/DomainCache.jsm" + "chrome://remote/content/cdp/domains/DomainCache.jsm" ); class MockSession { diff --git a/remote/test/unit/test_Error.js b/remote/test/unit/test_Error.js index a4d81483d256..3d10b4b3d7d5 100644 --- a/remote/test/unit/test_Error.js +++ b/remote/test/unit/test_Error.js @@ -8,7 +8,7 @@ const { RemoteAgentError, UnknownMethodError, UnsupportedError, -} = ChromeUtils.import("chrome://remote/content/Error.jsm"); +} = ChromeUtils.import("chrome://remote/content/cdp/Error.jsm"); add_test(function test_RemoteAgentError_ctor() { const e1 = new RemoteAgentError(); diff --git a/remote/test/unit/test_Session.js b/remote/test/unit/test_Session.js index 65d1b8bcf840..85795a34ca64 100644 --- a/remote/test/unit/test_Session.js +++ b/remote/test/unit/test_Session.js @@ -4,7 +4,7 @@ "use strict"; const { Session } = ChromeUtils.import( - "chrome://remote/content/sessions/Session.jsm" + "chrome://remote/content/cdp/sessions/Session.jsm" ); const connection = { diff --git a/remote/test/unit/test_StreamRegistry.js b/remote/test/unit/test_StreamRegistry.js index ed6857754055..2a887f1580d2 100644 --- a/remote/test/unit/test_StreamRegistry.js +++ b/remote/test/unit/test_StreamRegistry.js @@ -10,7 +10,7 @@ const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { StreamRegistry } = ChromeUtils.import( - "chrome://remote/content/StreamRegistry.jsm" + "chrome://remote/content/cdp/StreamRegistry.jsm" ); add_test(function test_constructor() { diff --git a/tools/lint/rejected-words.yml b/tools/lint/rejected-words.yml index 39f33921678c..69a23f2215ef 100644 --- a/tools/lint/rejected-words.yml +++ b/tools/lint/rejected-words.yml @@ -282,7 +282,7 @@ avoid-blacklist-and-whitelist: - python/mozbuild/mozbuild/configure/options.py - python/mozbuild/mozbuild/vendor/moz_yaml.py - python/mozbuild/mozbuild/vendor/vendor_rust.py - - remote/Protocol.jsm + - remote/cdp/Protocol.jsm - security/certverifier/NSSCertDBTrustDomain.cpp - security/certverifier/TrustOverrideUtils.h - security/manager/ssl/DataStorageList.h