mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 1269497 - Provide toolbox.win getter to make lines shorter in tests;r=jdescottes
MozReview-Commit-ID: 9KuWzsyHQGF
This commit is contained in:
parent
847bb23a7f
commit
c77eeb7c73
@ -1158,7 +1158,7 @@ function getSplitConsole(toolbox, win) {
|
||||
});
|
||||
|
||||
if (!win) {
|
||||
win = toolbox.doc.defaultView;
|
||||
win = toolbox.win;
|
||||
}
|
||||
|
||||
if (!toolbox.splitConsole) {
|
||||
|
@ -40,7 +40,7 @@ function zoomWithKey(toolbox, key) {
|
||||
|
||||
info("Zooming with key: " + key);
|
||||
let currentZoom = toolbox.zoomValue;
|
||||
EventUtils.synthesizeKey(key, {accelKey: true}, toolbox.doc.defaultView);
|
||||
EventUtils.synthesizeKey(key, {accelKey: true}, toolbox.win);
|
||||
isnot(toolbox.zoomValue, currentZoom, "The zoom level was changed in the toolbox");
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ function test() {
|
||||
|
||||
function testCustomHost(t) {
|
||||
toolbox = t;
|
||||
is(toolbox.doc.defaultView.top, window, "Toolbox is included in browser.xul");
|
||||
is(toolbox.win.top, window, "Toolbox is included in browser.xul");
|
||||
is(toolbox.doc, iframe.contentDocument, "Toolbox is in the custom iframe");
|
||||
executeSoon(() => gBrowser.removeCurrentTab());
|
||||
}
|
||||
|
@ -53,14 +53,14 @@ add_task(function*() {
|
||||
yield minimize(toolbox);
|
||||
onMaximized = toolbox._host.once("maximized");
|
||||
let tabButton = toolbox.doc.querySelector("#toolbox-tab-inspector");
|
||||
EventUtils.synthesizeMouseAtCenter(tabButton, {}, toolbox.doc.defaultView);
|
||||
EventUtils.synthesizeMouseAtCenter(tabButton, {}, toolbox.win);
|
||||
yield onMaximized;
|
||||
|
||||
info("Minimize again and click on the settings tab");
|
||||
yield minimize(toolbox);
|
||||
onMaximized = toolbox._host.once("maximized");
|
||||
let settingsButton = toolbox.doc.querySelector("#toolbox-tab-options");
|
||||
EventUtils.synthesizeMouseAtCenter(settingsButton, {}, toolbox.doc.defaultView);
|
||||
EventUtils.synthesizeMouseAtCenter(settingsButton, {}, toolbox.win);
|
||||
yield onMaximized;
|
||||
|
||||
info("Switch to a different host");
|
||||
@ -76,7 +76,7 @@ add_task(function*() {
|
||||
function* minimize(toolbox) {
|
||||
let button = toolbox.doc.querySelector("#toolbox-dock-bottom-minimize");
|
||||
let onMinimized = toolbox._host.once("minimized");
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, toolbox.doc.defaultView);
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, toolbox.win);
|
||||
yield onMinimized;
|
||||
}
|
||||
|
||||
@ -85,14 +85,14 @@ function* minimizeWithShortcut(toolbox) {
|
||||
.getAttribute("key");
|
||||
let onMinimized = toolbox._host.once("minimized");
|
||||
EventUtils.synthesizeKey(key, {accelKey: true, shiftKey: true},
|
||||
toolbox.doc.defaultView);
|
||||
toolbox.win);
|
||||
yield onMinimized;
|
||||
}
|
||||
|
||||
function* maximize(toolbox) {
|
||||
let button = toolbox.doc.querySelector("#toolbox-dock-bottom-minimize");
|
||||
let onMaximized = toolbox._host.once("maximized");
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, toolbox.doc.defaultView);
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, toolbox.win);
|
||||
yield onMaximized;
|
||||
}
|
||||
|
||||
@ -101,6 +101,6 @@ function* maximizeWithShortcut(toolbox) {
|
||||
.getAttribute("key");
|
||||
let onMaximized = toolbox._host.once("maximized");
|
||||
EventUtils.synthesizeKey(key, {accelKey: true, shiftKey: true},
|
||||
toolbox.doc.defaultView);
|
||||
toolbox.win);
|
||||
yield onMaximized;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ function* testShortcuts(toolbox, index, key, toolIDs) {
|
||||
" using key " + key);
|
||||
|
||||
let onToolSelected = toolbox.once("select");
|
||||
EventUtils.synthesizeKey(key, {accelKey: true}, toolbox.doc.defaultView);
|
||||
EventUtils.synthesizeKey(key, {accelKey: true}, toolbox.win);
|
||||
let id = yield onToolSelected;
|
||||
|
||||
info("toolbox-select event from " + id);
|
||||
|
@ -43,7 +43,7 @@ function startReloadTest(aToolbox) {
|
||||
testAllTheTools("docked", () => {
|
||||
let origHostType = toolbox.hostType;
|
||||
toolbox.switchHost(Toolbox.HostType.WINDOW).then(() => {
|
||||
toolbox.doc.defaultView.focus();
|
||||
toolbox.win.focus();
|
||||
testAllTheTools("undocked", () => {
|
||||
toolbox.switchHost(origHostType).then(() => {
|
||||
gBrowser.selectedBrowser.messageManager.removeMessageListener("devtools:test:load", reloadCounter);
|
||||
|
@ -59,7 +59,7 @@ function testShortcuts(aToolbox, aIndex) {
|
||||
idIndex = aIndex;
|
||||
info("Testing shortcut for tool " + aIndex + ":" + toolIDs[aIndex] +
|
||||
" using key " + key);
|
||||
EventUtils.synthesizeKey(key, modifiers, toolbox.doc.defaultView.parent);
|
||||
EventUtils.synthesizeKey(key, modifiers, toolbox.win.parent);
|
||||
}
|
||||
|
||||
function selectCB(event, id) {
|
||||
|
@ -45,7 +45,7 @@ function testZoomLevel(type, times, expected) {
|
||||
function sendZoomKey(id, times) {
|
||||
let key = toolbox.doc.getElementById(id).getAttribute("key");
|
||||
for (let i = 0; i < times; i++) {
|
||||
EventUtils.synthesizeKey(key, modifiers, toolbox.doc.defaultView);
|
||||
EventUtils.synthesizeKey(key, modifiers, toolbox.win);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,6 +276,13 @@ Toolbox.prototype = {
|
||||
return this._host.frame;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shortcut to the window containing the toolbox UI
|
||||
*/
|
||||
get win() {
|
||||
return this.doc.defaultView;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shortcut to the document containing the toolbox UI
|
||||
*/
|
||||
@ -725,7 +732,7 @@ Toolbox.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let doc = this.doc.defaultView.parent.document;
|
||||
let doc = this.win.parent.document;
|
||||
|
||||
for (let [id, toolDefinition] of gDevTools.getToolDefinitionMap()) {
|
||||
// Prevent multiple entries for the same tool.
|
||||
@ -936,7 +943,7 @@ Toolbox.prototype = {
|
||||
|
||||
toolbar.addEventListener("keypress", event => {
|
||||
let { key, target } = event;
|
||||
let win = this.doc.defaultView;
|
||||
let win = this.win;
|
||||
let elm, type;
|
||||
if (key === "Tab") {
|
||||
// Tabbing when toolbar or its contents are focused should move focus to
|
||||
@ -1900,7 +1907,7 @@ Toolbox.prototype = {
|
||||
}
|
||||
|
||||
if (this.hostType == Toolbox.HostType.WINDOW) {
|
||||
let doc = this.doc.defaultView.parent.document;
|
||||
let doc = this.win.parent.document;
|
||||
let key = doc.getElementById("key_" + toolId);
|
||||
if (key) {
|
||||
key.parentNode.removeChild(key);
|
||||
@ -2172,7 +2179,7 @@ Toolbox.prototype = {
|
||||
* Enable / disable necessary textbox menu items using globalOverlay.js.
|
||||
*/
|
||||
_updateTextboxMenuItems: function() {
|
||||
let window = this.doc.defaultView;
|
||||
let window = this.win;
|
||||
["cmd_undo", "cmd_delete", "cmd_cut",
|
||||
"cmd_copy", "cmd_paste", "cmd_selectAll"].forEach(window.goUpdateCommand);
|
||||
},
|
||||
|
@ -988,8 +988,7 @@ InspectorPanel.prototype = {
|
||||
|
||||
this._markupBox.removeAttribute("collapsed");
|
||||
|
||||
let controllerWindow = this._toolbox.doc.defaultView;
|
||||
this.markup = new MarkupView(this, this._markupFrame, controllerWindow);
|
||||
this.markup = new MarkupView(this, this._markupFrame, this._toolbox.win);
|
||||
|
||||
this.emit("markuploaded");
|
||||
},
|
||||
|
@ -436,7 +436,7 @@ function mouseLeaveMarkupView(inspector) {
|
||||
let btn = inspector.toolbox.doc.querySelector("#toolbox-controls");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(btn, {type: "mousemove"},
|
||||
inspector.toolbox.doc.defaultView);
|
||||
inspector.toolbox.win);
|
||||
executeSoon(def.resolve);
|
||||
|
||||
return def.promise;
|
||||
|
@ -107,7 +107,7 @@ function test() {
|
||||
let onNodeUnhighlight = toolbox.once("node-unhighlight");
|
||||
let btn = inspector.toolbox.doc.querySelector(".toolbox-dock-button");
|
||||
EventUtils.synthesizeMouseAtCenter(btn, {type: "mousemove"},
|
||||
inspector.toolbox.doc.defaultView);
|
||||
inspector.toolbox.win);
|
||||
yield onNodeUnhighlight;
|
||||
|
||||
info("Switching back to the console");
|
||||
|
@ -60,7 +60,7 @@ function test() {
|
||||
}
|
||||
|
||||
function getCurrentUIState() {
|
||||
let win = toolbox.doc.defaultView;
|
||||
let win = toolbox.win;
|
||||
let deck = toolbox.doc.querySelector("#toolbox-deck");
|
||||
let webconsolePanel = toolbox.webconsolePanel;
|
||||
let splitter = toolbox.doc.querySelector("#toolbox-console-splitter");
|
||||
|
Loading…
Reference in New Issue
Block a user