Bug 1257246: Update webextension APIs for eslint 2. r=kmag

ESLint 2 now flags anonymous generator functions that don't match the
generator-star-spacing rule so this mostly is fixing that.

MozReview-Commit-ID: 5sLaF26sd0E

--HG--
extra : rebase_source : 6008f48c94e4a8e5bd2ed2f8a95e764e4aa39cdb
extra : histedit_source : 6f0151c184ee2e4288f3ec9c5a85a65e975d46e1
This commit is contained in:
Dave Townsend 2016-04-05 11:30:51 -07:00
Родитель 6e44ebad84
Коммит b6c94f538f
10 изменённых файлов: 24 добавлений и 33 удалений

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

@ -195,11 +195,11 @@ CommandList.prototype = {
*/
getModifiersAttribute(chromeModifiers) {
let modifiersMap = {
"Alt" : "alt",
"Command" : "accel",
"Ctrl" : "accel",
"MacCtrl" : "control",
"Shift" : "shift",
"Alt": "alt",
"Command": "accel",
"Ctrl": "accel",
"MacCtrl": "control",
"Shift": "shift",
};
return Array.from(chromeModifiers, modifier => {
return modifiersMap[modifier];

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

@ -122,11 +122,11 @@ add_task(function* () {
// Set focus to some other window.
yield focusWindow(window);
yield triggerPopup(win1, function*() {
yield triggerPopup(win1, function* () {
yield checkWindow("popup", winId1, "win1");
});
yield triggerPopup(win2, function*() {
yield triggerPopup(win2, function* () {
yield checkWindow("popup", winId2, "win2");
});

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

@ -140,12 +140,12 @@ add_task(function* () {
// short timeout seems to consistently fix it.
yield new Promise(resolve => win1.setTimeout(resolve, 10));
yield triggerPopup(win1, function*() {
yield triggerPopup(win1, function* () {
yield checkViews("background", 2, 1);
yield checkViews("popup", 2, 1);
});
yield triggerPopup(win2, function*() {
yield triggerPopup(win2, function* () {
yield checkViews("background", 2, 1);
yield checkViews("popup", 2, 1);
});
@ -165,7 +165,7 @@ add_task(function* () {
info("opening win1 popup");
yield triggerPopup(win1, function*() {
yield triggerPopup(win1, function* () {
yield checkViews("background", 1, 1);
yield checkViews("tab", 1, 1);
yield checkViews("popup", 1, 1);
@ -173,7 +173,7 @@ add_task(function* () {
info("opening win2 popup");
yield triggerPopup(win2, function*() {
yield triggerPopup(win2, function* () {
yield checkViews("background", 1, 1);
yield checkViews("tab", 1, 1);
yield checkViews("popup", 1, 1);

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

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<script type="application/javascript">
"use strict";
throw new Error(`WebExt Privilege Escalation: BrowserAction: typeof(browser) = ${typeof(browser)}`);
</script>
</head>

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

@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<script type="application/javascript">
"use strict";
throw new Error(`WebExt Privilege Escalation: PageAction: typeof(browser) = ${typeof(browser)}`);
</script>
</head>

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

@ -78,10 +78,8 @@ function getBrowserActionPopup(extension, win = window) {
if (group.areaType == CustomizableUI.TYPE_TOOLBAR) {
return win.document.getElementById("customizationui-widget-panel");
} else {
return win.PanelUI.panel;
}
return null;
return win.PanelUI.panel;
}
var clickBrowserAction = Task.async(function* (extension, win = window) {

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

@ -84,6 +84,9 @@
// Space after colon not before in property declarations
"key-spacing": [2, {"beforeColon": false, "afterColon": true, "mode": "minimum"}],
// Require spaces before and after finally, catch, etc.
"keyword-spacing": 2,
// Unix linebreaks
"linebreak-style": [2, "unix"],
@ -102,9 +105,6 @@
// No duplicate cases in switch statements
"no-duplicate-case": 2,
// No labels
// "no-labels": 2,
// If an if block ends with a return no need for an else block
// "no-else-return": 2,
@ -207,15 +207,9 @@
// Never use spaces before function parentheses
"space-before-function-paren": [2, {"anonymous": "never", "named": "never"}],
// Require spaces before finally, catch, etc.
"space-before-keywords": [2, "always"],
// Require spaces around operators, except for a|0.
"space-infix-ops": [2, {"int32Hint": true}],
// Require spaces after return, throw and case
"space-return-throw-case": 2,
// ++ and -- should not need spacing
"space-unary-ops": [1, {"nonwords": false}],
@ -321,9 +315,6 @@
// Allow division operators explicitly at beginning of regular expression.
"no-div-regex": 0,
// Disallow use of labels for anything other then loops and switches.
"no-empty-label": 2,
// Disallow use of eval(). We have other APIs to evaluate code in content.
"no-eval": 2,
@ -345,6 +336,9 @@
// Allow comments inline after code.
"no-inline-comments": 0,
// Disallow use of labels for anything other then loops and switches.
"no-labels": [2, { "allowLoop": true }],
// Disallow use of multiline strings (use template strings instead).
"no-multi-str": 1,
@ -446,9 +440,6 @@
// Anyway, one-var is disabled.
"sort-vars": 0,
// Require a space after keywords.
"space-after-keywords": [2, "always"],
// Require a space immediately following the // in a line comment.
"spaced-comment": [2, "always"],

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

@ -546,7 +546,7 @@ DocumentManager = {
return promises[0];
},
enumerateWindows: function*(docShell) {
enumerateWindows: function* (docShell) {
let window = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
yield window;

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

@ -204,7 +204,7 @@ add_task(function* test_downloads() {
});
// check for leftover files in the download directory
add_task(function*() {
add_task(function* () {
let entries = downloadDir.directoryEntries;
while (entries.hasMoreElements()) {
let entry = entries.getNext().QueryInterface(Ci.nsIFile);

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

@ -505,8 +505,8 @@ function* test_once(skipCompleted) {
}
// Run the test twice to make sure it works with caching.
add_task(function*() { yield test_once(false); });
add_task(function*() { yield test_once(true); });
add_task(function* () { yield test_once(false); });
add_task(function* () { yield test_once(true); });
</script>
</body>