Bug 1521928 - Enable ESLint for widget (automatic changes). r=Standard8,jmathies

Differential Revision: https://phabricator.services.mozilla.com/D18579

--HG--
extra : moz-landing-system : lando
This commit is contained in:
championshuttler 2019-02-14 20:20:20 +00:00
parent 130f941069
commit e97abf832d
20 changed files with 494 additions and 578 deletions

View File

@ -30,8 +30,6 @@ netwerk/test/unit*/**
tools/update-packaging/**
uriloader/exthandler/**
uriloader/exthandler/tests/mochitest/**
widget/headless/tests/**
widget/tests/**
xpfe/**
# We currently have no js files in these directories, so we ignore them by

View File

@ -11,7 +11,7 @@ const ROOT = `http://localhost:${server.identity.primaryPort}`;
const BASE = `${ROOT}/`;
const HEADLESS_URL = `${BASE}/headless.html`;
const HEADLESS_BUTTON_URL = `${BASE}/headless_button.html`;
registerCleanupFunction(() => { server.stop(() => {})});
registerCleanupFunction(() => { server.stop(() => {}); });
// Refrences to the progress listeners to keep them from being gc'ed
// before they are called.
@ -27,7 +27,7 @@ function loadContentWindow(windowlessBrowser, uri) {
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebProgress);
let progressListener = {
onLocationChange: function (progress, request, location, flags) {
onLocationChange(progress, request, location, flags) {
// Ignore inner-frame events
if (progress != webProgress) {
return;
@ -44,7 +44,7 @@ function loadContentWindow(windowlessBrowser, uri) {
}, { once: true });
},
QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
"nsISupportsWeakReference"])
"nsISupportsWeakReference"]),
};
progressListeners.set(progressListener, progressListener);
webProgress.addProgressListener(progressListener,
@ -63,8 +63,8 @@ add_task(async function test_snapshot() {
equal(contentWindow.innerHeight, contentHeight);
// Snapshot the test page.
let canvas = contentWindow.document.createElementNS('http://www.w3.org/1999/xhtml', 'html:canvas');
let context = canvas.getContext('2d');
let canvas = contentWindow.document.createElementNS("http://www.w3.org/1999/xhtml", "html:canvas");
let context = canvas.getContext("2d");
let width = contentWindow.innerWidth;
let height = contentWindow.innerHeight;
canvas.width = width;
@ -75,7 +75,7 @@ add_task(async function test_snapshot() {
0,
width,
height,
'rgb(255, 255, 255)'
"rgb(255, 255, 255)"
);
let imageData = context.getImageData(0, 0, width, height).data;
ok(imageData[0] === 0 && imageData[1] === 255 && imageData[2] === 0 && imageData[3] === 255, "Page is green.");
@ -106,8 +106,8 @@ add_task(async function test_snapshot_widget_layers() {
equal(contentWindow.innerHeight, contentHeight);
// Snapshot the test page.
let canvas = contentWindow.document.createElementNS('http://www.w3.org/1999/xhtml', 'html:canvas');
let context = canvas.getContext('2d');
let canvas = contentWindow.document.createElementNS("http://www.w3.org/1999/xhtml", "html:canvas");
let context = canvas.getContext("2d");
let width = contentWindow.innerWidth;
let height = contentWindow.innerHeight;
canvas.width = width;
@ -118,7 +118,7 @@ add_task(async function test_snapshot_widget_layers() {
0,
width,
height,
'rgb(255, 255, 255)',
"rgb(255, 255, 255)",
context.DRAWWINDOW_DRAW_CARET | context.DRAWWINDOW_DRAW_VIEW | context.DRAWWINDOW_USE_WIDGET_LAYERS
);
ok(true, "Snapshot with widget layers didn't crash.");
@ -136,7 +136,7 @@ add_task(async function test_keydown() {
contentWindow.addEventListener("keydown", () => {
resolve();
}, { once: true });
})
});
let tip = Cc["@mozilla.org/text-input-processor;1"]
.createInstance(Ci.nsITextInputProcessor);
@ -158,7 +158,7 @@ add_task(async function test_mouse_drag() {
let contentWindow = await loadContentWindow(windowlessBrowser, HEADLESS_BUTTON_URL);
contentWindow.resizeTo(400, 400);
let target = contentWindow.document.getElementById('btn');
let target = contentWindow.document.getElementById("btn");
let rect = target.getBoundingClientRect();
let left = rect.left;
let top = rect.top;
@ -168,7 +168,7 @@ add_task(async function test_mouse_drag() {
utils.sendMouseEvent("mousemove", left, top, 0, 1, 0, false, 0, 0);
// Wait for a turn of the event loop since the synthetic mouse event
// that creates the drag service is processed during the refresh driver.
await new Promise((r) => {executeSoon(r)});
await new Promise((r) => { executeSoon(r); });
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
ok(true, "Send mouse event didn't crash");

View File

@ -29,16 +29,16 @@ function getString(clipboard) {
}
add_task(async function test_clipboard() {
let clipboard = Cc['@mozilla.org/widget/clipboard;1']
let clipboard = Cc["@mozilla.org/widget/clipboard;1"]
.getService(Ci.nsIClipboard);
// Test copy.
const data = "random number: " + Math.random();
let helper = Cc['@mozilla.org/widget/clipboardhelper;1']
let helper = Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
helper.copyString(data);
equal(getString(clipboard), data, 'Data was successfully copied.');
equal(getString(clipboard), data, "Data was successfully copied.");
clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
equal(getString(clipboard), '', 'Data was successfully cleared.');
equal(getString(clipboard), "", "Data was successfully cleared.");
});

View File

@ -88,8 +88,7 @@ var gCopiedEvent = [];
var gCallback = null;
var gCallPreventDefault = false;
function onEvent(aEvent)
{
function onEvent(aEvent) {
if (gCallPreventDefault) {
aEvent.preventDefault();
}
@ -105,8 +104,7 @@ function onEvent(aEvent)
setTimeout(gCallback, 0);
}
function observeKeyUpOnContent(aKeyCode, aCallback)
{
function observeKeyUpOnContent(aKeyCode, aCallback) {
document.addEventListener("keyup", function keyUp(ev) {
if (ev.keyCode == aKeyCode) {
document.removeEventListener("keyup", keyUp);
@ -118,49 +116,49 @@ function observeKeyUpOnContent(aKeyCode, aCallback)
const kTests = [
{ description: "InternalScrollPortEvent (overflow, vertical)",
targetID: "scrollable-div", eventType: "overflow",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById("scrolled-div").style.height = "500px";
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "InternalScrollPortEvent (overflow, horizontal)",
targetID: "scrollable-div", eventType: "overflow",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById("scrolled-div").style.width = "500px";
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "InternalScrollAreaEvent (MozScrolledAreaChanged, spreading)",
target: function () { return document; }, eventType: "MozScrolledAreaChanged",
dispatchEvent: function () {
target() { return document; }, eventType: "MozScrolledAreaChanged",
dispatchEvent() {
document.getElementById("scrollable-div").style.width = "50000px";
document.getElementById("scrollable-div").style.height = "50000px";
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "InternalScrollAreaEvent (MozScrolledAreaChanged, shrinking)",
target: function () { return document; }, eventType: "MozScrolledAreaChanged",
dispatchEvent: function () {
target() { return document; }, eventType: "MozScrolledAreaChanged",
dispatchEvent() {
document.getElementById("scrollable-div").style.width = "30px";
document.getElementById("scrollable-div").style.height = "30px";
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "WidgetKeyboardEvent (keydown of 'a' key without modifiers)",
targetID: "input-text", eventType: "keydown",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_A : MAC_VK_ANSI_A,
@ -168,14 +166,14 @@ const kTests = [
observeKeyUpOnContent(KeyboardEvent.DOM_VK_A, runNextTest);
return true;
},
canRun: function () {
canRun() {
return (kIsMac || kIsWin);
},
todoMismatch: [],
},
{ description: "WidgetKeyboardEvent (keyup of 'a' key without modifiers)",
targetID: "input-text", eventType: "keydown",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_A : MAC_VK_ANSI_A,
@ -183,14 +181,14 @@ const kTests = [
observeKeyUpOnContent(KeyboardEvent.DOM_VK_A, runNextTest);
return true;
},
canRun: function () {
canRun() {
return (kIsMac || kIsWin);
},
todoMismatch: [],
},
{ description: "WidgetKeyboardEvent (keypress of 'b' key with Shift)",
targetID: "input-text", eventType: "keypress",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_B : MAC_VK_ANSI_B,
@ -203,14 +201,14 @@ const kTests = [
observeKeyUpOnContent(waitKeyCode, runNextTest);
return true;
},
canRun: function () {
canRun() {
return (kIsMac || kIsWin);
},
todoMismatch: [],
},
{ description: "WidgetKeyboardEvent (keypress of 'c' key with Accel)",
targetID: "input-text", eventType: "keypress",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_C : MAC_VK_ANSI_C,
@ -224,14 +222,14 @@ const kTests = [
observeKeyUpOnContent(waitKeyCode, runNextTest);
return true;
},
canRun: function () {
canRun() {
return !kStrictKeyPressEvents && (kIsMac || kIsWin);
},
todoMismatch: [],
},
{ description: "WidgetKeyboardEvent (keyup during composition)",
targetID: "input-text", eventType: "keyup",
dispatchEvent: function () {
dispatchEvent() {
setAndObserveCompositionPref(true, () => {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
@ -239,8 +237,8 @@ const kTests = [
{ "string": "\u306D",
"clauses":
[
{ "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE }
]
{ "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
],
},
"caret": { "start": 1, "length": 0 },
"key": { key: "a" },
@ -250,14 +248,14 @@ const kTests = [
});
return true;
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetKeyboardEvent (keydown during composition)",
targetID: "input-text", eventType: "keydown",
dispatchEvent: function () {
dispatchEvent() {
setAndObserveCompositionPref(true, () => {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
@ -265,8 +263,8 @@ const kTests = [
{ "string": "\u306D",
"clauses":
[
{ "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE }
]
{ "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
],
},
"caret": { "start": 1, "length": 0 },
"key": {},
@ -277,18 +275,18 @@ const kTests = [
});
return true;
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetMouseEvent (mousedown of left button without modifier)",
targetID: "button", eventType: "mousedown",
dispatchEvent: function () {
dispatchEvent() {
synthesizeMouseAtCenter(document.getElementById(this.targetID),
{ button: 0 });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
@ -296,34 +294,34 @@ const kTests = [
{ description: "WidgetMouseEvent (click of middle button with Shift)",
// XXX I'm not sure why middle click event isn't fired on button element.
targetID: "input-text", eventType: "click",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
synthesizeMouseAtCenter(document.getElementById(this.targetID),
{ button: 1, shiftKey: true, pressure: 0.5 });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "WidgetMouseEvent (mouseup of right button with Alt)",
targetID: "button", eventType: "mouseup",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
synthesizeMouseAtCenter(document.getElementById(this.targetID),
{ button: 2, altKey: true });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "WidgetDragEvent",
targetID: "input-text", eventType: "dragstart",
dispatchEvent: function () {
return;
dispatchEvent() {
},
canRun: function () {
canRun() {
todo(false, "WidgetDragEvent isn't tested");
return false;
},
@ -331,31 +329,31 @@ const kTests = [
},
{ description: "WidgetTextEvent (text)",
targetID: "input-text", eventType: "text",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
synthesizeComposition({ type: "compositioncommit", data: "\u306D", key: { key: "," } });
},
canRun: function () {
canRun() {
return !SpecialPowers.getBoolPref("dom.compositionevent.text.dispatch_only_system_group_in_content");
},
todoMismatch: [ ],
},
{ description: "WidgetCompositionEvent (compositionupdate)",
targetID: "input-text", eventType: "compositionupdate",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
synthesizeComposition({ type: "compositioncommit", data: "\u30E9\u30FC\u30E1\u30F3", key: { key: "KEY_Enter" } });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "InternalEditorInputEvent (input at key input)",
targetID: "input-text", eventType: "input",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_B : MAC_VK_ANSI_B,
@ -363,163 +361,163 @@ const kTests = [
observeKeyUpOnContent(KeyboardEvent.DOM_VK_B, runNextTest);
return true;
},
canRun: function () {
canRun() {
return (kIsMac || kIsWin);
},
todoMismatch: [],
},
{ description: "InternalEditorInputEvent (input at composing)",
targetID: "input-text", eventType: "input",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
document.getElementById(this.targetID).focus();
synthesizeCompositionChange({ "composition":
{ "string": "\u30E9\u30FC\u30E1\u30F3",
"clauses":
[
{ "length": 4, "attr": COMPOSITION_ATTR_RAW_CLAUSE }
]
{ "length": 4, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
],
},
"caret": { "start": 4, "length": 0 },
"key": { key: "y" },
});
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "InternalEditorInputEvent (input at committing)",
targetID: "input-text", eventType: "input",
dispatchEvent: function () {
dispatchEvent() {
synthesizeComposition({ type: "compositioncommitasis", key: { key: "KEY_Enter" } });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetMouseScrollEvent (DOMMouseScroll, vertical)",
targetID: "input-text", eventType: "DOMMouseScroll",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 3, 4,
{ deltaY: 30, lineOrPageDeltaY: 2 });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetMouseScrollEvent (DOMMouseScroll, horizontal)",
targetID: "input-text", eventType: "DOMMouseScroll",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 4, 5,
{ deltaX: 30, lineOrPageDeltaX: 2, shiftKey: true });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetMouseScrollEvent (MozMousePixelScroll, vertical)",
targetID: "input-text", eventType: "MozMousePixelScroll",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 3, 4,
{ deltaY: 20, lineOrPageDeltaY: 1, altKey: true });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetMouseScrollEvent (MozMousePixelScroll, horizontal)",
targetID: "input-text", eventType: "MozMousePixelScroll",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 4, 5,
{ deltaX: 20, lineOrPageDeltaX: 1, ctrlKey: true });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetWheelEvent (wheel, vertical)",
targetID: "input-text", eventType: "wheel",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 3, 4,
{ deltaY: 20, lineOrPageDeltaY: 1, altKey: true });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetWheelEvent (wheel, horizontal)",
targetID: "input-text", eventType: "wheel",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 4, 5,
{ deltaX: 20, lineOrPageDeltaX: 1, ctrlKey: true });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetWheelEvent (wheel, both)",
targetID: "input-text", eventType: "wheel",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 4, 5,
{ deltaX: 20, deltaY: 10,
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetTouchEvent (touchstart)",
target: function () { return document; }, eventType: "touchstart",
dispatchEvent: function () {
target() { return document; }, eventType: "touchstart",
dispatchEvent() {
synthesizeTouchAtPoint(1, 2, { id: 10, rx: 4, ry: 3, angle: 0, force: 1, shiftKey: true});
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetTouchEvent (touchend)",
target: function () { return document; }, eventType: "touchend",
dispatchEvent: function () {
target() { return document; }, eventType: "touchend",
dispatchEvent() {
synthesizeTouchAtPoint(4, 6, { id: 5, rx: 1, ry: 2, angle: 0.5, force: 0.8, ctrlKey: true});
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "InternalFormEvent (reset)",
targetID: "form", eventType: "reset",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById("form").reset();
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "WidgetCommandEvent",
targetID: "input-text", eventType: "",
dispatchEvent: function () {
return;
dispatchEvent() {
},
canRun: function () {
canRun() {
todo(false, "WidgetCommandEvent isn't tested");
return false;
},
@ -527,54 +525,54 @@ const kTests = [
},
{ description: "InternalClipboardEvent (copy)",
targetID: "input-text", eventType: "copy",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById("input-text").value = "go to clipboard!";
document.getElementById("input-text").focus();
document.getElementById("input-text").select();
synthesizeKey("c", { accelKey: true });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [ ],
},
{ description: "InternalUIEvent (DOMActivate)",
targetID: "button", eventType: "DOMActivate",
dispatchEvent: function () {
dispatchEvent() {
synthesizeMouseAtCenter(document.getElementById(this.targetID),
{ button: 0, shiftKey: true });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "InternalFocusEvent (focus)",
targetID: "input-text", eventType: "focus",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).focus();
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "InternalFocusEvent (blur)",
targetID: "input-text", eventType: "blur",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).blur();
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "WidgetSimpleGestureEvent",
targetID: "", eventType: "",
dispatchEvent: function () {
return;
dispatchEvent() {
},
canRun: function () {
canRun() {
// Simple gesture event may be handled before it comes content.
// So, we cannot test it in this test.
todo(false, "WidgetSimpleGestureEvent isn't tested");
@ -584,78 +582,78 @@ const kTests = [
},
{ description: "InternalTransitionEvent (transitionend)",
targetID: "a", eventType: "transitionend",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).focus();
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "InternalAnimationEvent (animationend)",
targetID: "animated-div", eventType: "animationend",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).className = "slidin";
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "InternalMutationEvent (DOMAttrModified)",
targetID: "animated-div", eventType: "DOMAttrModified",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById(this.targetID).setAttribute("x-data", "foo");
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "InternalMutationEvent (DOMNodeInserted)",
targetID: "animated-div", eventType: "DOMNodeInserted",
dispatchEvent: function () {
dispatchEvent() {
var div = document.createElement("div");
div.id = "inserted-div";
document.getElementById("animated-div").appendChild(div);
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "InternalMutationEvent (DOMNodeRemoved)",
targetID: "animated-div", eventType: "DOMNodeRemoved",
dispatchEvent: function () {
dispatchEvent() {
document.getElementById("animated-div").removeChild(document.getElementById("inserted-div"));
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "PointerEvent (pointerdown)",
targetID: "pointer-target", eventType: "mousedown",
dispatchEvent: function () {
dispatchEvent() {
var elem = document.getElementById(this.targetID);
var rect = elem.getBoundingClientRect();
synthesizeMouse(elem, rect.width/2, rect.height/2,
synthesizeMouse(elem, rect.width / 2, rect.height / 2,
{ type: this.eventType, button: 1, clickCount: 1, inputSource: 2, pressure: 0.25, isPrimary: true });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
},
{ description: "PointerEvent (pointerup)",
targetID: "pointer-target", eventType: "mouseup",
dispatchEvent: function () {
dispatchEvent() {
var elem = document.getElementById(this.targetID);
var rect = elem.getBoundingClientRect();
synthesizeMouse(elem, rect.width/2, rect.height/2,
synthesizeMouse(elem, rect.width / 2, rect.height / 2,
{ type: this.eventType, button: -1, ctrlKey: true, shiftKey: true, altKey: true, isSynthesized: false });
},
canRun: function () {
canRun() {
return true;
},
todoMismatch: [],
@ -680,8 +678,7 @@ function setAndObserveCompositionPref(aValue, aCallback) {
}
}
function doTest(aTest)
{
function doTest(aTest) {
if (!aTest.canRun()) {
SimpleTest.executeSoon(runNextTest);
return;
@ -691,7 +688,7 @@ function doTest(aTest)
gDescription = aTest.description + " (gCallPreventDefault=" + gCallPreventDefault + ")";
var target = aTest.target ? aTest.target() : document.getElementById(aTest.targetID);
target.addEventListener(aTest.eventType, onEvent, true);
gCallback = function () {
gCallback = function() {
target.removeEventListener(aTest.eventType, onEvent, true);
ok(gEvent !== null, gDescription + ": failed to get duplicated event");
ok(gCopiedEvent.length > 0, gDescription + ": count of attribute of the event must be larger than 0");
@ -720,8 +717,7 @@ function doTest(aTest)
}
var gIndex = -1;
function runNextTest()
{
function runNextTest() {
if (++gIndex == kTests.length) {
if (gCallPreventDefault) {
finish();
@ -741,7 +737,7 @@ function runNextTest()
if (document.activeElement) {
document.activeElement.blur();
}
window.requestAnimationFrame(function () {
window.requestAnimationFrame(function() {
setTimeout(runNextTest, 0);
});
return;
@ -749,9 +745,8 @@ function runNextTest()
doTest(kTests[gIndex]);
}
function init()
{
SpecialPowers.pushPrefEnv({"set":[["middlemouse.contentLoadURL", false],
function init() {
SpecialPowers.pushPrefEnv({"set": [["middlemouse.contentLoadURL", false],
["middlemouse.paste", false],
["general.autoScroll", false],
["dom.w3c_pointer_events.enabled", true],
@ -767,8 +762,7 @@ function init()
["mousewheel.with_meta.action.override_x", -1]]}, runNextTest);
}
function finish()
{
function finish() {
SimpleTest.finish();
}

View File

@ -19,8 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151186
SimpleTest.executeSoon(runTests);
});
function runTests()
{
function runTests() {
is(document.activeElement, document.getElementById("editor"),
"The div element should be focused");
var utils = SpecialPowers.getDOMWindowUtils(window);

View File

@ -18,11 +18,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=413277
</div>
<pre id="test">
<script class="testbody" type="application/javascript">
var atts='width=100, height=100, top=100, screenY=100';
atts += ', left=100, screenX=100, toolbar=no';
atts += ', location=no, directories=no, status=no';
atts += ', menubar=no, scrollbars=no, resizable=no';
var newWindow = window.open('_blank', 'win_name', atts);
var atts = "width=100, height=100, top=100, screenY=100";
atts += ", left=100, screenX=100, toolbar=no";
atts += ", location=no, directories=no, status=no";
atts += ", menubar=no, scrollbars=no, resizable=no";
var newWindow = window.open("_blank", "win_name", atts);
newWindow.resizeBy(1000000, 1000000);
SimpleTest.is(newWindow.outerWidth, newWindow.screen.availWidth, true);

View File

@ -24,13 +24,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565392
var dir1 = ds.get("ProfD", Ci.nsIFile);
var clipboard = Cc["@mozilla.org/widget/clipboard;1"]
.getService(Ci.nsIClipboard);
function getLoadContext() {
return window.docShell.QueryInterface(Ci.nsILoadContext);
}
function getTransferableFile(file) {
var transferable = Cc['@mozilla.org/widget/transferable;1']
var transferable = Cc["@mozilla.org/widget/transferable;1"]
.createInstance(Ci.nsITransferable);
transferable.init(getLoadContext());
transferable.setTransferData("application/x-moz-file", file);
@ -40,9 +40,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565392
function setClipboardData(transferable) {
clipboard.setData(transferable, null, 1);
}
function getClipboardData(mime) {
var transferable = Cc['@mozilla.org/widget/transferable;1']
var transferable = Cc["@mozilla.org/widget/transferable;1"]
.createInstance(Ci.nsITransferable);
transferable.init(getLoadContext());
transferable.addDataFlavor(mime);
@ -52,8 +52,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565392
return data;
}
setClipboardData(getTransferableFile(dir1))
is(clipboard.hasDataMatchingFlavors(["application/x-moz-file"], 1,1), true);
setClipboardData(getTransferableFile(dir1));
is(clipboard.hasDataMatchingFlavors(["application/x-moz-file"], 1, 1), true);
var data = getClipboardData("application/x-moz-file");
var file = data.value.QueryInterface(Ci.nsIFile);
ok(file.isDirectory(), true);

View File

@ -118,8 +118,7 @@ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
SimpleTest.waitForExplicitFinish();
function hitEventLoop(aFunc, aTimes)
{
function hitEventLoop(aFunc, aTimes) {
if (--aTimes) {
setTimeout(hitEventLoop, 0, aFunc, aTimes);
} else {
@ -140,8 +139,7 @@ const kIMEEnabledSupported = navigator.platform.indexOf("Mac") == 0 ||
// currently we should not run the open state testing.
const kIMEOpenSupported = false;
function runBasicTest(aIsEditable, aInDesignMode, aDescription)
{
function runBasicTest(aIsEditable, aInDesignMode, aDescription) {
var onIMEFocusBlurHandler = null;
var TIPCallback = function(aTIP, aNotification) {
switch (aNotification.type) {
@ -168,10 +166,8 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription)
return;
}
function test(aTest)
{
function moveFocus(aTest, aFocusEventHandler)
{
function test(aTest) {
function moveFocus(aTest, aFocusEventHandler) {
if (aInDesignMode) {
if (document.activeElement) {
document.activeElement.blur();
@ -218,8 +214,7 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription)
return (previousFocusedElement == focusedElement);
}
function testOpened(aTest, aOpened)
{
function testOpened(aTest, aOpened) {
document.getElementById("text").focus();
gUtils.IMEIsOpen = aOpened;
if (!moveFocus(aTest)) {
@ -239,8 +234,7 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription)
var IMEReceivesBlur = 0;
var IMEHasFocus = false;
function onFocus(aEvent)
{
function onFocus(aEvent) {
switch (aEvent.type) {
case "focus":
focusEventCount++;
@ -331,7 +325,7 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription)
aDescription + ": " + aTest.description + ", wrong input type");
} else if (aInDesignMode) {
is(inputtype, "",
aDescription + ": " + aTest.description + ", wrong input type")
aDescription + ": " + aTest.description + ", wrong input type");
}
}
@ -672,8 +666,7 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription)
}
}
function runPluginTest()
{
function runPluginTest() {
if (!kIMEEnabledSupported) {
return;
}
@ -712,8 +705,7 @@ function runPluginTest()
"runPluginTest: unexpected enabled state when input[type=text] has focus");
}
function runTypeChangingTest()
{
function runTypeChangingTest() {
if (!kIMEEnabledSupported)
return;
@ -876,7 +868,7 @@ function runTypeChangingTest()
description: "[type=\"password\"][ime-mode: inactive;]" },
{ id: "ime_mode_disabled_p",
type: "password", expected: gUtils.IME_STATUS_PASSWORD, imeMode: true,
description: "[type=\"password\"][ime-mode: disabled;]" }
description: "[type=\"password\"][ime-mode: disabled;]" },
];
const kInputTypes = [
@ -894,11 +886,10 @@ function runTypeChangingTest()
{ type: "email", expected: gUtils.IME_STATUS_ENABLED },
{ type: "search", expected: gUtils.IME_STATUS_ENABLED },
{ type: "tel", expected: gUtils.IME_STATUS_ENABLED },
{ type: "number", expected: gUtils.IME_STATUS_ENABLED }
{ type: "number", expected: gUtils.IME_STATUS_ENABLED },
];
function getExpectedIMEEnabled(aNewType, aInputControl)
{
function getExpectedIMEEnabled(aNewType, aInputControl) {
if (aNewType.expected == gUtils.IME_STATUS_DISABLED ||
aInputControl.isReadonly)
return gUtils.IME_STATUS_DISABLED;
@ -920,10 +911,10 @@ function runTypeChangingTest()
e.setAttribute("type", kInput.type);
is(gUtils.IMEStatus, kInput.expected,
"type attr changing test (IMEStatus): " + typeChangingDescription +
" (" + kInput.description + ")");
" (" + kInput.description + ")");
is(gUtils.focusedInputType, kInput.type,
"type attr changing test (type): " + typeChangingDescription +
" (" + kInput.description + ")");
" (" + kInput.description + ")");
const kTestOpenState = kIMEOpenSupported &&
gUtils.IMEStatus == gUtils.IME_STATUS_ENABLED &&
@ -941,14 +932,14 @@ function runTypeChangingTest()
is(gUtils.IMEStatus, getExpectedIMEEnabled(kType, kInput),
"type attr changing test (IMEStatus): " + typeChangingDescription +
" (" + kInput.description + ")");
" (" + kInput.description + ")");
is(gUtils.focusedInputType, kType.type,
"type attr changing test (type): " + typeChangingDescription +
" (" + kInput.description + ")");
" (" + kInput.description + ")");
if (kTestOpenState && gUtils.IMEStatus == gUtils.IME_STATUS_ENABLED) {
is(gUtils.IMEIsOpen, kOpened,
"type attr changing test (open state is changed): " +
typeChangingDescription + " (" + kInput.description + ")");
typeChangingDescription + " (" + kInput.description + ")");
}
}
// reset the type to default
@ -959,8 +950,7 @@ function runTypeChangingTest()
}
}
function runReadonlyChangingTest()
{
function runReadonlyChangingTest() {
if (!kIMEEnabledSupported)
return;
@ -980,7 +970,7 @@ function runReadonlyChangingTest()
{ id: "number",
type: "number", expected: gUtils.IME_STATUS_ENABLED },
{ id: "textarea",
type: "textarea", expected: gUtils.IME_STATUS_ENABLED }
type: "textarea", expected: gUtils.IME_STATUS_ENABLED },
];
const kOpenedState = [ true, false ];
@ -1010,8 +1000,7 @@ function runReadonlyChangingTest()
}
}
function runComplexContenteditableTests()
{
function runComplexContenteditableTests() {
if (!kIMEEnabledSupported) {
return;
}
@ -1079,8 +1068,7 @@ function runComplexContenteditableTests()
description + "IME is still enabled on the button, the container has been no editable");
description = "testOnIndependentEditor: ";
function testOnIndependentEditor(aEditor, aEditorDescription)
{
function testOnIndependentEditor(aEditor, aEditorDescription) {
var isReadonly = aEditor.readOnly;
var expectedState =
aEditor.readOnly ? gUtils.IME_STATUS_DISABLED : gUtils.IME_STATUS_ENABLED;
@ -1138,8 +1126,7 @@ function runComplexContenteditableTests()
"input[type=\"text\"][readonly]");
description = "testOnOutsideOfEditor: ";
function testOnOutsideOfEditor(aFocusNode, aFocusNodeDescription, aEditor)
{
function testOnOutsideOfEditor(aFocusNode, aFocusNodeDescription, aEditor) {
if (aFocusNode) {
aFocusNode.focus();
is(gFM.focusedElement, aFocusNode,
@ -1207,8 +1194,7 @@ function runComplexContenteditableTests()
testOnOutsideOfEditor(null, "nobody", div);
}
function runEditorFlagChangeTests()
{
function runEditorFlagChangeTests() {
if (!kIMEEnabledSupported) {
return;
}
@ -1241,10 +1227,10 @@ function runEditorFlagChangeTests()
{ "string": "\u3078\u3093\u3057\u3093",
"clauses":
[
{ "length": 4, "attr": COMPOSITION_ATTR_RAW_CLAUSE }
]
{ "length": 4, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
],
},
"caret": { "start": 4, "length": 0 }
"caret": { "start": 4, "length": 0 },
});
editor.flags &= ~kIMEStateChangeFlags;
@ -1271,14 +1257,12 @@ function runEditorFlagChangeTests()
container.removeAttribute("contenteditable");
}
function runEditableSubframeTests()
{
function runEditableSubframeTests() {
window.open("window_imestate_iframes.html", "_blank",
"width=600,height=600");
}
function runTestPasswordFieldOnDialog()
{
function runTestPasswordFieldOnDialog() {
if (!kIMEEnabledSupported) {
return;
}
@ -1289,30 +1273,22 @@ function runTestPasswordFieldOnDialog()
var dialog;
function WindowObserver()
{
function WindowObserver() {
Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService).
addObserver(this, "domwindowopened");
}
WindowObserver.prototype = {
QueryInterface: function (iid)
{
if (iid.equals(Ci.nsIObserver) ||
iid.equals(Ci.nsISupports)) {
return this;
}
},
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe: function (subject, topic, data)
{
observe(subject, topic, data) {
if (topic === "domwindowopened") {
ok(true, "dialog window is created");
dialog = subject.QueryInterface(Ci.nsIDOMWindow);
dialog.addEventListener("load", onPasswordDialogLoad);
}
}
},
};
var observer = new WindowObserver();
@ -1329,16 +1305,14 @@ function runTestPasswordFieldOnDialog()
var passwordField;
function onPasswordDialogLoad()
{
function onPasswordDialogLoad() {
ok(true, "onPasswordDialogLoad is called");
dialog.removeEventListener("load", onPasswordDialogLoad);
passwordField = dialog.document.getElementById("password1Textbox");
passwordField.addEventListener("focus", onPasswordFieldFocus);
}
function onPasswordFieldFocus()
{
function onPasswordFieldFocus() {
ok(true, "onPasswordFieldFocus is called");
passwordField.removeEventListener("focus", onPasswordFieldFocus);
var utils = dialog.windowUtils;
@ -1349,8 +1323,7 @@ function runTestPasswordFieldOnDialog()
}
// Bug 580388 and bug 808287
function runEditorReframeTests(aCallback)
{
function runEditorReframeTests(aCallback) {
if (document.activeElement) {
document.activeElement.blur();
}
@ -1396,16 +1369,16 @@ function runEditorReframeTests(aCallback)
input.style.overflow = "visible";
var onInput = function (aEvent) {
var onInput = function(aEvent) {
aEvent.target.style.overflow = "hidden";
}
};
input.addEventListener("input", onInput, true);
var AKey = new KeyboardEvent("", { key: "a", code: "KeyA", keyCode: KeyboardEvent.DOM_VK_A });
TIP.keydown(AKey);
TIP.keyup(AKey);
hitEventLoop(function () {
hitEventLoop(function() {
is(IMEFocus, 0, "runEditorReframeTests(): IME shouldn't receive a focus notification during reframing");
is(IMEBlur, 0, "runEditorReframeTests(): IME shouldn't receive a blur notification during reframing");
ok(IMEHasFocus, "runEditorReframeTests(): IME must have focus even after reframing");
@ -1441,8 +1414,7 @@ function runEditorReframeTests(aCallback)
}, 20);
}
function runTests()
{
function runTests() {
if (!kIMEEnabledSupported && !kIMEOpenSupported)
return;
@ -1488,17 +1460,16 @@ function runTests()
// test password field on dialog
// XXX temporary disable against failure
//runTestPasswordFieldOnDialog();
// runTestPasswordFieldOnDialog();
// Asynchronous tests
runEditorReframeTests(function () {
runEditorReframeTests(function() {
// This will call onFinish(), so, this test must be the last.
runEditableSubframeTests();
});
}
function onFinish()
{
function onFinish() {
SimpleTest.finish();
}

View File

@ -25,8 +25,7 @@
SimpleTest.waitForExplicitFinish();
async function testNativeKey(aKeyboardLayout, aNativeKeyCode, aModifiers,
aChars, aUnmodifiedChars)
{
aChars, aUnmodifiedChars) {
// XXX Need to listen keyup event here because synthesizeNativeKey() does not
// guarantee that its callback will be called after "keypress" and "keyup".
let waitForKeyUp = new Promise(resolve => {
@ -41,8 +40,7 @@ async function testNativeKey(aKeyboardLayout, aNativeKeyCode, aModifiers,
return keypress;
}
async function runTests()
{
async function runTests() {
await SpecialPowers.pushPrefEnv({"set": [
["dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content", true],
]});

View File

@ -105,7 +105,7 @@
expectations.push({
editable: [0, 0],
textarea: [0, 0],
input: [0, 0]
input: [0, 0],
});
// Move to end of line
@ -114,7 +114,7 @@
expectations.push({
editable: [73, 73],
textarea: [72, 72],
input: [732, 732]
input: [732, 732],
});
// Move down
@ -123,7 +123,7 @@
expectations.push({
editable: [140, 140],
textarea: [145, 145],
input: [732, 732]
input: [732, 732],
});
// Move to beginning of line
@ -132,7 +132,7 @@
expectations.push({
editable: [73, 73],
textarea: [73, 73],
input: [0, 0]
input: [0, 0],
});
// Move word right and modify selection
@ -141,7 +141,7 @@
expectations.push({
editable: [73, 84],
textarea: [73, 90],
input: [0, 10]
input: [0, 10],
});
// Move word right
@ -150,7 +150,7 @@
expectations.push({
editable: [84, 84],
textarea: [90, 90],
input: [10, 10]
input: [10, 10],
});
// Move word right
@ -159,7 +159,7 @@
expectations.push({
editable: [89, 89],
textarea: [95, 95],
input: [17, 17]
input: [17, 17],
});
// Move down and modify selection
@ -168,7 +168,7 @@
expectations.push({
editable: [89, 171],
textarea: [95, 175],
input: [17, 732]
input: [17, 732],
});
// Move backward and modify selection
@ -177,7 +177,7 @@
expectations.push({
editable: [89, 170],
textarea: [95, 174],
input: [17, 731]
input: [17, 731],
});
// Delete forward
@ -186,7 +186,7 @@
expectations.push({
editable: [89, 89],
textarea: [95, 95],
input: [17, 17]
input: [17, 17],
});
// Delete backward
@ -195,7 +195,7 @@
expectations.push({
editable: [88, 88],
textarea: [94, 94],
input: [16, 16]
input: [16, 16],
});
// Move backward
@ -204,7 +204,7 @@
expectations.push({
editable: [87, 87],
textarea: [93, 93],
input: [15, 15]
input: [15, 15],
});
// Move to beginning of paragraph (line for now)
@ -213,7 +213,7 @@
expectations.push({
editable: [73, 73],
textarea: [73, 73],
input: [0, 0]
input: [0, 0],
});
// Move forward
@ -222,7 +222,7 @@
expectations.push({
editable: [74, 74],
textarea: [74, 74],
input: [1, 1]
input: [1, 1],
});
// Move word right
@ -231,7 +231,7 @@
expectations.push({
editable: [84, 84],
textarea: [90, 90],
input: [10, 10]
input: [10, 10],
});
// Move word right
@ -240,7 +240,7 @@
expectations.push({
editable: [88, 88],
textarea: [94, 94],
input: [17, 17]
input: [17, 17],
});
// Delete to end of paragraph (line for now)
@ -249,7 +249,7 @@
expectations.push({
editable: [88, 88],
textarea: [94, 94],
input: [17, 17]
input: [17, 17],
});
// Move backward and modify selection
@ -258,7 +258,7 @@
expectations.push({
editable: [88, 87],
textarea: [93, 94],
input: [16, 17]
input: [16, 17],
});
// Move to end of paragraph (line for now)
@ -267,7 +267,7 @@
expectations.push({
editable: [139, 139],
textarea: [94, 94],
input: [17, 17]
input: [17, 17],
});
// Move up
@ -276,11 +276,10 @@
expectations.push({
editable: [73, 73],
textarea: [21, 21],
input: [0, 0]
input: [0, 0],
});
function checkWindowSelection(aElement, aSelection)
{
function checkWindowSelection(aElement, aSelection) {
let selection = window.getSelection();
is(selection.anchorOffset, aSelection[aElement.id][0],
@ -289,16 +288,14 @@
aElement.id + ": Incorrect focus offset");
}
function checkElementSelection(aElement, aSelection)
{
function checkElementSelection(aElement, aSelection) {
is(aElement.selectionStart, aSelection[aElement.id][0],
aElement.id + ": Incorrect selection start");
is(aElement.selectionEnd, aSelection[aElement.id][1],
aElement.id + ": Incorrect selection end");
}
function* testRun(aElement, aSelectionCheck, aCallback)
{
function* testRun(aElement, aSelectionCheck, aCallback) {
if (document.activeElement) {
document.activeElement.blur();
}
@ -324,8 +321,7 @@
let gTestContinuation = null;
function continueTest()
{
function continueTest() {
if (!gTestContinuation) {
gTestContinuation = doTest();
}

View File

@ -14,7 +14,7 @@ SimpleTest.requestFlakyTimeout("untriaged");
var childWindow;
function testStepOne() {
childWindow = window.open('window_picker_no_crash_child.html', 'childWindow', 'width=300,height=150');
childWindow = window.open("window_picker_no_crash_child.html", "childWindow", "width=300,height=150");
SimpleTest.waitForFocus(testStepTwo, childWindow);
}

View File

@ -47,7 +47,7 @@ function* doTest() {
yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {}, "+", "+", continueTest);
is(gPlugin.getLastKeyText(), "+", "Invalid character was inputted");
yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {altGrKey:1}, "~", "+", continueTest);
yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {altGrKey: 1}, "~", "+", continueTest);
is(gPlugin.getLastKeyText(), "~", "Invalid character was inputted");
}

View File

@ -34,8 +34,7 @@ function consistencyCheck(state) {
ok(s == "", "Consistency check: " + state + ": " + s);
}
function runTests()
{
function runTests() {
consistencyCheck("Initial state");
var scroll = document.getElementById("scroll");

View File

@ -24,7 +24,7 @@
<script>
function countPixels(canvas) {
let result = new Map;
let ctx = canvas.getContext('2d');
let ctx = canvas.getContext("2d");
let image = ctx.getImageData(0, 0, canvas.width, canvas.height);
let data = image.data;
let size = image.width * image.height;
@ -64,7 +64,7 @@ const LINUX_REFERENCES = [
["0,255,255", 1180],
];
let outer = document.querySelector('.outer');
let outer = document.querySelector(".outer");
let outerRect = outer.getBoundingClientRect();
if (outerRect.width == outer.clientWidth &&
outerRect.height == outer.clientHeight) {
@ -74,7 +74,7 @@ if (outerRect.width == outer.clientWidth &&
SpecialPowers.pushPrefEnv({
"set": [["layout.css.scrollbar-color.enabled", true]],
}, function() {
document.querySelector('#style').textContent = `
document.querySelector("#style").textContent = `
.outer { scrollbar-color: blue cyan; }
`;

View File

@ -32,18 +32,15 @@
SimpleTest.waitForExplicitFinish();
function sendAKeyEvent()
{
function sendAKeyEvent() {
synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_A, {}, "a", "a");
}
function isFocused(aElement)
{
function isFocused(aElement) {
return (SpecialPowers.focusManager.focusedElement == aElement);
}
function runTest()
{
function runTest() {
sendAKeyEvent();
ok(true, "Not crashed: input on the document");
$("input_text").focus();
@ -92,7 +89,7 @@
$("input_text").focus();
otherWindow.focus();
SimpleTest.waitForFocus(function () {
SimpleTest.waitForFocus(function() {
window.focus();
sendAKeyEvent();
ok(isFocused($("input_text")), "focused element isn't <input type=\"text\">");
@ -138,7 +135,6 @@
ok(true, "Not crashed: input on <input type=\"password\"> after the other document's <input type=\"password\"> has focus");
SimpleTest.finish();
}, otherWindow);
}

View File

@ -3,10 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//Basic tests to verify that MacSharingService returns expected data
// Basic tests to verify that MacSharingService returns expected data
function test_getSharingProviders()
{
function test_getSharingProviders() {
let sharingService = Cc["@mozilla.org/widget/macsharingservice;1"].
getService(Ci.nsIMacSharingService);
let providers = sharingService.getSharingProviders("http://example.org");
@ -20,7 +19,6 @@ function test_getSharingProviders()
});
}
function run_test()
{
function run_test() {
test_getSharingProviders();
}

View File

@ -3,10 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//Basic tests to verify that MacWebAppUtils works
// Basic tests to verify that MacWebAppUtils works
function test_find_app()
{
function test_find_app() {
var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"].
createInstance(Ci.nsIMacWebAppUtils);
let sig = "com.apple.TextEdit";
@ -17,8 +16,7 @@ function test_find_app()
Assert.notEqual(path, "");
}
function test_dont_find_fake_app()
{
function test_dont_find_fake_app() {
var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"].
createInstance(Ci.nsIMacWebAppUtils);
let sig = "calliope.penitentiary.dramamine";
@ -29,8 +27,7 @@ function test_dont_find_fake_app()
}
function run_test()
{
function run_test() {
test_find_app();
test_dont_find_fake_app();
}

View File

@ -5,8 +5,7 @@
// This tests taskbar jump list functionality available on win7 and up.
function test_basics()
{
function test_basics() {
var item = Cc["@mozilla.org/windows-jumplistitem;1"].
createInstance(Ci.nsIJumpListItem);
@ -41,8 +40,7 @@ function test_basics()
Assert.ok(shortcut.equals(shortcut));
}
function test_separator()
{
function test_separator() {
// separators:
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
@ -51,8 +49,7 @@ function test_separator()
Assert.ok(item.type == Ci.nsIJumpListItem.JUMPLIST_ITEM_SEPARATOR);
}
function test_hashes()
{
function test_hashes() {
var link = Cc["@mozilla.org/windows-jumplistlink;1"]
.createInstance(Ci.nsIJumpListLink);
var uri1 = Cc["@mozilla.org/network/simple-uri-mutator;1"]
@ -66,31 +63,31 @@ function test_hashes()
link.uri = uri1;
Assert.ok(link.compareHash(uri2))
Assert.ok(link.compareHash(uri2));
uri2 = uri2.mutate().setSpec("http://www.456.com/").finalize();
Assert.ok(!link.compareHash(uri2))
Assert.ok(!link.compareHash(uri2));
uri2 = uri2.mutate().setSpec("http://www.123.com/").finalize();
Assert.ok(link.compareHash(uri2))
Assert.ok(link.compareHash(uri2));
uri2 = uri2.mutate().setSpec("https://www.123.com/").finalize();
Assert.ok(!link.compareHash(uri2))
Assert.ok(!link.compareHash(uri2));
uri2 = uri2.mutate().setSpec("http://www.123.com/test/").finalize();
Assert.ok(!link.compareHash(uri2))
Assert.ok(!link.compareHash(uri2));
uri1 = uri1.mutate().setSpec("http://www.123.com/test/").finalize();
link.uri = uri1;
uri2 = uri2.mutate().setSpec("http://www.123.com/test/").finalize();
Assert.ok(link.compareHash(uri2))
Assert.ok(link.compareHash(uri2));
uri1 = uri1.mutate().setSpec("https://www.123.com/test/").finalize();
link.uri = uri1;
uri2 = uri2.mutate().setSpec("https://www.123.com/test/").finalize();
Assert.ok(link.compareHash(uri2))
Assert.ok(link.compareHash(uri2));
uri2 = uri2.mutate().setSpec("ftp://www.123.com/test/").finalize();
Assert.ok(!link.compareHash(uri2))
Assert.ok(!link.compareHash(uri2));
uri2 = uri2.mutate().setSpec("http://123.com/test/").finalize();
Assert.ok(!link.compareHash(uri2))
Assert.ok(!link.compareHash(uri2));
uri1 = uri1.mutate().setSpec("https://www.123.com/test/").finalize();
link.uri = uri1;
uri2 = uri2.mutate().setSpec("https://www.123.com/Test/").finalize();
Assert.ok(!link.compareHash(uri2))
Assert.ok(!link.compareHash(uri2));
uri1 = uri1.mutate().setSpec("http://www.123.com/").finalize();
link.uri = uri1;
@ -103,8 +100,7 @@ function test_hashes()
Assert.equal(link.uriHash, "iSx6UH1a9enVPzUA9JZ42g==");
}
function test_links()
{
function test_links() {
// links:
var link1 = Cc["@mozilla.org/windows-jumplistlink;1"]
.createInstance(Ci.nsIJumpListLink);
@ -138,8 +134,7 @@ function test_links()
Assert.ok(!link1.equals(link2));
}
function test_shortcuts()
{
function test_shortcuts() {
// shortcuts:
var sc = Cc["@mozilla.org/windows-jumplistshortcut;1"]
.createInstance(Ci.nsIJumpListShortcut);
@ -176,8 +171,7 @@ function test_shortcuts()
}
}
async function test_jumplist()
{
async function test_jumplist() {
// Jump lists can't register links unless the application is the default
// protocol handler for the protocol of the link, so we skip off testing
// those in these tests. We'll init the jump list for the xpc shell harness,
@ -259,8 +253,7 @@ async function test_jumplist()
}
}
function run_test()
{
function run_test() {
if (mozinfo.os != "win") {
return;
}

View File

@ -36,26 +36,22 @@
window.opener.wrappedJSObject.SimpleTest.waitForFocus(runTests, window);
function ok(aCondition, aMessage)
{
function ok(aCondition, aMessage) {
window.opener.wrappedJSObject.SimpleTest.ok(aCondition, aMessage);
}
function is(aLeft, aRight, aMessage)
{
function is(aLeft, aRight, aMessage) {
window.opener.wrappedJSObject.SimpleTest.is(aLeft, aRight, aMessage);
}
function onUnload()
{
function onUnload() {
window.opener.wrappedJSObject.onFinish();
}
var gFocusObservingElement = null;
var gBlurObservingElement = null;
function onFocus(aEvent)
{
function onFocus(aEvent) {
if (aEvent.target != gFocusObservingElement) {
return;
}
@ -64,8 +60,7 @@ function onFocus(aEvent)
gFocusObservingElement.willFocus = false;
}
function onBlur(aEvent)
{
function onBlur(aEvent) {
if (aEvent.target != gBlurObservingElement) {
return;
}
@ -75,8 +70,7 @@ function onBlur(aEvent)
}
function observeFocusBlur(aNextFocusedNode, aWillFireFocusEvent,
aNextBlurredNode, aWillFireBlurEvent)
{
aNextBlurredNode, aWillFireBlurEvent) {
if (gFocusObservingElement) {
if (gFocusObservingElement.willFocus) {
ok(false, "focus event was never fired on " + gFocusObservingElement);
@ -105,8 +99,7 @@ function observeFocusBlur(aNextFocusedNode, aWillFireFocusEvent,
}
}
function runTests()
{
function runTests() {
var utils = window.windowUtils;
var fm =
Cc["@mozilla.org/focus-manager;1"]
@ -117,8 +110,7 @@ function runTests()
var next = document.getElementById("next");
var html = document.documentElement;
function resetFocusToInput(aDescription)
{
function resetFocusToInput(aDescription) {
observeFocusBlur(null, false, null, false);
prev.focus();
is(fm.focusedElement, prev,
@ -127,8 +119,7 @@ function runTests()
"IME enabled on input#prev[readonly]: " + aDescription);
}
function resetFocusToParentHTML(aDescription)
{
function resetFocusToParentHTML(aDescription) {
observeFocusBlur(null, false, null, false);
html.focus();
is(fm.focusedElement, html,
@ -140,8 +131,7 @@ function runTests()
function testTabKey(aForward,
aNextFocusedNode, aWillFireFocusEvent,
aNextBlurredNode, aWillFireBlurEvent,
aIMEShouldBeEnabled, aTestingCaseDescription)
{
aIMEShouldBeEnabled, aTestingCaseDescription) {
observeFocusBlur(aNextFocusedNode, aWillFireFocusEvent,
aNextBlurredNode, aWillFireBlurEvent);
synthesizeKey("VK_TAB", { shiftKey: !aForward });
@ -161,8 +151,7 @@ function runTests()
function testMouseClick(aNextFocusedNode, aWillFireFocusEvent,
aWillAllNodeLostFocus,
aNextBlurredNode, aWillFireBlurEvent,
aIMEShouldBeEnabled, aTestingCaseDescription)
{
aIMEShouldBeEnabled, aTestingCaseDescription) {
observeFocusBlur(aNextFocusedNode, aWillFireFocusEvent,
aNextBlurredNode, aWillFireBlurEvent);
// We're relying on layout inside the iframe being up to date, so make it so
@ -177,8 +166,7 @@ function runTests()
description + "didn't set IME state as expected");
}
function testOnEditorFlagChange(aDescription, aIsInDesignMode)
{
function testOnEditorFlagChange(aDescription, aIsInDesignMode) {
const kReadonly =
Ci.nsIPlaintextEditor.eEditorReadonlyMask;
var description = "testOnEditorFlagChange: " + aDescription;

File diff suppressed because it is too large Load Diff