Bug 1271125 part 2 - Port editor mochitests that depend on ChromeUtils.js to mochitest-plain; r=masayuki

The change from ok() to is() in tests is so that the failure message is
more informative -- it now tells you the returned exception.

This commit omits test_contenteditable_text_input_handling.html because of test
failures that I haven't figured out.

MozReview-Commit-ID: 37cYlQlJZm7
This commit is contained in:
Aryeh Gregor 2016-10-31 18:38:04 +02:00
Родитель 123bc81472
Коммит f0ca6ef4ca
7 изменённых файлов: 28 добавлений и 22 удалений

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

@ -1840,7 +1840,7 @@ TabChild::RecvPluginEvent(const WidgetPluginEvent& aEvent)
void
TabChild::RequestNativeKeyBindings(AutoCacheNativeKeyCommands* aAutoCache,
WidgetKeyboardEvent* aEvent)
const WidgetKeyboardEvent* aEvent)
{
MaybeNativeKeyBinding maybeBindings;
if (!SendRequestNativeKeyBindings(*aEvent, &maybeBindings)) {

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

@ -513,7 +513,7 @@ public:
void NotifyPainted();
void RequestNativeKeyBindings(mozilla::widget::AutoCacheNativeKeyCommands* aAutoCache,
WidgetKeyboardEvent* aEvent);
const WidgetKeyboardEvent* aEvent);
/**
* Signal to this TabChild that it should be made visible:

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

@ -8,10 +8,7 @@ skip-if = buildapp == 'mulet'
[test_bug607584.xul]
[test_bug616590.xul]
[test_bug780908.xul]
[test_bug1102906.html]
[test_contenteditable_text_input_handling.html]
[test_dragdrop.html]
skip-if = buildapp == 'mulet'
[test_htmleditor_keyevent_handling.html]
[test_set_document_title_transaction.html]
[test_texteditor_keyevent_handling.html]

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

@ -184,6 +184,8 @@ subsuite = clipboard
[test_bug1094000.html]
[test_bug1100966.html]
skip-if = os == 'android'
[test_bug1102906.html]
skip-if = os == 'android'
[test_bug1101392.html]
subsuite = clipboard
[test_bug1109465.html]
@ -215,6 +217,8 @@ subsuite = clipboard
[test_dom_input_event_on_htmleditor.html]
skip-if = toolkit == 'android' # bug 1054087
[test_dom_input_event_on_texteditor.html]
[test_dragdrop.html]
skip-if = os == 'android'
[test_keypress_untrusted_event.html]
[test_root_element_replacement.html]
[test_select_all_without_body.html]

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

@ -7,16 +7,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1102906
<meta charset="utf-8">
<title>Test for Bug 1102906</title>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<script type="application/javascript;version=1.8"">
<script>
"use strict";
/* Test for Bug 1102906 */

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

@ -1,12 +1,11 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
@ -45,17 +44,17 @@ function doTest()
selection.selectAllChildren(text);
var result = synthesizeDragStart(text, [[htmlContextData, htmlInfoData, htmlData,
{type: "text/plain", data: "Some Text"}]], window, 40, 10);
ok(!result, "Test dragging regular text");
is(result, null, "Test dragging regular text");
// -------- Test dragging text from an <input>
input.setSelectionRange(1, 4);
result = synthesizeDragStart(input, [[{type: "text/plain", data: "rag"}]], window, 25, 6);
ok(!result, "Test dragging input");
is(result, null, "Test dragging input");
// -------- Test dragging text from a <textarea>
textarea.setSelectionRange(1, 7);
result = synthesizeDragStart(textarea, [[{type: "text/plain", data: "ome Te"}]], window, 25, 6);
ok(!result, "Test dragging textarea");
is(result, null, "Test dragging textarea");
textarea.blur();
// -------- Test dragging text from a contenteditable
@ -64,7 +63,7 @@ function doTest()
[[htmlContextDataEditable, htmlInfoData,
{type: 'text/html', data: '<b id="bold">editable</b>' },
{type: "text/plain", data: "editable"}]], window, 5, 6);
ok(!result, "Test dragging contenteditable");
is(result, null, "Test dragging contenteditable");
contenteditable.blur();
// -------- Test dragging regular text of text/html to <input>

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

@ -536,6 +536,16 @@ PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
#ifdef MOZ_WIDGET_GONK
return false;
#else // #ifdef MOZ_WIDGET_GONK
AutoCacheNativeKeyCommands autoCache(this);
if (!aEvent.mWidget && !mNativeKeyCommandsValid) {
MOZ_ASSERT(!aEvent.mFlags.mIsSynthesizedForTests);
// Abort if untrusted to avoid leaking system settings
if (NS_WARN_IF(!aEvent.IsTrusted())) {
return false;
}
mTabChild->RequestNativeKeyBindings(&autoCache, &aEvent);
}
MOZ_ASSERT(mNativeKeyCommandsValid);
const nsTArray<mozilla::CommandInt>* commands = nullptr;