bug 1523104: remote: stop binding JSM exported globals on this; r=ato

This was breaking the constructor name, used in Domain.jsm.
As doing

	this.Foo = class extends Domain {

creates a class with undefined constructor name.
While

	class Foo extends Domain {

creates a class with "Foo" as domain name.
This commit is contained in:
Alexandre Poirot 2019-02-12 05:58:23 -08:00 committed by Andreas Tolfsen
parent c8e61d4d7e
commit 326eeff61c
22 changed files with 32 additions and 32 deletions

View File

@ -18,7 +18,7 @@ XPCOMUtils.defineLazyGetter(this, "log", Log.get);
// TODO(ato):
// This used to have more stuff on it, but now only really does logging,
// and I'm sure there's a better way to get the message manager logs.
this.RemoteAgentActorChild = class extends ActorChild {
class RemoteAgentActorChild extends ActorChild {
get browsingContext() {
return this.docShell.browsingContext;
}
@ -37,7 +37,7 @@ this.RemoteAgentActorChild = class extends ActorChild {
// TODO(ato): Move to MessageChannel.jsm?
// TODO(ato): This can eventually be replaced by ActorChild and IPDL generation
// TODO(ato): Can we find a shorter name?
this.MessageChannelActorChild = class extends RemoteAgentActorChild {
class MessageChannelActorChild extends RemoteAgentActorChild {
constructor(dispatcher) {
super(dispatcher);
this.name = `RemoteAgent:${this.constructor.name}`;

View File

@ -6,7 +6,7 @@
var EXPORTED_SYMBOLS = ["AtomicMap"];
this.AtomicMap = class extends Map {
class AtomicMap extends Map {
set(key, value) {
if (this.has(key)) {
throw new RangeError("Key already used: " + key);

View File

@ -11,7 +11,7 @@ const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm")
XPCOMUtils.defineLazyGetter(this, "log", Log.get);
this.Connection = class {
class Connection {
constructor(connID, transport, socketListener) {
this.id = connID;
this.transport = transport;

View File

@ -8,7 +8,7 @@ var EXPORTED_SYMBOLS = ["ConsoleServiceObserver"];
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
this.ConsoleServiceObserver = class {
class ConsoleServiceObserver {
constructor() {
this.running = false;
}

View File

@ -9,7 +9,7 @@ var EXPORTED_SYMBOLS = ["Domain"];
const {EventEmitter} = ChromeUtils.import("chrome://remote/content/EventEmitter.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
this.Domain = class {
class Domain {
constructor(session, target) {
this.session = session;
this.target = target;

View File

@ -34,7 +34,7 @@ class RemoteAgentError extends Error {
*
* Constructing this error will cause the application to quit.
*/
this.FatalError = class extends RemoteAgentError {
class FatalError extends RemoteAgentError {
constructor(...args) {
super(...args);
this.quit();
@ -49,7 +49,7 @@ this.FatalError = class extends RemoteAgentError {
}
};
this.UnsupportedError = class extends RemoteAgentError {};
class UnsupportedError extends RemoteAgentError {};
function formatError(error, {stack = false} = {}) {
const s = [];

View File

@ -12,7 +12,7 @@ const ONCE_ORIGINAL_LISTENER = Symbol("EventEmitter/once-original-listener");
const BAD_LISTENER = "Listener must be a function " +
"or an object that has an onevent function";
this.EventEmitter = class {
class EventEmitter {
constructor() {
this.listeners = new Map();
}

View File

@ -39,7 +39,7 @@ class JSONHandler extends Handler {
}
}
this.TargetListHandler = class extends JSONHandler {
class TargetListHandler extends JSONHandler {
constructor(targets) {
super();
this.targets = targets;
@ -54,7 +54,7 @@ this.TargetListHandler = class extends JSONHandler {
}
};
this.ProtocolHandler = class extends JSONHandler {
class ProtocolHandler extends JSONHandler {
get path() {
return "/json/protocol";
}

View File

@ -7,7 +7,7 @@
var EXPORTED_SYMBOLS = ["Log"];
/** E10s compatible wrapper for the standard logger from Log.jsm. */
this.Log = class {
class Log {
static get() {
const StdLog = ChromeUtils.import("resource://gre/modules/Log.jsm").Log;
const logger = StdLog.repository.getLogger("RemoteAgent");

View File

@ -13,7 +13,7 @@ const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm")
XPCOMUtils.defineLazyGetter(this, "log", Log.get);
this.MessageChannel = class {
class MessageChannel {
constructor(target, channelName, messageManager) {
this.target = target;
this.name = channelName;

View File

@ -8,7 +8,7 @@ var EXPORTED_SYMBOLS = ["Observer"];
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
this.Observer = class {
class Observer {
static observe(type, observer) {
Services.obs.addObserver(observer, type);
}

View File

@ -5,7 +5,7 @@ var EXPORTED_SYMBOLS = [
"t",
];
this.t = {
var t = {
String: x => typeof x == "string" || x instanceof String,
Number: x => typeof x == "number",
Boolean: x => typeof x == "boolean",
@ -17404,7 +17404,7 @@ const Description = {
}
};
this.Protocol = {
var Protocol = {
checkSchema,
Description,
};

View File

@ -10,7 +10,7 @@ const {Domain} = ChromeUtils.import("chrome://remote/content/Domain.jsm");
const {formatError} = ChromeUtils.import("chrome://remote/content/Error.jsm");
const {Protocol} = ChromeUtils.import("chrome://remote/content/Protocol.jsm");
this.Session = class {
class Session {
constructor(connection, target) {
this.connection = connection;
this.target = target;

View File

@ -20,7 +20,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "Favicons",
* Targets can be a document (page), an OOP frame, a background
* document, or a worker. They can all run in dedicated process or frame.
*/
this.Target = class {
class Target {
constructor(browser) {
this.browser = browser;
this.debugger = new TargetListener(this);

View File

@ -19,7 +19,7 @@ const {SocketListener} = ChromeUtils.import("chrome://remote/content/server/Sock
* There can be multiple sessions per target.
* The session's lifetime is equal to the lifetime of the debugger connection.
*/
this.TargetListener = class {
class TargetListener {
constructor(target) {
this.target = target;
this.listener = null;

View File

@ -41,7 +41,7 @@ XPCOMUtils.defineLazyGetter(this, "log", Log.get);
* The WindowObserver.Event.Open event fires when a window opens.
* The WindowObserver.Event.Close event fires when a window closes.
*/
this.WindowObserver = class {
class WindowObserver {
/**
* @param {boolean?} [false] registerExisting
* Events will be despatched for the ChromeWindows that exist
@ -96,7 +96,7 @@ this.WindowObserver = class {
* "open" fires when a tab opens.
* "close" fires when a tab closes.
*/
this.TabObserver = class {
class TabObserver {
/**
* @param {boolean?} [false] registerExisting
* Events will be fired for ChromeWIndows and their respective tabs
@ -156,7 +156,7 @@ this.TabObserver = class {
* but leave it in here because we may have use for it later
* if we decide to allow Marionette-style chrome automation.
*/
this.BrowserObserver = class {
class BrowserObserver {
constructor() {
EventEmitter.decorate(this);
}
@ -243,4 +243,4 @@ function isWindowIncluded(boundary, target) {
return isWindowIncluded(boundary, parent);
}
this.WindowManager = {isWindowIncluded};
var WindowManager = {isWindowIncluded};

View File

@ -8,7 +8,7 @@ var EXPORTED_SYMBOLS = ["DOMChild"];
const {RemoteAgentActorChild} = ChromeUtils.import("chrome://remote/content/Actor.jsm");
this.DOMChild = class extends RemoteAgentActorChild {
class DOMChild extends RemoteAgentActorChild {
handleEvent({type}) {
const event = {
type,

View File

@ -10,7 +10,7 @@ const {RemoteAgentActorChild} = ChromeUtils.import("chrome://remote/content/Acto
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {WindowManager} = ChromeUtils.import("chrome://remote/content/WindowManager.jsm");
this.LogChild = class extends RemoteAgentActorChild {
class LogChild extends RemoteAgentActorChild {
observe(subject, topic) {
const event = subject.wrappedJSObject;

View File

@ -35,7 +35,7 @@ const ALLOWED_LEVELS = [
"error",
];
this.Log = class extends Domain {
class Log extends Domain {
constructor(session, target) {
super(session, target);
this.enabled = false;
@ -93,7 +93,7 @@ this.Log = class extends Domain {
}
};
this.Log.LogEntry = {
Log.LogEntry = {
schema: {
source: t.Enum(ALLOWED_SOURCES),
level: t.Enum(ALLOWED_LEVELS),

View File

@ -8,7 +8,7 @@ var EXPORTED_SYMBOLS = ["Network"];
const {t} = ChromeUtils.import("chrome://remote/content/Protocol.jsm");
this.Network = {
var Network = {
MonotonicTime: {schema: t.Number},
LoaderId: {schema: t.String},
RequestId: {schema: t.Number},

View File

@ -11,7 +11,7 @@ const {t} = ChromeUtils.import("chrome://remote/content/Protocol.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {UnsupportedError} = ChromeUtils.import("chrome://remote/content/Error.jsm");
this.Page = class extends Domain {
class Page extends Domain {
constructor(session, target) {
super(session, target);
this.enabled = false;
@ -116,8 +116,8 @@ this.Page = class extends Domain {
}
};
this.Page.FrameId = {schema: t.String};
this.Page.TransitionType = {
Page.FrameId = {schema: t.String};
Page.TransitionType = {
schema: t.Enum([
"auto_bookmark",
"auto_subframe",

View File

@ -8,7 +8,7 @@ var EXPORTED_SYMBOLS = ["Runtime"];
const {t} = ChromeUtils.import("chrome://remote/content/Protocol.jsm");
this.Runtime = {
var Runtime = {
StackTrace: {schema: t.String},
RemoteObject: {