зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1521928 - Enable Eslint for widget (manual changes). r=Standard8,jmathies
Differential Revision: https://phabricator.services.mozilla.com/D18580 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e97abf832d
Коммит
88995bd9cf
|
@ -1,6 +1,7 @@
|
|||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function getString(clipboard) {
|
||||
var str = "";
|
||||
|
@ -29,8 +30,7 @@ function getString(clipboard) {
|
|||
}
|
||||
|
||||
add_task(async function test_clipboard() {
|
||||
let clipboard = Cc["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Ci.nsIClipboard);
|
||||
let clipboard = Services.clipboard;
|
||||
|
||||
// Test copy.
|
||||
const data = "random number: " + Math.random();
|
||||
|
|
|
@ -17,13 +17,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565392
|
|||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
/** Test for Bug 565392 **/
|
||||
|
||||
var ds = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
var dir1 = ds.get("ProfD", Ci.nsIFile);
|
||||
var clipboard = Cc["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Ci.nsIClipboard);
|
||||
var dir1 = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
var clipboard = Services.clipboard;
|
||||
|
||||
function getLoadContext() {
|
||||
return window.docShell.QueryInterface(Ci.nsILoadContext);
|
||||
|
|
|
@ -116,6 +116,8 @@ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
|||
|
||||
<script class="testbody" type="application/javascript">
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function hitEventLoop(aFunc, aTimes) {
|
||||
|
@ -127,8 +129,7 @@ function hitEventLoop(aFunc, aTimes) {
|
|||
}
|
||||
|
||||
var gUtils = window.windowUtils;
|
||||
var gFM = Cc["@mozilla.org/focus-manager;1"].
|
||||
getService(Ci.nsIFocusManager);
|
||||
var gFM = Services.focus;
|
||||
const kIMEEnabledSupported = navigator.platform.indexOf("Mac") == 0 ||
|
||||
navigator.platform.indexOf("Win") == 0 ||
|
||||
navigator.platform.indexOf("Linux") == 0;
|
||||
|
@ -167,7 +168,7 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription) {
|
|||
}
|
||||
|
||||
function test(aTest) {
|
||||
function moveFocus(aTest, aFocusEventHandler) {
|
||||
function moveFocus(aTestInner, aFocusEventHandler) {
|
||||
if (aInDesignMode) {
|
||||
if (document.activeElement) {
|
||||
document.activeElement.blur();
|
||||
|
@ -182,10 +183,8 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription) {
|
|||
var previousFocusedElement = gFM.focusedElement;
|
||||
var element = document.getElementById(aTest.id);
|
||||
var focusEventTarget = element;
|
||||
var subDocument = null;
|
||||
if (element.contentDocument) {
|
||||
focusEventTarget = element.contentDocument;
|
||||
subDocument = element.contentDocument;
|
||||
element = element.contentDocument.documentElement;
|
||||
}
|
||||
|
||||
|
@ -214,7 +213,7 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription) {
|
|||
return (previousFocusedElement == focusedElement);
|
||||
}
|
||||
|
||||
function testOpened(aTest, aOpened) {
|
||||
function testOpened(aTestInner, aOpened) {
|
||||
document.getElementById("text").focus();
|
||||
gUtils.IMEIsOpen = aOpened;
|
||||
if (!moveFocus(aTest)) {
|
||||
|
@ -317,7 +316,7 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription) {
|
|||
}
|
||||
|
||||
enabled = gUtils.IMEStatus;
|
||||
inputtype = gUtils.focusedInputType;
|
||||
var inputtype = gUtils.focusedInputType;
|
||||
is(enabled, aTest.expectedEnabled,
|
||||
aDescription + ": " + aTest.description + ", wrong enabled state");
|
||||
if (aTest.expectedType && !aInDesignMode) {
|
||||
|
@ -1069,7 +1068,6 @@ function runComplexContenteditableTests() {
|
|||
|
||||
description = "testOnIndependentEditor: ";
|
||||
function testOnIndependentEditor(aEditor, aEditorDescription) {
|
||||
var isReadonly = aEditor.readOnly;
|
||||
var expectedState =
|
||||
aEditor.readOnly ? gUtils.IME_STATUS_DISABLED : gUtils.IME_STATUS_ENABLED;
|
||||
var unexpectedStateDescription =
|
||||
|
@ -1274,9 +1272,7 @@ function runTestPasswordFieldOnDialog() {
|
|||
var dialog;
|
||||
|
||||
function WindowObserver() {
|
||||
Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService).
|
||||
addObserver(this, "domwindowopened");
|
||||
Services.obs.addObserver(this, "domwindowopened");
|
||||
}
|
||||
|
||||
WindowObserver.prototype = {
|
||||
|
@ -1292,16 +1288,12 @@ function runTestPasswordFieldOnDialog() {
|
|||
};
|
||||
|
||||
var observer = new WindowObserver();
|
||||
var arg1 = new Object(), arg2 = new Object();
|
||||
Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
||||
getService(Ci.nsIPromptService).
|
||||
promptPassword(window, "title", "text", arg1, "msg", arg2);
|
||||
var arg1 = {}, arg2 = {};
|
||||
Services.prompt.promptPassword(window, "title", "text", arg1, "msg", arg2);
|
||||
|
||||
ok(true, "password dialog was closed");
|
||||
|
||||
Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService).
|
||||
removeObserver(observer, "domwindowopened");
|
||||
Services.obs.addObserver(observer, "domwindowopened");
|
||||
|
||||
var passwordField;
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@
|
|||
|
||||
for (let i = 0; i < synthesizedKeys.length; i++) {
|
||||
synthesizedKeys[i].push(function() {
|
||||
aSelectionCheck.call(null, aElement, expectations[i]);
|
||||
aSelectionCheck(aElement, expectations[i]);
|
||||
continueTest();
|
||||
});
|
||||
var synthOk = synthesizeNativeKey.apply(null, synthesizedKeys[i]);
|
||||
|
|
|
@ -22,7 +22,7 @@ function testStepTwo() {
|
|||
childWindow.document.form1.uploadbox.click();
|
||||
// This should not crash the browser
|
||||
childWindow.close();
|
||||
setTimeout("testStepThree();", 5000);
|
||||
setTimeout(testStepThree, 5000);
|
||||
}
|
||||
|
||||
function testStepThree() {
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
sendAKeyEvent();
|
||||
ok(true, "Not crashed: input on <input type=\"text\"> changed from type=\"password\"");
|
||||
|
||||
otherWindow =
|
||||
var otherWindow =
|
||||
window.open("file_secure_input.html",
|
||||
"_blank", "chrome,width=100,height=100");
|
||||
ok(otherWindow, "failed to open other window");
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This tests taskbar jump list functionality available on win7 and up.
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function test_basics() {
|
||||
var item = Cc["@mozilla.org/windows-jumplistitem;1"].
|
||||
|
@ -156,10 +157,7 @@ function test_shortcuts() {
|
|||
sc.faviconPageUri = faviconPageUri;
|
||||
Assert.equal(sc.faviconPageUri, faviconPageUri);
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties).
|
||||
QueryInterface(Ci.nsIDirectoryService);
|
||||
var notepad = dirSvc.get("WinD", Ci.nsIFile);
|
||||
var notepad = Services.dirsvc.get("WinD", Ci.nsIFile);
|
||||
notepad.append("notepad.exe");
|
||||
if (notepad.exists()) {
|
||||
handlerApp.executable = notepad;
|
||||
|
@ -215,10 +213,7 @@ async function test_jumplist() {
|
|||
handlerApp.name = "Notepad";
|
||||
handlerApp.detailedDescription = "Testing detailed description.";
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties).
|
||||
QueryInterface(Ci.nsIDirectoryService);
|
||||
var notepad = dirSvc.get("WinD", Ci.nsIFile);
|
||||
var notepad = Services.dirsvc.get("WinD", Ci.nsIFile);
|
||||
notepad.append("notepad.exe");
|
||||
if (notepad.exists()) {
|
||||
// To ensure "profile-before-change" will fire before
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
</p>
|
||||
<script class="testbody" type="application/javascript">
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
window.opener.wrappedJSObject.SimpleTest.waitForFocus(runTests, window);
|
||||
|
||||
function ok(aCondition, aMessage) {
|
||||
|
@ -101,11 +103,9 @@ function observeFocusBlur(aNextFocusedNode, aWillFireFocusEvent,
|
|||
|
||||
function runTests() {
|
||||
var utils = window.windowUtils;
|
||||
var fm =
|
||||
Cc["@mozilla.org/focus-manager;1"]
|
||||
.getService(Ci.nsIFocusManager);
|
||||
var fm = Services.focus;
|
||||
|
||||
var iframe, editor, root, input;
|
||||
var iframe, editor, root;
|
||||
var prev = document.getElementById("prev");
|
||||
var next = document.getElementById("next");
|
||||
var html = document.documentElement;
|
||||
|
|
|
@ -20,6 +20,8 @@ window.opener.wrappedJSObject.SimpleTest.waitForFocus(prepareTests, window);
|
|||
|
||||
const nsIDOMWindowUtils = Ci.nsIDOMWindowUtils;
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const WHEEL_PAGESCROLL = 4294967295;
|
||||
|
||||
const WM_VSCROLL = 0x0115;
|
||||
|
@ -1103,8 +1105,7 @@ var gDeactiveWindowTests = [
|
|||
SpecialPowers.setIntPref(kHAmountPref, 3);
|
||||
},
|
||||
onLineScrollEvent(aEvent) {
|
||||
var fm = Cc["@mozilla.org/focus-manager;1"].
|
||||
getService(Ci.nsIFocusManager);
|
||||
var fm = Services.focus;
|
||||
is(fm.activeWindow, gOtherWindow, "The other window isn't activated");
|
||||
},
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче