Skip to content

Commit

Permalink
Bug 1718052 - [marionette] Replace usage of marionette log.js by remo…
Browse files Browse the repository at this point in the history
…te/shared/Log.jsm r=webdriver-reviewers,whimboo

Depends on D119071

Differential Revision: https://phabricator.services.mozilla.com/D119072
  • Loading branch information
juliandescottes committed Jul 8, 2021
1 parent 5ec437a commit 138814b
Show file tree
Hide file tree
Showing 30 changed files with 147 additions and 132 deletions.
2 changes: 1 addition & 1 deletion remote/cdp/CDPConnection.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
WebSocketConnection: "chrome://remote/content/shared/WebSocketConnection.jsm",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get(Log.TYPES.CDP));

class CDPConnection extends WebSocketConnection {
/**
Expand Down
2 changes: 1 addition & 1 deletion remote/cdp/Error.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
Log: "chrome://remote/content/shared/Log.jsm",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get(Log.TYPES.CDP));

class RemoteAgentError extends Error {
constructor(message = "", cause = undefined) {
Expand Down
6 changes: 4 additions & 2 deletions remote/components/marionette.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ XPCOMUtils.defineLazyModuleGetters(this, {
ComponentUtils: "resource://gre/modules/ComponentUtils.jsm",

EnvironmentPrefs: "chrome://remote/content/marionette/prefs.js",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
MarionettePrefs: "chrome://remote/content/marionette/prefs.js",
Preferences: "resource://gre/modules/Preferences.jsm",
TCPListener: "chrome://remote/content/marionette/server.js",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

XPCOMUtils.defineLazyServiceGetter(
this,
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const { XPCOMUtils } = ChromeUtils.import(

XPCOMUtils.defineLazyModuleGetters(this, {
error: "chrome://remote/content/shared/webdriver/Errors.jsm",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

XPCOMUtils.defineLazyGetter(this, "service", () => {
try {
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/actors/MarionetteCommandsChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ XPCOMUtils.defineLazyModuleGetters(this, {
event: "chrome://remote/content/marionette/event.js",
interaction: "chrome://remote/content/marionette/interaction.js",
legacyaction: "chrome://remote/content/marionette/legacyaction.js",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
sandbox: "chrome://remote/content/marionette/evaluate.js",
Sandboxes: "chrome://remote/content/marionette/evaluate.js",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

let inputStateIsDirty = false;

Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/actors/MarionetteCommandsParent.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ XPCOMUtils.defineLazyModuleGetters(this, {
element: "chrome://remote/content/marionette/element.js",
error: "chrome://remote/content/shared/webdriver/Errors.jsm",
evaluate: "chrome://remote/content/marionette/evaluate.js",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);
XPCOMUtils.defineLazyGetter(this, "elementIdCache", () => {
return new element.ReferenceStore();
});
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/actors/MarionetteEventsChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ const { XPCOMUtils } = ChromeUtils.import(

XPCOMUtils.defineLazyModuleGetters(this, {
event: "chrome://remote/content/marionette/event.js",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
MarionettePrefs: "chrome://remote/content/marionette/prefs.js",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

XPCOMUtils.defineLazyGetter(this, "isTraceLevel", () => {
const StdLog = ChromeUtils.import("resource://gre/modules/Log.jsm").Log;
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/actors/MarionetteEventsParent.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ const { XPCOMUtils } = ChromeUtils.import(

XPCOMUtils.defineLazyModuleGetters(this, {
EventEmitter: "resource://gre/modules/EventEmitter.jsm",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

// Singleton to allow forwarding events to registered listeners.
const EventDispatcher = {
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/actors/MarionetteReftestChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ const { XPCOMUtils } = ChromeUtils.import(
);

XPCOMUtils.defineLazyModuleGetters(this, {
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

/**
* Child JSWindowActor to handle navigation for reftests relying on marionette.
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AppInfo: "chrome://remote/content/marionette/appinfo.js",
element: "chrome://remote/content/marionette/element.js",
error: "chrome://remote/content/shared/webdriver/Errors.jsm",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
MessageManagerDestroyedPromise: "chrome://remote/content/marionette/sync.js",
waitForEvent: "chrome://remote/content/marionette/sync.js",
WebElementEventTarget: "chrome://remote/content/marionette/dom.js",
windowManager: "chrome://remote/content/marionette/window-manager.js",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

/** @namespace */
this.browser = {};
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ const { XPCOMUtils } = ChromeUtils.import(
);

XPCOMUtils.defineLazyModuleGetters(this, {
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);
XPCOMUtils.defineLazyGlobalGetters(this, ["crypto"]);

const CONTEXT_2D = "2d";
Expand Down
17 changes: 8 additions & 9 deletions remote/marionette/doc/Prefs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ allow time for user to set breakpoints in the [Browser Toolbox].
[Browser Toolbox]: https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox


`marionette.log.level`
----------------------

Sets the verbosity level of the Marionette logger repository. Note
that this preference does not control the verbosity of other loggers
used in Firefox or Fennec.
`marionette.log.level` (deprecated)
-----------------------------------

The available levels are, in descending order of severity, `Trace`,
`debug`, `config`, `info`, `warn`, `error`, and `fatal`. The value
is treated case-insensitively.
This preference used to control the verbosity of the Marionette specific logger.
Marionette is now using the shared Remote logger, please see `remote.log.level`
in the [Remote Agent Preferences] documentation.


`marionette.log.truncate`
Expand Down Expand Up @@ -56,3 +52,6 @@ disabling auto-updates, Telemetry, and first-run UX.
The user preference file takes presedence over the recommended
preferences, meaning any user-defined preference value will not be
overridden.

[Remote Agent Preferences]: ../../remote/Prefs.html

4 changes: 0 additions & 4 deletions remote/marionette/doc/internals/log.rst

This file was deleted.

6 changes: 4 additions & 2 deletions remote/marionette/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ const { XPCOMUtils } = ChromeUtils.import(
);

XPCOMUtils.defineLazyModuleGetters(this, {
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

/**
* The ``EventTarget`` for web elements can be used to observe DOM
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.jsm",
IdlePromise: "chrome://remote/content/marionette/sync.js",
l10n: "chrome://remote/content/marionette/l10n.js",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
MarionettePrefs: "chrome://remote/content/marionette/prefs.js",
modal: "chrome://remote/content/marionette/modal.js",
navigate: "chrome://remote/content/marionette/navigate.js",
Expand Down Expand Up @@ -62,7 +62,9 @@ XPCOMUtils.defineLazyModuleGetters(this, {
WindowState: "chrome://remote/content/marionette/browser.js",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);

const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ XPCOMUtils.defineLazyModuleGetters(this, {
assert: "chrome://remote/content/marionette/assert.js",
element: "chrome://remote/content/marionette/element.js",
error: "chrome://remote/content/shared/webdriver/Errors.jsm",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
WebElement: "chrome://remote/content/marionette/element.js",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

const ARGUMENTS = "__webDriverArguments";
const CALLBACK = "__webDriverCallback";
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ const { XPCOMUtils } = ChromeUtils.import(
);

XPCOMUtils.defineLazyModuleGetters(this, {
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
MarionettePrefs: "chrome://remote/content/marionette/prefs.js",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

const ELEMENT_NODE = 1;
const MAX_STRING_LENGTH = 250;
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ XPCOMUtils.defineLazyModuleGetters(this, {
element: "chrome://remote/content/marionette/element.js",
error: "chrome://remote/content/shared/webdriver/Errors.jsm",
event: "chrome://remote/content/marionette/event.js",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
pprint: "chrome://remote/content/marionette/format.js",
TimedPromise: "chrome://remote/content/marionette/sync.js",
});

XPCOMUtils.defineLazyGlobalGetters(this, ["File"]);

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

/** XUL elements that support disabled attribute. */
const DISABLED_ATTRIBUTE_SUPPORTED_XUL = new Set([
Expand Down
1 change: 0 additions & 1 deletion remote/marionette/jar.mn
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ remote.jar:
content/marionette/interaction.js (interaction.js)
content/marionette/l10n.js (l10n.js)
content/marionette/legacyaction.js (legacyaction.js)
content/marionette/log.js (log.js)
content/marionette/message.js (message.js)
content/marionette/modal.js (modal.js)
content/marionette/navigate.js (navigate.js)
Expand Down
6 changes: 4 additions & 2 deletions remote/marionette/legacyaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ XPCOMUtils.defineLazyModuleGetters(this, {
error: "chrome://remote/content/shared/webdriver/Errors.jsm",
evaluate: "chrome://remote/content/marionette/evaluate.js",
event: "chrome://remote/content/marionette/event.js",
Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
WebElement: "chrome://remote/content/marionette/element.js",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

const CONTEXT_MENU_DELAY_PREF = "ui.click_hold_context_menus.delay";
const DEFAULT_CONTEXT_MENU_DELAY = 750; // ms
Expand Down
66 changes: 0 additions & 66 deletions remote/marionette/log.js

This file was deleted.

6 changes: 4 additions & 2 deletions remote/marionette/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const { XPCOMUtils } = ChromeUtils.import(
XPCOMUtils.defineLazyModuleGetters(this, {
Services: "resource://gre/modules/Services.jsm",

Log: "chrome://remote/content/marionette/log.js",
Log: "chrome://remote/content/shared/Log.jsm",
});

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "logger", () =>
Log.get(Log.TYPES.MARIONETTE)
);

const COMMON_DIALOG = "chrome://global/content/commonDialog.xhtml";

Expand Down
Loading

0 comments on commit 138814b

Please sign in to comment.