зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1561565 - Add linting rule and update documentation for setupInParent r=ochameau,yulia,Standard8
Differential Revision: https://phabricator.services.mozilla.com/D36003 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ff9ddc0bc1
Коммит
91b274be5b
|
@ -320,6 +320,11 @@ module.exports = {
|
|||
"no-regex-spaces": "off",
|
||||
// Don't restrict usage of specified node modules (not a node environment).
|
||||
"no-restricted-modules": "off",
|
||||
// Prevent using some properties
|
||||
"no-restricted-properties": ["error", {
|
||||
"property": "setupInParent",
|
||||
"message": "avoid child/parent communication with setupInParent"
|
||||
}],
|
||||
// Disallow use of assignment in return statement. It is preferable for a
|
||||
// single line of code to have only one easily predictable effect.
|
||||
"no-return-assign": "error",
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
In multi-process environments, most devtools actors are created and initialized in the child content process, to be able to access the resources they are exposing to the toolbox. But sometimes, these actors need to access things in the parent process too. Here's why and how.
|
||||
|
||||
{% hint style="error" %}
|
||||
|
||||
This documentation page is **deprecated**. `setupInParent` relies on the message manager which is being deprecated. Furthermore, communications between parent and content processes should be avoided for security reasons. If possible, the client should be responsible for calling actors both on the parent and content process.
|
||||
|
||||
This page will be removed when all actors relying on this API are removed.
|
||||
|
||||
{% endhint %}
|
||||
|
||||
## Use case and examples
|
||||
|
||||
Some actors need to exchange messages between the parent and the child process (typically when some components aren't available in the child process).
|
||||
|
|
|
@ -28,6 +28,7 @@ const AccessibilityActor = ActorClassWithSpec(accessibilitySpec, {
|
|||
|
||||
if (DebuggerServer.isInChildProcess) {
|
||||
this._msgName = `debug:${this.conn.prefix}accessibility`;
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
this.conn.setupInParent({
|
||||
module: "devtools/server/actors/accessibility/accessibility-parent",
|
||||
setupParent: "setupParentProcess",
|
||||
|
|
|
@ -751,6 +751,7 @@ StorageActors.createActor({
|
|||
|
||||
const mm = this.conn.parentMessageManager;
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
this.conn.setupInParent({
|
||||
module: "devtools/server/actors/storage",
|
||||
setupParent: "setupParentProcessForCookies",
|
||||
|
@ -1877,6 +1878,7 @@ StorageActors.createActor({
|
|||
|
||||
const mm = this.conn.parentMessageManager;
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
this.conn.setupInParent({
|
||||
module: "devtools/server/actors/storage",
|
||||
setupParent: "setupParentProcessForIndexedDB",
|
||||
|
|
|
@ -12,6 +12,7 @@ exports.callParent = function() {
|
|||
// Hack! Fetch DebuggerServerConnection objects directly within DebuggerServer guts.
|
||||
for (const id in DebuggerServer._connections) {
|
||||
const conn = DebuggerServer._connections[id];
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
conn.setupInParent({
|
||||
module: "chrome://mochitests/content/chrome/devtools/server/tests/mochitest/setup-in-parent.js",
|
||||
setupParent: "setupParent",
|
||||
|
|
Загрузка…
Ссылка в новой задаче