mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1312055: Fix various eslint errors. r=standard8
MozReview-Commit-ID: 2XbldhBnofs --HG-- extra : rebase_source : f0c91dfbe37159077b8d0506913dd719fe577f17
This commit is contained in:
parent
6bc92def07
commit
5ae97524cb
@ -117,19 +117,19 @@ extensions.registerSchemaAPI("windows", "addon_parent", context => {
|
||||
}
|
||||
createData.incognito = incognito;
|
||||
|
||||
args.appendElement(tab, /*weak =*/ false);
|
||||
args.appendElement(tab, /* weak = */ false);
|
||||
} else if (createData.url !== null) {
|
||||
if (Array.isArray(createData.url)) {
|
||||
let array = Cc["@mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray);
|
||||
for (let url of createData.url) {
|
||||
array.AppendElement(mkstr(url));
|
||||
}
|
||||
args.appendElement(array, /*weak =*/ false);
|
||||
args.appendElement(array, /* weak = */ false);
|
||||
} else {
|
||||
args.appendElement(mkstr(createData.url), /*weak =*/ false);
|
||||
args.appendElement(mkstr(createData.url), /* weak = */ false);
|
||||
}
|
||||
} else {
|
||||
args.appendElement(mkstr(aboutNewTabService.newTabURL), /*weak =*/ false);
|
||||
args.appendElement(mkstr(aboutNewTabService.newTabURL), /* weak = */ false);
|
||||
}
|
||||
|
||||
let features = ["chrome"];
|
||||
|
@ -1,44 +1,44 @@
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that when a source map is missing/invalid, the rule view still loads
|
||||
// correctly.
|
||||
|
||||
const TESTCASE_URI = URL_ROOT + "doc_invalid_sourcemap.html";
|
||||
const PREF = "devtools.styleeditor.source-maps-enabled";
|
||||
const CSS_LOC = "doc_invalid_sourcemap.css:1";
|
||||
|
||||
add_task(function* () {
|
||||
Services.prefs.setBoolPref(PREF, true);
|
||||
|
||||
yield addTab(TESTCASE_URI);
|
||||
let {inspector, view} = yield openRuleView();
|
||||
|
||||
yield selectNode("div", inspector);
|
||||
|
||||
let ruleEl = getRuleViewRule(view, "div");
|
||||
ok(ruleEl, "The 'div' rule exists in the rule-view");
|
||||
|
||||
let prop = getRuleViewProperty(view, "div", "color");
|
||||
ok(prop, "The 'color' property exists in this rule");
|
||||
|
||||
let value = getRuleViewPropertyValue(view, "div", "color");
|
||||
is(value, "gold", "The 'color' property has the right value");
|
||||
|
||||
yield verifyLinkText(view, CSS_LOC);
|
||||
|
||||
Services.prefs.clearUserPref(PREF);
|
||||
});
|
||||
|
||||
function verifyLinkText(view, text) {
|
||||
info("Verifying that the rule-view stylesheet link is " + text);
|
||||
let label = getRuleViewLinkByIndex(view, 1)
|
||||
.querySelector(".ruleview-rule-source-label");
|
||||
return waitForSuccess(
|
||||
() => label.textContent == text,
|
||||
"Link text changed to display correct location: " + text
|
||||
);
|
||||
}
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that when a source map is missing/invalid, the rule view still loads
|
||||
// correctly.
|
||||
|
||||
const TESTCASE_URI = URL_ROOT + "doc_invalid_sourcemap.html";
|
||||
const PREF = "devtools.styleeditor.source-maps-enabled";
|
||||
const CSS_LOC = "doc_invalid_sourcemap.css:1";
|
||||
|
||||
add_task(function* () {
|
||||
Services.prefs.setBoolPref(PREF, true);
|
||||
|
||||
yield addTab(TESTCASE_URI);
|
||||
let {inspector, view} = yield openRuleView();
|
||||
|
||||
yield selectNode("div", inspector);
|
||||
|
||||
let ruleEl = getRuleViewRule(view, "div");
|
||||
ok(ruleEl, "The 'div' rule exists in the rule-view");
|
||||
|
||||
let prop = getRuleViewProperty(view, "div", "color");
|
||||
ok(prop, "The 'color' property exists in this rule");
|
||||
|
||||
let value = getRuleViewPropertyValue(view, "div", "color");
|
||||
is(value, "gold", "The 'color' property has the right value");
|
||||
|
||||
yield verifyLinkText(view, CSS_LOC);
|
||||
|
||||
Services.prefs.clearUserPref(PREF);
|
||||
});
|
||||
|
||||
function verifyLinkText(view, text) {
|
||||
info("Verifying that the rule-view stylesheet link is " + text);
|
||||
let label = getRuleViewLinkByIndex(view, 1)
|
||||
.querySelector(".ruleview-rule-source-label");
|
||||
return waitForSuccess(
|
||||
() => label.textContent == text,
|
||||
"Link text changed to display correct location: " + text
|
||||
);
|
||||
}
|
||||
|
@ -1,52 +1,52 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that canceling the element picker zooms back on the focused element. Bug 1224304.
|
||||
|
||||
const TEST_URL = URL_ROOT + "doc_inspector_long-divs.html";
|
||||
|
||||
add_task(function* () {
|
||||
let {inspector, toolbox, testActor} = yield openInspectorForURL(TEST_URL);
|
||||
|
||||
yield selectAndHighlightNode("#focus-here", inspector);
|
||||
ok((yield testActor.assertHighlightedNode("#focus-here")),
|
||||
"The highlighter focuses on div#focus-here");
|
||||
ok(isSelectedMarkupNodeInView(),
|
||||
"The currently selected node is on the screen.");
|
||||
|
||||
// Start the picker but skip focusing manually focusing on the target, let the element
|
||||
// picker do the focusing.
|
||||
yield startPicker(toolbox, true);
|
||||
yield moveMouseOver("#zoom-here");
|
||||
ok(!isSelectedMarkupNodeInView(),
|
||||
"The currently selected node is off the screen.");
|
||||
|
||||
yield cancelPickerByShortcut();
|
||||
ok(isSelectedMarkupNodeInView(),
|
||||
"The currently selected node is focused back on the screen.");
|
||||
|
||||
function cancelPickerByShortcut() {
|
||||
info("Key pressed. Waiting for picker to be canceled.");
|
||||
testActor.synthesizeKey({key: "VK_ESCAPE", options: {}});
|
||||
return inspector.toolbox.once("picker-canceled");
|
||||
}
|
||||
|
||||
function moveMouseOver(selector) {
|
||||
info(`Waiting for element ${selector} to be hovered in the markup view`);
|
||||
testActor.synthesizeMouse({
|
||||
options: {type: "mousemove"},
|
||||
center: true,
|
||||
selector: selector
|
||||
});
|
||||
return inspector.markup.once("showcontainerhovered");
|
||||
}
|
||||
|
||||
function isSelectedMarkupNodeInView() {
|
||||
const selectedNodeContainer = inspector.markup._selectedContainer.elt;
|
||||
const bounds = selectedNodeContainer.getBoundingClientRect();
|
||||
return bounds.top > 0 && bounds.bottom > 0;
|
||||
}
|
||||
});
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that canceling the element picker zooms back on the focused element. Bug 1224304.
|
||||
|
||||
const TEST_URL = URL_ROOT + "doc_inspector_long-divs.html";
|
||||
|
||||
add_task(function* () {
|
||||
let {inspector, toolbox, testActor} = yield openInspectorForURL(TEST_URL);
|
||||
|
||||
yield selectAndHighlightNode("#focus-here", inspector);
|
||||
ok((yield testActor.assertHighlightedNode("#focus-here")),
|
||||
"The highlighter focuses on div#focus-here");
|
||||
ok(isSelectedMarkupNodeInView(),
|
||||
"The currently selected node is on the screen.");
|
||||
|
||||
// Start the picker but skip focusing manually focusing on the target, let the element
|
||||
// picker do the focusing.
|
||||
yield startPicker(toolbox, true);
|
||||
yield moveMouseOver("#zoom-here");
|
||||
ok(!isSelectedMarkupNodeInView(),
|
||||
"The currently selected node is off the screen.");
|
||||
|
||||
yield cancelPickerByShortcut();
|
||||
ok(isSelectedMarkupNodeInView(),
|
||||
"The currently selected node is focused back on the screen.");
|
||||
|
||||
function cancelPickerByShortcut() {
|
||||
info("Key pressed. Waiting for picker to be canceled.");
|
||||
testActor.synthesizeKey({key: "VK_ESCAPE", options: {}});
|
||||
return inspector.toolbox.once("picker-canceled");
|
||||
}
|
||||
|
||||
function moveMouseOver(selector) {
|
||||
info(`Waiting for element ${selector} to be hovered in the markup view`);
|
||||
testActor.synthesizeMouse({
|
||||
options: {type: "mousemove"},
|
||||
center: true,
|
||||
selector: selector
|
||||
});
|
||||
return inspector.markup.once("showcontainerhovered");
|
||||
}
|
||||
|
||||
function isSelectedMarkupNodeInView() {
|
||||
const selectedNodeContainer = inspector.markup._selectedContainer.elt;
|
||||
const bounds = selectedNodeContainer.getBoundingClientRect();
|
||||
return bounds.top > 0 && bounds.bottom > 0;
|
||||
}
|
||||
});
|
||||
|
@ -27,7 +27,8 @@ function NetMonitorPanel(iframeWindow, toolbox) {
|
||||
this.shortcuts = new KeyShortcuts({
|
||||
window: this.panelDoc.defaultView,
|
||||
});
|
||||
this.shortcuts.on(L10N.getStr("netmonitor.toolbar.filterFreetext.key"), (name, event) => {
|
||||
let key = L10N.getStr("netmonitor.toolbar.filterFreetext.key");
|
||||
this.shortcuts.on(key, (name, event) => {
|
||||
event.preventDefault();
|
||||
this._view.RequestsMenu.freetextFilterBox.focus();
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ extensions.registerSchemaAPI("topSites", "addon_parent", context => {
|
||||
.map(link => {
|
||||
return {
|
||||
url: link.url,
|
||||
title: link.title
|
||||
title: link.title,
|
||||
};
|
||||
});
|
||||
return Promise.resolve(urls);
|
||||
|
@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Cu.import("resource://gre/modules/NewTabUtils.jsm");
|
||||
|
||||
|
||||
@ -7,20 +9,21 @@ function TestProvider(getLinksFn) {
|
||||
}
|
||||
|
||||
TestProvider.prototype = {
|
||||
addObserver: function (observer) {
|
||||
addObserver: function(observer) {
|
||||
this._observers.add(observer);
|
||||
},
|
||||
notifyLinkChanged: function (link, index=-1, deleted=false) {
|
||||
notifyLinkChanged: function(link, index = -1, deleted = false) {
|
||||
this._notifyObservers("onLinkChanged", link, index, deleted);
|
||||
},
|
||||
notifyManyLinksChanged: function () {
|
||||
notifyManyLinksChanged: function() {
|
||||
this._notifyObservers("onManyLinksChanged");
|
||||
},
|
||||
_notifyObservers: function (observerMethodName, ...args) {
|
||||
_notifyObservers: function(observerMethodName, ...args) {
|
||||
args.unshift(this);
|
||||
for (let obs of this._observers) {
|
||||
if (obs[observerMethodName])
|
||||
if (obs[observerMethodName]) {
|
||||
obs[observerMethodName].apply(NewTabUtils.links, args);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -36,7 +39,7 @@ function makeLinks(links) {
|
||||
url: link.url,
|
||||
title: link.title,
|
||||
lastVisitDate: now - i,
|
||||
frecency: frecency++
|
||||
frecency: frecency++,
|
||||
});
|
||||
});
|
||||
return places;
|
||||
@ -52,14 +55,14 @@ add_task(function* test_topSites() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": [
|
||||
"topSites"
|
||||
]
|
||||
"topSites",
|
||||
],
|
||||
},
|
||||
background() {
|
||||
browser.topSites.get(result => {
|
||||
browser.test.sendMessage("done", result);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
@ -119,13 +119,13 @@ const BookmarkSyncUtils = PlacesSyncUtils.bookmarks = Object.freeze({
|
||||
order: Task.async(function* (parentSyncId, childSyncIds) {
|
||||
PlacesUtils.SYNC_BOOKMARK_VALIDATORS.syncId(parentSyncId);
|
||||
if (!childSyncIds.length) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
let parentGuid = BookmarkSyncUtils.syncIdToGuid(parentSyncId);
|
||||
if (parentGuid == PlacesUtils.bookmarks.rootGuid) {
|
||||
// Reordering roots doesn't make sense, but Sync will do this on the
|
||||
// first sync.
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
let orderedChildrenGuids = childSyncIds.map(BookmarkSyncUtils.syncIdToGuid);
|
||||
return PlacesUtils.bookmarks.reorder(parentGuid, orderedChildrenGuids);
|
||||
|
Loading…
Reference in New Issue
Block a user