Skip to content

Commit

Permalink
Bug 1427754 - Enable ESLint rule mozilla/use-services for accessible/…
Browse files Browse the repository at this point in the history
… r=surkov

MozReview-Commit-ID: EJoFyhMfQzv

--HG--
extra : rebase_source : 4df24c322ff9144f9c38d4d8d7aff35ef0f7419d
  • Loading branch information
Standard8 committed Jan 3, 2018
1 parent e38403d commit ec4d7eb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module.exports = {
// XXX Bug 1421969. These files/directories are still being fixed,
// so turn off mozilla/use-services for them for now.
"files": [
"accessible/**",
// Browser: Bug 1421379
"browser/extensions/shield-recipe-client/test/browser/head.js",
"browser/modules/offlineAppCache.jsm",
Expand Down
7 changes: 1 addition & 6 deletions accessible/tests/mochitest/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,19 +710,14 @@ function getLoadContext() {
* Return text from clipboard.
*/
function getTextFromClipboard() {
var clip = Components.classes["@mozilla.org/widget/clipboard;1"].
getService(Components.interfaces.nsIClipboard);
if (!clip)
return "";

var trans = Components.classes["@mozilla.org/widget/transferable;1"].
createInstance(Components.interfaces.nsITransferable);
trans.init(getLoadContext());
if (!trans)
return "";

trans.addDataFlavor("text/unicode");
clip.getData(trans, clip.kGlobalClipboard);
Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard);

var str = {};
var strLength = {};
Expand Down
25 changes: 10 additions & 15 deletions accessible/tests/mochitest/elm/test_nsApplicationAcc.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,32 @@

<head>
<title>application accessible name</title>
<link rel="stylesheet" type="text/css"
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

<script type="application/javascript"
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
<script type="application/javascript"
src="../role.js"></script>

<script type="application/javascript">
/* import-globals-from ../common.js */
function doTest() {
var accessible = getApplicationAccessible();
if (!accessible) {
SimpleTest.finish();
return;
}

var bundleServ =
Components.classes["@mozilla.org/intl/stringbundle;1"].
getService(Components.interfaces.nsIStringBundleService);
var brandBundle =
bundleServ.createBundle("chrome://branding/locale/brand.properties");

var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
getService(Components.interfaces.nsIXULAppInfo);
Services.strings.createBundle("chrome://branding/locale/brand.properties");

// nsIAccessible::name
var applicationName = "";
if (LINUX || SOLARIS) {
applicationName = appInfo.name;
applicationName = Services.appinfo.name;
} else {
try {
applicationName = brandBundle.GetStringFromName("brandShortName");
Expand All @@ -45,10 +40,10 @@
is(accessible.name, applicationName, "wrong application accessible name");

// nsIAccessibleApplication
is(accessible.appName, appInfo.name, "Wrong application name");
is(accessible.appVersion, appInfo.version, "Wrong application version");
is(accessible.appName, Services.appinfo.name, "Wrong application name");
is(accessible.appVersion, Services.appinfo.version, "Wrong application version");
is(accessible.platformName, "Gecko", "Wrong platform name");
is(accessible.platformVersion, appInfo.platformVersion,
is(accessible.platformVersion, Services.appinfo.platformVersion,
"Wrong platform version");

SimpleTest.finish();
Expand Down
5 changes: 2 additions & 3 deletions accessible/tests/mochitest/textcaret/test_general.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
src="../events.js"></script>

<script type="application/javascript">
/* import-globals-from ../common.js */
/**
* Turn on/off the caret browsing mode.
*/
function turnCaretBrowsing(aIsOn) {
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("accessibility.browsewithcaret", aIsOn);
Services.prefs.setBoolPref("accessibility.browsewithcaret", aIsOn);
}

/**
Expand Down

0 comments on commit ec4d7eb

Please sign in to comment.