Backed out 4 changesets (bug 1374735) for test_ext_i18n.js failures on a CLOSED TREE.

Backed out changeset 50a36fb7c7f9 (bug 1374735)
Backed out changeset da075933f7bc (bug 1374735)
Backed out changeset b7435cd66ce3 (bug 1374735)
Backed out changeset 22baf4e67730 (bug 1374735)
This commit is contained in:
Ryan VanderMeulen 2017-08-18 12:34:22 -04:00
parent aadc647248
commit b708734864
6 changed files with 15 additions and 35 deletions

View File

@ -4,15 +4,16 @@
/* global getDevToolsTargetForContext */
XPCOMUtils.defineLazyModuleGetter(this, "DevToolsShim",
"chrome://devtools-shim/content/DevToolsShim.jsm");
var {
SpreadArgs,
} = ExtensionCommon;
this.devtools_inspectedWindow = class extends ExtensionAPI {
getAPI(context) {
const {
WebExtensionInspectedWindowFront,
} = require("devtools/shared/fronts/webextension-inspected-window");
// Lazily retrieve and store an inspectedWindow actor front per child context.
let waitForInspectedWindowFront;
async function getInspectedWindowFront() {
@ -21,7 +22,7 @@ this.devtools_inspectedWindow = class extends ExtensionAPI {
// because the first time that the target has been cloned, it is not ready to be used to create
// the front instance until it is connected to the remote debugger successfully).
const clonedTarget = await getDevToolsTargetForContext(context);
return DevToolsShim.createWebExtensionInspectedWindowFront(clonedTarget);
return new WebExtensionInspectedWindowFront(clonedTarget.client, clonedTarget.form);
}
function getToolboxOptions() {

View File

@ -53,8 +53,9 @@ global.getDevToolsTargetForContext = async (context) => {
throw new Error("Unexpected target type: only local tabs are currently supported.");
}
const tab = context.devToolsToolbox.target.tab;
context.devToolsTarget = DevToolsShim.getTargetForTab(tab);
const {TabTarget} = require("devtools/client/framework/target");
context.devToolsTarget = new TabTarget(context.devToolsToolbox.target.tab);
await context.devToolsTarget.makeRemote();
return context.devToolsTarget;

View File

@ -22,9 +22,6 @@ loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/main", true);
loader.lazyImporter(this, "BrowserToolboxProcess", "resource://devtools/client/framework/ToolboxProcess.jsm");
loader.lazyRequireGetter(this, "WebExtensionInspectedWindowFront",
"devtools/shared/fronts/webextension-inspected-window", true);
const {defaultTools: DefaultTools, defaultThemes: DefaultThemes} =
require("devtools/client/definitions");
const EventEmitter = require("devtools/shared/old-event-emitter");
@ -582,23 +579,6 @@ DevTools.prototype = {
BrowserToolboxProcess.init({ addonID });
},
/**
* Compatibility layer for web-extensions. Used by DevToolsShim for
* browser/components/extensions/ext-devtools-inspectedWindow.js
*/
createWebExtensionInspectedWindowFront: function (tabTarget) {
return new WebExtensionInspectedWindowFront(tabTarget.client, tabTarget.form);
},
/**
* Compatibility layer for web-extensions. Used by DevToolsShim for
* toolkit/components/extensions/ext-c-toolkit.js
*/
openBrowserConsole: function () {
let {HUDService} = require("devtools/client/webconsole/hudservice");
HUDService.openBrowserConsoleOrFocus();
},
/**
* Called from the DevToolsShim, used by nsContextMenu.js.
*

View File

@ -286,6 +286,7 @@ let addonSdkMethods = [
"closeToolbox",
"connectDebuggerServer",
"createDebuggerClient",
"getTargetForTab",
"getToolbox",
"initBrowserToolboxProcessForAddon",
"showToolbox",
@ -298,10 +299,7 @@ let addonSdkMethods = [
* therefore DevTools should always be available when they are called.
*/
let webExtensionsMethods = [
"createWebExtensionInspectedWindowFront",
"getTargetForTab",
"getTheme",
"openBrowserConsole",
];
for (let method of [...addonSdkMethods, ...webExtensionsMethods]) {

View File

@ -1262,6 +1262,7 @@ class SchemaAPIManager extends EventEmitter {
XPCOMUtils.defineLazyModuleGetters(global, {
ExtensionUtils: "resource://gre/modules/ExtensionUtils.jsm",
XPCOMUtils: "resource://gre/modules/XPCOMUtils.jsm",
require: "resource://devtools/shared/Loader.jsm",
});
return global;

View File

@ -2,11 +2,6 @@
Cu.import("resource://gre/modules/ExtensionCommon.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DevToolsShim",
"chrome://devtools-shim/content/DevToolsShim.jsm");
// These are defined on "global" which is used for the same scopes as the other
// ext-c-*.js files.
/* exported EventManager */
@ -21,7 +16,11 @@ global.initializeBackgroundPage = (contentWindow) => {
let alertDisplayedWarning = false;
let alertOverwrite = text => {
if (!alertDisplayedWarning) {
DevToolsShim.openBrowserConsole();
require("devtools/client/framework/devtools-browser");
let {HUDService} = require("devtools/client/webconsole/hudservice");
HUDService.openBrowserConsoleOrFocus();
contentWindow.console.warn("alert() is not supported in background windows; please use console.log instead.");
alertDisplayedWarning = true;