зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1311349 - Enable eslint of browser/components/translation/; r=florian,standard8
MozReview-Commit-ID: 4hIAnfs3qL0 --HG-- extra : rebase_source : 3290875db3979197f053c733e4364989c70d0407
This commit is contained in:
Родитель
ac8b575853
Коммит
64c26ae7b4
|
@ -69,7 +69,6 @@ browser/components/feeds/**
|
|||
browser/components/privatebrowsing/**
|
||||
browser/components/sessionstore/**
|
||||
browser/components/tabview/**
|
||||
browser/components/translation/**
|
||||
# generated files in cld2
|
||||
browser/components/translation/cld2/cld-worker.js
|
||||
browser/extensions/pdfjs/**
|
||||
|
|
|
@ -286,7 +286,7 @@ BingRequest.prototype = {
|
|||
* Initiates the request
|
||||
*/
|
||||
fireRequest: function() {
|
||||
return Task.spawn(function *(){
|
||||
return Task.spawn(function *() {
|
||||
// Prepare authentication.
|
||||
let token = yield BingTokenManager.getToken();
|
||||
let auth = "Bearer " + token;
|
||||
|
|
|
@ -166,7 +166,7 @@ this.TranslationDocument.prototype = {
|
|||
item.original.push(objInMap);
|
||||
str += this.generateTextForItem(objInMap);
|
||||
wasLastItemPlaceholder = false;
|
||||
} else {
|
||||
} else if (!wasLastItemPlaceholder) {
|
||||
// Otherwise, if this node doesn't contain any useful content,
|
||||
// or if it is a root itself, we can replace it with a placeholder node.
|
||||
// We can't simply eliminate this node from our string representation
|
||||
|
@ -174,11 +174,9 @@ this.TranslationDocument.prototype = {
|
|||
// probably merge two separate text nodes).
|
||||
// It's not necessary to add more than one placeholder in sequence;
|
||||
// we can optimize them away.
|
||||
if (!wasLastItemPlaceholder) {
|
||||
item.original.push(TranslationItem_NodePlaceholder);
|
||||
str += '<br>';
|
||||
wasLastItemPlaceholder = true;
|
||||
}
|
||||
item.original.push(TranslationItem_NodePlaceholder);
|
||||
str += '<br>';
|
||||
wasLastItemPlaceholder = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,9 +275,15 @@ TranslationItem.prototype = {
|
|||
isSimpleRoot: false,
|
||||
|
||||
toString: function() {
|
||||
let rootType = this.isRoot
|
||||
? (this.isSimpleRoot ? ' (simple root)' : ' (non simple root)')
|
||||
: '';
|
||||
let rootType = "";
|
||||
if (this.isRoot) {
|
||||
if (this.isSimpleRoot) {
|
||||
rootType = " (simple root)";
|
||||
}
|
||||
else {
|
||||
rootType = " (non simple root)";
|
||||
}
|
||||
}
|
||||
return "[object TranslationItem: <" + this.nodeRef.localName + ">"
|
||||
+ rootType + "]";
|
||||
},
|
||||
|
|
|
@ -293,7 +293,7 @@ YandexRequest.prototype = {
|
|||
* Initiates the request
|
||||
*/
|
||||
fireRequest: function() {
|
||||
return Task.spawn(function *(){
|
||||
return Task.spawn(function *() {
|
||||
// Prepare URL.
|
||||
let url = getUrlParam("https://translate.yandex.net/api/v1.5/tr.json/translate",
|
||||
"browser.translation.yandex.translateURLOverride");
|
||||
|
|
|
@ -125,7 +125,7 @@ for (let code of Object.keys(Encodings)) {
|
|||
|
||||
addOnPreMain(function() {
|
||||
|
||||
onmessage = function(aMsg){
|
||||
onmessage = function(aMsg) {
|
||||
let data = aMsg['data'];
|
||||
|
||||
let langInfo;
|
||||
|
|
|
@ -103,7 +103,7 @@ add_task(function* test_handling_out_of_valid_key_error() {
|
|||
*
|
||||
* @param filename Name of a fixture file.
|
||||
*/
|
||||
function constructFixtureURL(filename){
|
||||
function constructFixtureURL(filename) {
|
||||
// Deduce the Mochitest server address in use from a pref that was pre-processed.
|
||||
let server = Services.prefs.getCharPref("browser.translation.bing.authURL")
|
||||
.replace("http://", "");
|
||||
|
|
|
@ -24,7 +24,7 @@ var MetricsChecker = {
|
|||
DETECT_LANG : Services.telemetry.getHistogramById("SHOULD_AUTO_DETECT_LANGUAGE"),
|
||||
},
|
||||
|
||||
reset: function(){
|
||||
reset: function() {
|
||||
for (let i of Object.keys(this.HISTOGRAMS)) {
|
||||
this.HISTOGRAMS[i].clear();
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ var MetricsChecker = {
|
|||
/**
|
||||
* A recurrent loop for making assertions about collected metrics.
|
||||
*/
|
||||
_assertionLoop: function (prevMetrics, metrics, additions){
|
||||
_assertionLoop: function (prevMetrics, metrics, additions) {
|
||||
for (let metric of Object.keys(additions)) {
|
||||
let addition = additions[metric];
|
||||
// Allows nesting metrics. Useful for keyed histograms.
|
||||
|
@ -117,9 +117,9 @@ var translate = Task.async(function*(text, from, closeTab = true) {
|
|||
yield acceptTranslationOffer(tab);
|
||||
if (closeTab) {
|
||||
gBrowser.removeTab(tab);
|
||||
} else {
|
||||
return tab;
|
||||
return null;
|
||||
}
|
||||
return tab;
|
||||
});
|
||||
|
||||
function waitForMessage({messageManager}, name) {
|
||||
|
|
|
@ -91,7 +91,7 @@ add_task(function* test_preference_attribution() {
|
|||
*
|
||||
* @param filename Name of a fixture file.
|
||||
*/
|
||||
function constructFixtureURL(filename){
|
||||
function constructFixtureURL(filename) {
|
||||
// Deduce the Mochitest server address in use from a pref that was pre-processed.
|
||||
let server = Services.prefs.getCharPref("browser.translation.yandex.translateURLOverride")
|
||||
.replace("http://", "");
|
||||
|
|
Загрузка…
Ссылка в новой задаче