mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 871156 - Allow Ctrl+W to close the tab when the Web Console is focused; r=robcee
This commit is contained in:
parent
f73332d456
commit
1c4ff5e9b2
@ -547,6 +547,10 @@ ViewHelpers.create({ constructor: BrowserConsole, proto: WebConsole.prototype },
|
||||
this._bc_init = this.$init().then((aReason) => {
|
||||
let title = this.ui.rootElement.getAttribute("browserConsoleTitle");
|
||||
this.ui.rootElement.setAttribute("title", title);
|
||||
|
||||
let cmd_close = this.ui.document.getElementById("cmd_close");
|
||||
cmd_close.removeAttribute("disabled");
|
||||
|
||||
return aReason;
|
||||
});
|
||||
|
||||
|
@ -129,6 +129,7 @@ MOCHITEST_BROWSER_FILES = \
|
||||
browser_bug_869003_inspect_cross_domain_object.js \
|
||||
browser_bug_862916_console_dir_and_filter_off.js \
|
||||
browser_console_native_getters.js \
|
||||
browser_bug_871156_ctrlw_close_tab.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Check that Ctrl-W closes the Browser Console and that Ctrl-W closes the
|
||||
// current tab when using the Web Console - bug 871156.
|
||||
|
||||
function test()
|
||||
{
|
||||
const TEST_URI = "data:text/html;charset=utf8,<title>bug871156</title>\n" +
|
||||
"<p>hello world";
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("load", function onLoad() {
|
||||
browser.removeEventListener("load", onLoad, true);
|
||||
openConsole(null, consoleOpened);
|
||||
}, true);
|
||||
|
||||
function consoleOpened(hud)
|
||||
{
|
||||
ok(hud, "Web Console opened");
|
||||
|
||||
let tabClosed = false, toolboxDestroyed = false;
|
||||
|
||||
gBrowser.tabContainer.addEventListener("TabClose", function onTabClose() {
|
||||
gBrowser.tabContainer.removeEventListener("TabClose", onTabClose);
|
||||
|
||||
ok(true, "tab closed");
|
||||
|
||||
tabClosed = true;
|
||||
if (toolboxDestroyed) {
|
||||
testBrowserConsole();
|
||||
}
|
||||
});
|
||||
|
||||
let toolbox = gDevTools.getToolbox(hud.target);
|
||||
toolbox.once("destroyed", () => {
|
||||
ok(true, "toolbox destroyed");
|
||||
|
||||
toolboxDestroyed = true;
|
||||
if (tabClosed) {
|
||||
testBrowserConsole();
|
||||
}
|
||||
});
|
||||
|
||||
EventUtils.synthesizeKey("w", { accelKey: true }, hud.iframeWindow);
|
||||
}
|
||||
|
||||
function testBrowserConsole()
|
||||
{
|
||||
info("test the Browser Console");
|
||||
|
||||
HUDConsoleUI.toggleBrowserConsole().then((hud) => {
|
||||
ok(hud, "Browser Console opened");
|
||||
|
||||
Services.obs.addObserver(function onDestroy() {
|
||||
Services.obs.removeObserver(onDestroy, "web-console-destroyed");
|
||||
ok(true, "the Browser Console closed");
|
||||
|
||||
executeSoon(finishTest);
|
||||
}, "web-console-destroyed", false);
|
||||
|
||||
EventUtils.synthesizeKey("w", { accelKey: true }, hud.iframeWindow);
|
||||
});
|
||||
}
|
||||
}
|
@ -37,7 +37,7 @@
|
||||
<command id="cmd_fullZoomEnlarge" oncommand="goDoCommand('cmd_fontSizeEnlarge');"/>
|
||||
<command id="cmd_fullZoomReduce" oncommand="goDoCommand('cmd_fontSizeReduce');"/>
|
||||
<command id="cmd_fullZoomReset" oncommand="goDoCommand('cmd_fontSizeReset');"/>
|
||||
<command id="cmd_close" oncommand="goDoCommand('cmd_close');"/>
|
||||
<command id="cmd_close" oncommand="goDoCommand('cmd_close');" disabled="true"/>
|
||||
</commandset>
|
||||
<keyset id="consoleKeys">
|
||||
<key id="key_fullZoomReduce" key="&fullZoomReduceCmd.commandkey;" command="cmd_fullZoomReduce" modifiers="accel"/>
|
||||
|
@ -187,7 +187,9 @@ function log(aThing) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else if (type.match("Error$") || aThing.name == "NS_ERROR_FAILURE") {
|
||||
else if (type.match("Error$") ||
|
||||
(typeof aThing.name == "string" &&
|
||||
aThing.name.match("NS_ERROR_"))) {
|
||||
reply += " Message: " + aThing + "\n";
|
||||
if (aThing.stack) {
|
||||
reply += " Stack:\n";
|
||||
|
Loading…
Reference in New Issue
Block a user