Bug 851132 - Style editor shows wrong URL when middle-clicking a file name; r=mratcliffe

This commit is contained in:
David Creswick 2013-03-27 10:01:00 +02:00
Родитель c8452650a6
Коммит adbaf91a38
4 изменённых файлов: 73 добавлений и 2 удалений

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

@ -555,6 +555,16 @@ StyleEditorChrome.prototype = {
editor.enableStyleSheet(editor.styleSheet.disabled);
});
wire(aSummary, ".stylesheet-name", {
events: {
"keypress": function onStylesheetNameActivate(aEvent) {
if (aEvent.keyCode == aEvent.DOM_VK_RETURN) {
this._view.activeSummary = aSummary;
}
}.bind(this)
}
});
wire(aSummary, ".stylesheet-saveButton", function onSaveButton(aEvent) {
aEvent.stopPropagation();
aEvent.target.blur();

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

@ -80,13 +80,13 @@
title="&visibilityToggle.tooltip;"
accesskey="&saveButton.accesskey;"></a>
<hgroup class="stylesheet-info">
<h1><a class="stylesheet-name" href="#"><xul:label crop="start"/></a></h1>
<h1><a class="stylesheet-name" tabindex="0"><xul:label crop="start"/></a></h1>
<div class="stylesheet-more">
<h3 class="stylesheet-title"></h3>
<h3 class="stylesheet-rule-count"></h3>
<h3 class="stylesheet-error-message"></h3>
<xul:spacer/>
<h3><a class="stylesheet-saveButton" href="#"
<h3><a class="stylesheet-saveButton"
title="&saveButton.tooltip;"
accesskey="&saveButton.accesskey;">&saveButton.label;</a></h3>
</div>

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

@ -29,6 +29,7 @@ _BROWSER_TEST_FILES = \
browser_styleeditor_sv_keynav.js \
browser_styleeditor_sv_resize.js \
browser_styleeditor_bug_826982_location_changed.js \
browser_styleeditor_bug_851132_middle_click.js \
head.js \
helpers.js \
four.html \

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

@ -0,0 +1,60 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const TESTCASE_URI = TEST_BASE + "four.html";
function test() {
waitForExplicitFinish();
addTabAndLaunchStyleEditorChromeWhenLoaded(function (aChrome) {
run(aChrome);
});
content.location = TESTCASE_URI;
}
let gSEChrome, timeoutID;
function run(aChrome) {
gSEChrome = aChrome;
gBrowser.tabContainer.addEventListener("TabOpen", onTabAdded, false);
aChrome.editors[0].addActionListener({onAttach: onEditor0Attach});
aChrome.editors[1].addActionListener({onAttach: onEditor1Attach});
}
function getStylesheetNameLinkFor(aEditor) {
return gSEChrome.getSummaryElementForEditor(aEditor).querySelector(".stylesheet-name");
}
function onEditor0Attach(aEditor) {
waitForFocus(function () {
// left mouse click should focus editor 1
EventUtils.synthesizeMouseAtCenter(
getStylesheetNameLinkFor(gSEChrome.editors[1]),
{button: 0},
gChromeWindow);
}, gChromeWindow);
}
function onEditor1Attach(aEditor) {
ok(aEditor.sourceEditor.hasFocus(),
"left mouse click has given editor 1 focus");
// right mouse click should not open a new tab
EventUtils.synthesizeMouseAtCenter(
getStylesheetNameLinkFor(gSEChrome.editors[2]),
{button: 1},
gChromeWindow);
setTimeout(finish, 0);
}
function onTabAdded() {
ok(false, "middle mouse click has opened a new tab");
finish();
}
registerCleanupFunction(function () {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabAdded, false);
gSEChrome = null;
});