mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
Bug 912121 - Create shims for popular DevTools modules in add-ons. rs=devtools
For popular modules used by many DevTools add-ons, add shim files which wrap the modules and make them available at their previous location. Each shim includes a deprecation warning to make devs and users aware of the issue. --HG-- rename : devtools/server/dbg-server.jsm => devtools/server/shims/dbg-server.jsm rename : devtools/shared/client/dbg-client.jsm => devtools/shared/shims/dbg-client.jsm extra : commitid : H7Y9k2ADf0u extra : rebase_source : 2bd193ecd4f2baeb8b14c14c63884d3a318a0840
This commit is contained in:
parent
4f1af0e003
commit
2236dbad11
@ -27,6 +27,7 @@ DIRS += [
|
||||
'scratchpad',
|
||||
'shadereditor',
|
||||
'shared',
|
||||
'shims',
|
||||
'sourceeditor',
|
||||
'storage',
|
||||
'styleeditor',
|
||||
|
36
devtools/client/shims/gDevTools.jsm
Normal file
36
devtools/client/shims/gDevTools.jsm
Normal file
@ -0,0 +1,36 @@
|
||||
/* 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";
|
||||
|
||||
/**
|
||||
* This file only exists to support add-ons which import this module at a
|
||||
* specific path.
|
||||
*/
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
const WARNING_PREF = "devtools.migration.warnings";
|
||||
if (Services.prefs.getBoolPref(WARNING_PREF)) {
|
||||
const { Deprecated } = Cu.import("resource://gre/modules/Deprecated.jsm", {});
|
||||
Deprecated.warning("This path to gDevTools.jsm is deprecated. Please use " +
|
||||
"Cu.import(\"resource:///modules/devtools/client/" +
|
||||
"framework/gDevTools.jsm\") to load this module.",
|
||||
"https://bugzil.la/912121");
|
||||
}
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"gDevTools",
|
||||
"DevTools",
|
||||
"gDevToolsBrowser"
|
||||
];
|
||||
|
||||
const module =
|
||||
Cu.import("resource:///modules/devtools/client/framework/gDevTools.jsm", {});
|
||||
|
||||
for (let symbol of this.EXPORTED_SYMBOLS) {
|
||||
this[symbol] = module[symbol];
|
||||
}
|
13
devtools/client/shims/moz.build
Normal file
13
devtools/client/shims/moz.build
Normal file
@ -0,0 +1,13 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
# Unlike most DevTools build files, this file does not use DevToolsModules
|
||||
# because these files are here for add-on compatibility, and so they must be
|
||||
# installed to previously defined locations.
|
||||
|
||||
EXTRA_JS_MODULES.devtools += [
|
||||
'gDevTools.jsm',
|
||||
]
|
@ -1,26 +0,0 @@
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* 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";
|
||||
/**
|
||||
* Loads the remote debugging protocol code into a sandbox, in order to
|
||||
* shield it from the debuggee. This way, when debugging chrome globals,
|
||||
* debugger and debuggee will be in separate compartments.
|
||||
*/
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { require } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["DebuggerServer", "ActorPool"];
|
||||
|
||||
var server = require("devtools/server/main");
|
||||
|
||||
this.DebuggerServer = server.DebuggerServer;
|
||||
this.ActorPool = server.ActorPool;
|
||||
this.OriginalLocation = server.OriginalLocation;
|
@ -8,6 +8,7 @@ include('../templates.mozbuild')
|
||||
|
||||
DIRS += [
|
||||
'actors',
|
||||
'shims',
|
||||
]
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini']
|
||||
@ -30,7 +31,6 @@ DevToolsModules(
|
||||
'child.js',
|
||||
'content-globals.js',
|
||||
'content-server.jsm',
|
||||
'dbg-server.jsm',
|
||||
'main.js',
|
||||
'protocol.js',
|
||||
'worker.js'
|
||||
|
37
devtools/server/shims/dbg-server.jsm
Normal file
37
devtools/server/shims/dbg-server.jsm
Normal file
@ -0,0 +1,37 @@
|
||||
/* 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";
|
||||
|
||||
/**
|
||||
* This file only exists to support add-ons which import this module at a
|
||||
* specific path.
|
||||
*/
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
const WARNING_PREF = "devtools.migration.warnings";
|
||||
if (Services.prefs.getBoolPref(WARNING_PREF)) {
|
||||
const { Deprecated } = Cu.import("resource://gre/modules/Deprecated.jsm", {});
|
||||
Deprecated.warning("dbg-server.jsm is deprecated. Please use " +
|
||||
"require(\"devtools/server/main\") to load this " +
|
||||
"module.",
|
||||
"https://bugzil.la/912121");
|
||||
}
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"DebuggerServer",
|
||||
"ActorPool",
|
||||
"OriginalLocation",
|
||||
];
|
||||
|
||||
const { require } =
|
||||
Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
|
||||
const module = require("devtools/server/main");
|
||||
|
||||
for (let symbol of this.EXPORTED_SYMBOLS) {
|
||||
this[symbol] = module[symbol];
|
||||
}
|
13
devtools/server/shims/moz.build
Normal file
13
devtools/server/shims/moz.build
Normal file
@ -0,0 +1,13 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
# Unlike most DevTools build files, this file does not use DevToolsModules
|
||||
# because these files are here for add-on compatibility, and so they must be
|
||||
# installed to previously defined locations.
|
||||
|
||||
EXTRA_JS_MODULES.devtools += [
|
||||
'dbg-server.jsm',
|
||||
]
|
@ -1,29 +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";
|
||||
|
||||
// Just a compatibility wrapper for addons that are used
|
||||
// to import the jsm instead of the js module
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { require } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["DebuggerTransport",
|
||||
"DebuggerClient",
|
||||
"RootClient",
|
||||
"LongStringClient",
|
||||
"EnvironmentClient",
|
||||
"ObjectClient"];
|
||||
|
||||
var client = require("devtools/shared/client/main");
|
||||
|
||||
this.DebuggerClient = client.DebuggerClient;
|
||||
this.RootClient = client.RootClient;
|
||||
this.LongStringClient = client.LongStringClient;
|
||||
this.EnvironmentClient = client.EnvironmentClient;
|
||||
this.ObjectClient = client.ObjectClient;
|
||||
|
||||
this.DebuggerTransport = require("devtools/shared/transport/transport").DebuggerTransport;
|
@ -6,6 +6,5 @@
|
||||
|
||||
DevToolsModules(
|
||||
'connection-manager.js',
|
||||
'dbg-client.jsm',
|
||||
'main.js',
|
||||
)
|
||||
|
@ -21,6 +21,7 @@ DIRS += [
|
||||
'security',
|
||||
'sourcemap',
|
||||
'shared',
|
||||
'shims',
|
||||
'styleinspector',
|
||||
'tern',
|
||||
'touch',
|
||||
|
35
devtools/shared/shims/Console.jsm
Normal file
35
devtools/shared/shims/Console.jsm
Normal file
@ -0,0 +1,35 @@
|
||||
/* 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";
|
||||
|
||||
/**
|
||||
* This file only exists to support add-ons which import this module at a
|
||||
* specific path.
|
||||
*/
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
const WARNING_PREF = "devtools.migration.warnings";
|
||||
if (Services.prefs.getBoolPref(WARNING_PREF)) {
|
||||
const { Deprecated } = Cu.import("resource://gre/modules/Deprecated.jsm", {});
|
||||
Deprecated.warning("This path to Console.jsm is deprecated. Please use " +
|
||||
"Cu.import(\"resource://gre/modules/devtools/shared/" +
|
||||
"Console.jsm\") to load this module.",
|
||||
"https://bugzil.la/912121");
|
||||
}
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"console",
|
||||
"ConsoleAPI"
|
||||
];
|
||||
|
||||
const module =
|
||||
Cu.import("resource://gre/modules/devtools/shared/Console.jsm", {});
|
||||
|
||||
for (let symbol of this.EXPORTED_SYMBOLS) {
|
||||
this[symbol] = module[symbol];
|
||||
}
|
39
devtools/shared/shims/Loader.jsm
Normal file
39
devtools/shared/shims/Loader.jsm
Normal file
@ -0,0 +1,39 @@
|
||||
/* 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";
|
||||
|
||||
/**
|
||||
* This file only exists to support add-ons which import this module at a
|
||||
* specific path.
|
||||
*/
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
const WARNING_PREF = "devtools.migration.warnings";
|
||||
if (Services.prefs.getBoolPref(WARNING_PREF)) {
|
||||
const { Deprecated } = Cu.import("resource://gre/modules/Deprecated.jsm", {});
|
||||
Deprecated.warning("This path to Loader.jsm is deprecated. Please use " +
|
||||
"Cu.import(\"resource://gre/modules/devtools/shared/" +
|
||||
"Loader.jsm\") to load this module.",
|
||||
"https://bugzil.la/912121");
|
||||
}
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"DevToolsLoader",
|
||||
"devtools",
|
||||
"BuiltinProvider",
|
||||
"SrcdirProvider",
|
||||
"require",
|
||||
"loader"
|
||||
];
|
||||
|
||||
const module =
|
||||
Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
|
||||
|
||||
for (let symbol of this.EXPORTED_SYMBOLS) {
|
||||
this[symbol] = module[symbol];
|
||||
}
|
34
devtools/shared/shims/Simulator.jsm
Normal file
34
devtools/shared/shims/Simulator.jsm
Normal file
@ -0,0 +1,34 @@
|
||||
/* 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";
|
||||
|
||||
/**
|
||||
* This file only exists to support add-ons which import this module at a
|
||||
* specific path.
|
||||
*/
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
const WARNING_PREF = "devtools.migration.warnings";
|
||||
if (Services.prefs.getBoolPref(WARNING_PREF)) {
|
||||
const { Deprecated } = Cu.import("resource://gre/modules/Deprecated.jsm", {});
|
||||
Deprecated.warning("This path to Simulator.jsm is deprecated. Please use " +
|
||||
"Cu.import(\"resource://gre/modules/devtools/shared/" +
|
||||
"apps/Simulator.jsm\") to load this module.",
|
||||
"https://bugzil.la/912121");
|
||||
}
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"Simulator",
|
||||
];
|
||||
|
||||
const module =
|
||||
Cu.import("resource://gre/modules/devtools/shared/apps/Simulator.jsm", {});
|
||||
|
||||
for (let symbol of this.EXPORTED_SYMBOLS) {
|
||||
this[symbol] = module[symbol];
|
||||
}
|
43
devtools/shared/shims/dbg-client.jsm
Normal file
43
devtools/shared/shims/dbg-client.jsm
Normal file
@ -0,0 +1,43 @@
|
||||
/* 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";
|
||||
|
||||
/**
|
||||
* This file only exists to support add-ons which import this module at a
|
||||
* specific path.
|
||||
*/
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
const WARNING_PREF = "devtools.migration.warnings";
|
||||
if (Services.prefs.getBoolPref(WARNING_PREF)) {
|
||||
const { Deprecated } = Cu.import("resource://gre/modules/Deprecated.jsm", {});
|
||||
Deprecated.warning("dbg-client.jsm is deprecated. Please use " +
|
||||
"require(\"devtools/shared/client/main\") to load this " +
|
||||
"module.", "https://bugzil.la/912121");
|
||||
}
|
||||
|
||||
const { require } =
|
||||
Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["DebuggerTransport",
|
||||
"DebuggerClient",
|
||||
"RootClient",
|
||||
"LongStringClient",
|
||||
"EnvironmentClient",
|
||||
"ObjectClient"];
|
||||
|
||||
let client = require("devtools/shared/client/main");
|
||||
|
||||
this.DebuggerClient = client.DebuggerClient;
|
||||
this.RootClient = client.RootClient;
|
||||
this.LongStringClient = client.LongStringClient;
|
||||
this.EnvironmentClient = client.EnvironmentClient;
|
||||
this.ObjectClient = client.ObjectClient;
|
||||
|
||||
this.DebuggerTransport =
|
||||
require("devtools/shared/transport/transport").DebuggerTransport;
|
42
devtools/shared/shims/event-emitter.js
Normal file
42
devtools/shared/shims/event-emitter.js
Normal file
@ -0,0 +1,42 @@
|
||||
/* 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";
|
||||
|
||||
/**
|
||||
* This file only exists to support add-ons which import this module at a
|
||||
* specific path.
|
||||
*/
|
||||
|
||||
(function (factory) { // Module boilerplate
|
||||
if (this.module && module.id.indexOf("event-emitter") >= 0) { // require
|
||||
factory.call(this, require, exports, module);
|
||||
} else { // Cu.import
|
||||
const Cu = Components.utils;
|
||||
const { require } =
|
||||
Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
|
||||
this.isWorker = false;
|
||||
this.promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
|
||||
factory.call(this, require, this, { exports: this });
|
||||
this.EXPORTED_SYMBOLS = ["EventEmitter"];
|
||||
}
|
||||
}).call(this, function (require, exports, module) {
|
||||
const { Cu } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const WARNING_PREF = "devtools.migration.warnings";
|
||||
// Cu and Services aren't accessible from workers
|
||||
if (Cu && Services && Services.prefs &&
|
||||
Services.prefs.getBoolPref(WARNING_PREF)) {
|
||||
const { Deprecated } =
|
||||
Cu.import("resource://gre/modules/Deprecated.jsm", {});
|
||||
Deprecated.warning("This path to event-emitter.js is deprecated. Please " +
|
||||
"use require(\"devtools/shared/event-emitter\") to " +
|
||||
"load this module.",
|
||||
"https://bugzil.la/912121");
|
||||
}
|
||||
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
this.EventEmitter = EventEmitter;
|
||||
module.exports = EventEmitter;
|
||||
});
|
17
devtools/shared/shims/moz.build
Normal file
17
devtools/shared/shims/moz.build
Normal file
@ -0,0 +1,17 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
# Unlike most DevTools build files, this file does not use DevToolsModules
|
||||
# because these files are here for add-on compatibility, and so they must be
|
||||
# installed to previously defined locations.
|
||||
|
||||
EXTRA_JS_MODULES.devtools += [
|
||||
'Console.jsm',
|
||||
'dbg-client.jsm',
|
||||
'event-emitter.js',
|
||||
'Loader.jsm',
|
||||
'Simulator.jsm',
|
||||
]
|
@ -19,8 +19,9 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
const DEBUGGER_USB_ENABLED = "devtools.remote.usb.enabled";
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
const { DebuggerServer } =
|
||||
Cu.import("resource://gre/modules/devtools/server/dbg-server.jsm", {});
|
||||
const { require } =
|
||||
Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
|
||||
const { DebuggerServer } = require("devtools/server/main");
|
||||
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
|
@ -894,6 +894,10 @@ pref("devtools.commands.dir", "");
|
||||
// Allows setting the performance marks for which telemetry metrics will be recorded.
|
||||
pref("devtools.telemetry.supported_performance_marks", "contentInteractive,navigationInteractive,navigationLoaded,visuallyLoaded,fullyLoaded,mediaEnumerated,scanEnd");
|
||||
|
||||
// Deprecation warnings after DevTools file migration. Bug 1204127 tracks
|
||||
// enabling this.
|
||||
pref("devtools.migration.warnings", false);
|
||||
|
||||
// view source
|
||||
pref("view_source.syntax_highlight", true);
|
||||
pref("view_source.wrap_long_lines", false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user