Bug 1485676 - Refactor gDevTools.getTargetForTab callsites to assume getTargetForTab is async. r=yulia

Reviewers: yulia!

Tags: #secure-revision

Bug #: 1485676

Differential Revision: https://phabricator.services.mozilla.com/D4535

MozReview-Commit-ID: FyERWaYipZo
This commit is contained in:
Alexandre Poirot 2018-08-29 05:31:43 -07:00
Родитель 957b91ec70
Коммит 35bc2e7546
8 изменённых файлов: 15 добавлений и 15 удалений

Просмотреть файл

@ -106,7 +106,7 @@ add_task(async function test_devtools_inspectedWindow_tabId() {
let backgroundPageCurrentTabId = await extension.awaitMessage("current-tab-id");
let target = gDevTools.getTargetForTab(tab);
let target = await gDevTools.getTargetForTab(tab);
await gDevTools.showToolbox(target, "webconsole");
info("developer toolbox opened");
@ -174,7 +174,7 @@ add_task(async function test_devtools_inspectedWindow_eval() {
await extension.startup();
let target = gDevTools.getTargetForTab(tab);
let target = await gDevTools.getTargetForTab(tab);
await gDevTools.showToolbox(target, "webconsole");
info("developer toolbox opened");
@ -336,7 +336,7 @@ add_task(async function test_devtools_inspectedWindow_eval_in_page_and_panel() {
await extension.startup();
const target = gDevTools.getTargetForTab(tab);
const target = await gDevTools.getTargetForTab(tab);
const toolbox = await gDevTools.showToolbox(target, "webconsole");
info("developer toolbox opened");

Просмотреть файл

@ -54,7 +54,7 @@ add_task(async function test_devtools_inspectedWindow_eval_bindings() {
await extension.startup();
const target = gDevTools.getTargetForTab(tab);
const target = await gDevTools.getTargetForTab(tab);
// Open the toolbox on the styleeditor, so that the inspector and the
// console panel have not been explicitly activated yet.
const toolbox = await gDevTools.showToolbox(target, "styleeditor");

Просмотреть файл

@ -37,7 +37,7 @@ async function runReloadTestCase({urlParams, background, devtoolsPage, testCase}
await extension.startup();
let target = gDevTools.getTargetForTab(tab);
let target = await gDevTools.getTargetForTab(tab);
await gDevTools.showToolbox(target, "webconsole");
info("developer toolbox opened");

Просмотреть файл

@ -134,7 +134,7 @@ add_task(async function test_devtools_network_on_navigated() {
await extension.startup();
await extension.awaitMessage("ready");
let target = gDevTools.getTargetForTab(tab);
let target = await gDevTools.getTargetForTab(tab);
await gDevTools.showToolbox(target, "webconsole");
info("Developer toolbox opened.");
@ -172,7 +172,7 @@ add_task(async function test_devtools_network_get_har() {
await extension.startup();
await extension.awaitMessage("ready");
let target = gDevTools.getTargetForTab(tab);
let target = await gDevTools.getTargetForTab(tab);
// Open the Toolbox
let toolbox = await gDevTools.showToolbox(target, "webconsole");
@ -223,7 +223,7 @@ add_task(async function test_devtools_network_on_request_finished() {
await extension.startup();
await extension.awaitMessage("ready");
let target = gDevTools.getTargetForTab(tab);
let target = await gDevTools.getTargetForTab(tab);
// Open the Toolbox
let toolbox = await gDevTools.showToolbox(target, "webconsole");

Просмотреть файл

@ -119,7 +119,7 @@ add_task(async function test_devtools_page_runtime_api_messaging() {
info("Wait the content script load");
await extension.awaitMessage("content_script_loaded");
let target = gDevTools.getTargetForTab(tab);
let target = await gDevTools.getTargetForTab(tab);
info("Open the developer toolbox");
await gDevTools.showToolbox(target, "webconsole");
@ -247,7 +247,7 @@ add_task(async function test_devtools_page_and_extension_tab_messaging() {
info("Wait the extension tab page load");
await extension.awaitMessage("extension_tab_loaded");
let target = gDevTools.getTargetForTab(tab);
let target = await gDevTools.getTargetForTab(tab);
info("Open the developer toolbox");
await gDevTools.showToolbox(target, "webconsole");

Просмотреть файл

@ -25,14 +25,14 @@ const DEVTOOLS_THEME_PREF = "devtools.theme";
*/
async function openToolboxForTab(tab) {
const target = gDevTools.getTargetForTab(tab);
const target = await gDevTools.getTargetForTab(tab);
const toolbox = await gDevTools.showToolbox(target, "testBlankPanel");
info("Developer toolbox opened");
return {toolbox, target};
}
async function closeToolboxForTab(tab) {
const target = gDevTools.getTargetForTab(tab);
const target = await gDevTools.getTargetForTab(tab);
await gDevTools.closeToolbox(target);
await target.destroy();
info("Developer toolbox closed");

Просмотреть файл

@ -18,7 +18,7 @@ add_task(async function() {
});
async function testToolboxInitialization(tab, inspector, toolbox) {
const target = TargetFactory.forTab(tab);
const target = await TargetFactory.forTab(tab);
ok(true, "Inspector started, and notification received.");
ok(inspector, "Inspector instance is accessible.");

Просмотреть файл

@ -709,11 +709,11 @@ DevToolsStartup.prototype = {
},
// Open the toolbox on the selected tab once the browser starts up.
handleDevToolsFlag: function(window) {
handleDevToolsFlag: async function(window) {
const require = this.initDevTools("CommandLine");
const {gDevTools} = require("devtools/client/framework/devtools");
const {TargetFactory} = require("devtools/client/framework/target");
const target = TargetFactory.forTab(window.gBrowser.selectedTab);
const target = await TargetFactory.forTab(window.gBrowser.selectedTab);
gDevTools.showToolbox(target);
},