Backed out changeset 3fca18104696 (bug 1170531) for e10s-m4 test failures in test_bug1067255.html

This commit is contained in:
Carsten "Tomcat" Book 2015-06-22 15:21:02 +02:00
parent 859b3175d9
commit 0a17062dc6
6 changed files with 4 additions and 57 deletions

View File

@ -486,23 +486,14 @@ nsClipboardCommand::IsCommandEnabled(const char* aCommandName, nsISupports *aCon
*outCmdEnabled = false;
if (strcmp(aCommandName, "cmd_copy") &&
strcmp(aCommandName, "cmd_copyAndCollapseToEnd") &&
strcmp(aCommandName, "cmd_cut"))
strcmp(aCommandName, "cmd_copyAndCollapseToEnd"))
return NS_OK;
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
if (doc->IsHTMLOrXHTML()) {
// In HTML and XHTML documents, we always want cut and copy commands to be enabled.
*outCmdEnabled = true;
} else {
// Cut isn't enabled in xul documents which use nsClipboardCommand
if (strcmp(aCommandName, "cmd_cut")) {
*outCmdEnabled = nsCopySupport::CanCopy(doc);
}
}
*outCmdEnabled = nsCopySupport::CanCopy(doc);
return NS_OK;
}

View File

@ -1155,12 +1155,6 @@ nsPlaintextEditor::Redo(uint32_t aCount)
bool
nsPlaintextEditor::CanCutOrCopy(PasswordFieldAllowed aPasswordFieldAllowed)
{
nsCOMPtr<nsIDocument> doc = GetDocument();
if (doc && doc->IsHTMLOrXHTML()) {
// In HTML and XHTML documents, we always want cut and copy commands to be enabled.
return true;
}
nsRefPtr<Selection> selection = GetSelection();
if (!selection) {
return false;

View File

@ -17,8 +17,7 @@ function goUpdateGlobalEditMenuItems()
goUpdateCommand("cmd_undo");
goUpdateCommand("cmd_redo");
goUpdateCommand("cmd_cut");
goUpdateCommand("cmd_copy");
// don't update the cmd_cut or cmd_copy items - as we want them to always be enabled
goUpdateCommand("cmd_paste");
goUpdateCommand("cmd_selectAll");
goUpdateCommand("cmd_delete");

View File

@ -93,7 +93,7 @@ function goDoCommand(aCommand)
try {
var controller = top.document.commandDispatcher
.getControllerForCommand(aCommand);
if (controller && controller.isCommandEnabled(aCommand))
if (controller)
controller.doCommand(aCommand);
}
catch (e) {

View File

@ -36,4 +36,3 @@ skip-if = !e10s || !crashreporter
support-files =
file_redirect.html
file_redirect_to.html
[browser_bug1170531.js]

View File

@ -1,36 +0,0 @@
// Test for bug 1170531
// https://bugzilla.mozilla.org/show_bug.cgi?id=1170531
add_task(function* () {
yield BrowserTestUtils.withNewTab({ gBrowser: gBrowser, url: "about:blank" }, function* (browser) {
let menu_EditPopup = document.getElementById("menu_EditPopup");
let menu_cut_disabled, menu_copy_disabled;
yield BrowserTestUtils.loadURI(browser, "data:text/html,<div>hello!</div>");
browser.focus();
yield new Promise(resolve => waitForFocus(resolve, window));
goUpdateGlobalEditMenuItems();
menu_cut_disabled = menu_EditPopup.querySelector("#menu_cut").getAttribute('disabled') == "true";
is(menu_cut_disabled, false, "menu_cut should be enabled");
menu_copy_disabled = menu_EditPopup.querySelector("#menu_copy").getAttribute('disabled') == "true";
is(menu_copy_disabled, false, "menu_copy should be enabled");
yield BrowserTestUtils.loadURI(browser, "data:text/html,<div contentEditable='true'>hello!</div>");
browser.focus();
yield new Promise(resolve => waitForFocus(resolve, window));
goUpdateGlobalEditMenuItems();
menu_cut_disabled = menu_EditPopup.querySelector("#menu_cut").getAttribute('disabled') == "true";
is(menu_cut_disabled, false, "menu_cut should be enabled");
menu_copy_disabled = menu_EditPopup.querySelector("#menu_copy").getAttribute('disabled') == "true";
is(menu_copy_disabled, false, "menu_copy should be enabled");
yield BrowserTestUtils.loadURI(browser, "about:preferences");
browser.focus();
yield new Promise(resolve => waitForFocus(resolve, window));
goUpdateGlobalEditMenuItems();
menu_cut_disabled = menu_EditPopup.querySelector("#menu_cut").getAttribute('disabled') == "true";
is(menu_cut_disabled, true, "menu_cut should be disabled");
menu_copy_disabled = menu_EditPopup.querySelector("#menu_copy").getAttribute('disabled') == "true";
is(menu_copy_disabled, true, "menu_copy should be disabled");
});
});