Bug 1443081 - Apply spacing via `eslint --fix` for DevTools. r=jdescottes

MozReview-Commit-ID: 2RVNt140Zte
This commit is contained in:
J. Ryan Stinnett 2018-03-12 13:24:38 -05:00
Родитель 257437c8fe
Коммит 23ff4cc75d
1420 изменённых файлов: 7101 добавлений и 7101 удалений

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

@ -61,10 +61,10 @@ var AboutDebugging = {
// Used to track async requests in tests. See bug 1444424 for better ideas.
EventEmitter.decorate(AboutDebugging);
window.addEventListener("DOMContentLoaded", function () {
window.addEventListener("DOMContentLoaded", function() {
AboutDebugging.init();
}, {once: true});
window.addEventListener("unload", function () {
window.addEventListener("unload", function() {
AboutDebugging.destroy();
}, {once: true});

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

@ -32,7 +32,7 @@ function closeToolbox() {
* @param {String} addonID
* String id of the addon to debug.
*/
exports.debugLocalAddon = async function (addonID) {
exports.debugLocalAddon = async function(addonID) {
// Close previous addon debugging toolbox.
closeToolbox();
@ -52,7 +52,7 @@ exports.debugLocalAddon = async function (addonID) {
* @param {DebuggerClient} client
* Required for remote debugging.
*/
exports.debugRemoteAddon = async function (addonForm, client) {
exports.debugRemoteAddon = async function(addonForm, client) {
// Close previous addon debugging toolbox.
closeToolbox();
@ -72,16 +72,16 @@ exports.debugRemoteAddon = async function (addonForm, client) {
});
};
exports.uninstallAddon = async function (addonID) {
exports.uninstallAddon = async function(addonID) {
let addon = await AddonManager.getAddonByID(addonID);
return addon && addon.uninstall();
};
exports.isTemporaryID = function (addonID) {
exports.isTemporaryID = function(addonID) {
return AddonManagerPrivate.isTemporaryInstallID(addonID);
};
exports.isLegacyTemporaryExtension = function (addonForm) {
exports.isLegacyTemporaryExtension = function(addonForm) {
if (!addonForm.type) {
// If about:debugging is connected to an older then 59 remote Firefox, and type is
// not available on the addon/webextension actors, return false to avoid showing
@ -94,7 +94,7 @@ exports.isLegacyTemporaryExtension = function (addonForm) {
!addonForm.isAPIExtension;
};
exports.parseFileUri = function (url) {
exports.parseFileUri = function(url) {
// Strip a leading slash from Windows drive letter URIs.
// file:///home/foo ~> /home/foo
// file:///C:/foo ~> C:/foo

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

@ -62,7 +62,7 @@ function createDescriptorFromURL(url) {
* - client: a DebuggerClient instance
* - connect: a connection descriptor, see doc for createDescriptorFromURL(url).
*/
exports.createClient = async function () {
exports.createClient = async function() {
let href = window.location.href;
let url = new window.URL(href.replace("about:", "http://"));

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

@ -21,7 +21,7 @@ loader.lazyRequireGetter(this, "Toolbox",
* @param {Object} workerActor
* worker actor form to debug
*/
exports.debugWorker = function (client, workerActor) {
exports.debugWorker = function(client, workerActor) {
client.attachWorker(workerActor, (response, workerClient) => {
let workerTarget = TargetFactory.forWorker(workerClient);
gDevTools.showToolbox(workerTarget, "jsdebugger", Toolbox.HostType.WINDOW)

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

@ -58,7 +58,7 @@ add_task(function* () {
// which lives in another process. So do not try to use any scope variable!
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
let testScript = function () {
let testScript = function() {
/* eslint-disable no-undef */
toolbox.selectTool("webconsole")
.then(console => {

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

@ -33,7 +33,7 @@ add_task(function* testWebExtensionsToolboxWebConsole() {
// which lives in another process. So do not try to use any scope variable!
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
let testScript = function () {
let testScript = function() {
/* eslint-disable no-undef */
function findMessages(hud, text, selector = ".message") {
const messages = hud.ui.outputNode.querySelectorAll(selector);

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

@ -32,7 +32,7 @@ add_task(function* testWebExtensionsToolboxInspector() {
// which lives in another process. So do not try to use any scope variable!
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
let testScript = function () {
let testScript = function() {
/* eslint-disable no-undef */
toolbox.selectTool("inspector")
.then(inspector => {

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

@ -34,7 +34,7 @@ add_task(function* testWebExtensionsToolboxNoBackgroundPage() {
// which lives in another process. So do not try to use any scope variable!
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
let testScript = function () {
let testScript = function() {
/* eslint-disable no-undef */
toolbox.selectTool("inspector")
.then(inspector => {

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

@ -84,7 +84,7 @@ add_task(function* testWebExtensionsToolboxSwitchToPopup() {
// which lives in another process. So do not try to use any scope variable!
let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
let testScript = function () {
let testScript = function() {
/* eslint-disable no-undef */
let jsterm;

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

@ -26,9 +26,9 @@ add_task(function* () {
info("Make the test page notify us when the service worker sends a message.");
yield ContentTask.spawn(swTab.linkedBrowser, {}, function () {
yield ContentTask.spawn(swTab.linkedBrowser, {}, function() {
let win = content.wrappedJSObject;
win.navigator.serviceWorker.addEventListener("message", function (event) {
win.navigator.serviceWorker.addEventListener("message", function(event) {
sendAsyncMessage(event.data);
});
});

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

@ -80,7 +80,7 @@ add_task(function* () {
is(pushURL.textContent, FAKE_ENDPOINT, "The push service URL looks correct");
// Unsubscribe from the push service.
ContentTask.spawn(swTab.linkedBrowser, {}, function () {
ContentTask.spawn(swTab.linkedBrowser, {}, function() {
let win = content.wrappedJSObject;
return win.sub.unsubscribe();
});

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

@ -39,7 +39,7 @@ add_task(function* () {
// Click on it and wait for the toolbox to be ready
let onToolboxReady = new Promise(done => {
gDevTools.once("toolbox-ready", function (e, toolbox) {
gDevTools.once("toolbox-ready", function(e, toolbox) {
done(toolbox);
});
});

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

@ -215,7 +215,7 @@ function* uninstallAddon({document, id, name}) {
yield new Promise(done => {
AddonManager.getAddonByID(id, addon => {
let listener = {
onUninstalled: function (uninstalledAddon) {
onUninstalled: function(uninstalledAddon) {
if (uninstalledAddon != addon) {
return;
}
@ -334,7 +334,7 @@ function* unregisterServiceWorker(tab, serviceWorkersElement) {
* @param {window} win
*/
function waitForDelayedStartupFinished(win) {
return new Promise(function (resolve) {
return new Promise(function(resolve) {
Services.obs.addObserver(function observer(subject, topic) {
if (win == subject) {
Services.obs.removeObserver(observer, topic);
@ -426,7 +426,7 @@ function* enableServiceWorkerDebugging() {
function promiseAddonEvent(event) {
return new Promise(resolve => {
let listener = {
[event]: function (...args) {
[event]: function(...args) {
AddonManager.removeAddonListener(listener);
resolve(args);
}

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

@ -10,10 +10,10 @@
var sw = navigator.serviceWorker.register("delay-sw.js");
sw.then(
function () {
function() {
dump("SW registered\n");
},
function (e) {
function(e) {
dump("SW not registered: " + e + "\n");
}
);

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

@ -12,6 +12,6 @@ function wait(ms) {
}
// Wait for one second to switch from installing to installed.
self.addEventListener("install", function (event) {
self.addEventListener("install", function(event) {
event.waitUntil(wait(1000));
});

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

@ -10,10 +10,10 @@
var sw = navigator.serviceWorker.register("empty-sw.js");
sw.then(
function () {
function() {
dump("SW registered\n");
},
function (e) {
function(e) {
dump("SW not registered: " + e + "\n");
}
);

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

@ -10,10 +10,10 @@
var sw = navigator.serviceWorker.register("fetch-sw.js", {scope: "fetch-sw/"});
sw.then(
function () {
function() {
dump("SW registered\n");
},
function (e) {
function(e) {
dump("SW not registered: " + e + "\n");
}
);

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

@ -1,6 +1,6 @@
"use strict";
// Bug 1328293
self.onfetch = function (event) {
self.onfetch = function(event) {
// do nothing.
};

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

@ -13,7 +13,7 @@
var sub = null;
// The registration promise is expected as a global by head.js's unregisterServiceWorker.
var sw = (async function () {
var sw = (async function() {
await new Promise(resolve => {
let perm = { type: "desktop-notification", allow: true, context: document };
SpecialPowers.pushPermissions([perm], resolve);

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

@ -8,26 +8,26 @@
// Send a message to all controlled windows.
function postMessage(message) {
return clients.matchAll().then(function (clientlist) {
clientlist.forEach(function (client) {
return clients.matchAll().then(function(clientlist) {
clientlist.forEach(function(client) {
client.postMessage(message);
});
});
}
// Don't wait for the next page load to become the active service worker.
self.addEventListener("install", function (event) {
self.addEventListener("install", function(event) {
event.waitUntil(self.skipWaiting());
});
// Claim control over the currently open test page when activating.
self.addEventListener("activate", function (event) {
event.waitUntil(self.clients.claim().then(function () {
self.addEventListener("activate", function(event) {
event.waitUntil(self.clients.claim().then(function() {
return postMessage("sw-claimed");
}));
});
// Forward all "push" events to the controlled window.
self.addEventListener("push", function (event) {
self.addEventListener("push", function(event) {
event.waitUntil(postMessage("sw-pushed"));
});

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

@ -196,7 +196,7 @@ var AnimationsController = {
resolver();
}),
startListeners: function () {
startListeners: function() {
// Re-create the list of players when a new node is selected, except if the
// sidebar isn't visible.
gInspector.selection.on("new-node-front", this.onNewNodeFront);
@ -204,7 +204,7 @@ var AnimationsController = {
gToolbox.on("select", this.onPanelVisibilityChange);
},
stopListeners: function () {
stopListeners: function() {
gInspector.selection.off("new-node-front", this.onNewNodeFront);
gInspector.sidebar.off("select", this.onPanelVisibilityChange);
gToolbox.off("select", this.onPanelVisibilityChange);
@ -213,7 +213,7 @@ var AnimationsController = {
}
},
isPanelVisible: function () {
isPanelVisible: function() {
return gToolbox.currentToolId === "inspector" &&
gInspector.sidebar &&
gInspector.sidebar.getCurrentTabID() == "animationinspector";
@ -256,7 +256,7 @@ var AnimationsController = {
/**
* Toggle (pause/play) all animations in the current target.
*/
toggleAll: function () {
toggleAll: function() {
if (!this.traits.hasToggleAll) {
return promise.resolve();
}
@ -349,7 +349,7 @@ var AnimationsController = {
}
}),
onAnimationMutations: function (changes) {
onAnimationMutations: function(changes) {
// Insert new players into this.animationPlayers when new animations are
// added.
for (let {type, player} of changes) {
@ -392,7 +392,7 @@ var AnimationsController = {
return time;
},
destroyAnimationPlayers: function () {
destroyAnimationPlayers: function() {
this.animationPlayers = [];
}
};

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

@ -120,7 +120,7 @@ var AnimationsPanel = {
resolver();
}),
startListeners: function () {
startListeners: function() {
AnimationsController.on(AnimationsController.PLAYERS_UPDATED_EVENT,
this.refreshAnimationsUI);
@ -146,7 +146,7 @@ var AnimationsPanel = {
}
},
stopListeners: function () {
stopListeners: function() {
AnimationsController.off(AnimationsController.PLAYERS_UPDATED_EVENT,
this.refreshAnimationsUI);
@ -173,7 +173,7 @@ var AnimationsPanel = {
}
},
onKeyDown: function (event) {
onKeyDown: function(event) {
// If the space key is pressed, it should toggle the play state of
// the animations displayed in the panel, or of all the animations on
// the page if the selected node does not have any animation on it.
@ -187,7 +187,7 @@ var AnimationsPanel = {
}
},
togglePlayers: function (isVisible) {
togglePlayers: function(isVisible) {
if (isVisible) {
document.body.removeAttribute("empty");
document.body.setAttribute("timeline", "true");
@ -199,15 +199,15 @@ var AnimationsPanel = {
}
},
onPickerStarted: function () {
onPickerStarted: function() {
this.pickerButtonEl.classList.add("checked");
},
onPickerStopped: function () {
onPickerStopped: function() {
this.pickerButtonEl.classList.remove("checked");
},
onToggleAllClicked: function () {
onToggleAllClicked: function() {
this.toggleAll().catch(console.error);
},
@ -220,7 +220,7 @@ var AnimationsPanel = {
yield AnimationsController.toggleAll();
}),
onTimelinePlayClicked: function () {
onTimelinePlayClicked: function() {
this.playPauseTimeline().catch(console.error);
},
@ -234,13 +234,13 @@ var AnimationsPanel = {
* @return {Promise} Resolves when the playState is changed and the UI
* is refreshed
*/
playPauseTimeline: function () {
playPauseTimeline: function() {
return AnimationsController
.toggleCurrentAnimations(this.timelineData.isMoving)
.then(() => this.refreshAnimationsStateAndUI());
},
onTimelineRewindClicked: function () {
onTimelineRewindClicked: function() {
this.rewindTimeline().catch(console.error);
},
@ -250,7 +250,7 @@ var AnimationsPanel = {
*
* @return {Promise} Resolves when currentTime is set and the UI is refreshed
*/
rewindTimeline: function () {
rewindTimeline: function() {
return AnimationsController
.setCurrentTimeAll(0, true)
.then(() => this.refreshAnimationsStateAndUI());
@ -260,17 +260,17 @@ var AnimationsPanel = {
* Set the playback rate of all current animations shown in the timeline to
* the value of this.rateSelectorEl.
*/
onRateChanged: function (rate) {
onRateChanged: function(rate) {
AnimationsController.setPlaybackRateAll(rate)
.then(() => this.refreshAnimationsStateAndUI())
.catch(console.error);
},
onTabNavigated: function () {
onTabNavigated: function() {
this.toggleAllButtonEl.classList.remove("paused");
},
onTimelineDataChanged: function (data) {
onTimelineDataChanged: function(data) {
this.timelineData = data;
let {isMoving, isUserDrag, time} = data;
@ -298,7 +298,7 @@ var AnimationsPanel = {
this.displayTimelineCurrentTime();
},
displayTimelineCurrentTime: function () {
displayTimelineCurrentTime: function() {
let {time} = this.timelineData;
this.timelineCurrentTimeEl.textContent = formatStopwatchTime(time);
},

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

@ -36,18 +36,18 @@ AnimationDetails.prototype = {
NON_PROPERTIES: ["easing", "composite", "computedOffset",
"offset", "simulateComputeValuesFailure"],
init: function (containerEl) {
init: function(containerEl) {
this.containerEl = containerEl;
},
destroy: function () {
destroy: function() {
this.unrender();
this.containerEl = null;
this.serverTraits = null;
this.progressIndicatorEl = null;
},
unrender: function () {
unrender: function() {
for (let component of this.keyframeComponents) {
component.destroy();
}
@ -58,7 +58,7 @@ AnimationDetails.prototype = {
}
},
getPerfDataForProperty: function (animation, propertyName) {
getPerfDataForProperty: function(animation, propertyName) {
let warning = "";
let className = "";
if (animation.state.propertyState) {
@ -135,7 +135,7 @@ AnimationDetails.prototype = {
new this.win.Animation(new this.win.KeyframeEffect(null, null, timing), null);
}),
renderAnimatedPropertiesHeader: function () {
renderAnimatedPropertiesHeader: function() {
// Add animated property header.
const headerEl = createNode({
parent: this.containerEl,
@ -172,7 +172,7 @@ AnimationDetails.prototype = {
}
},
renderAnimatedPropertiesBody: function (animationTypes) {
renderAnimatedPropertiesBody: function(animationTypes) {
// Add animated property body.
const bodyEl = createNode({
parent: this.containerEl,
@ -237,7 +237,7 @@ AnimationDetails.prototype = {
}
},
renderProgressIndicator: function () {
renderProgressIndicator: function() {
// The wrapper represents the area which the indicator is displayable.
const progressIndicatorWrapperEl = createNode({
parent: this.containerEl,
@ -259,7 +259,7 @@ AnimationDetails.prototype = {
});
},
indicateProgress: function (time) {
indicateProgress: function(time) {
if (!this.progressIndicatorEl) {
// Not displayed yet.
return;

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

@ -29,12 +29,12 @@ function AnimationTargetNode(inspector, options) {
exports.AnimationTargetNode = AnimationTargetNode;
AnimationTargetNode.prototype = {
init: function (containerEl) {
init: function(containerEl) {
this.previewer.init(containerEl);
this.isDestroyed = false;
},
destroy: function () {
destroy: function() {
this.previewer.destroy();
this.inspector = null;
this.isDestroyed = true;

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

@ -36,25 +36,25 @@ function AnimationTimeBlock() {
exports.AnimationTimeBlock = AnimationTimeBlock;
AnimationTimeBlock.prototype = {
init: function (containerEl) {
init: function(containerEl) {
this.containerEl = containerEl;
this.containerEl.addEventListener("click", this.onClick);
},
destroy: function () {
destroy: function() {
this.containerEl.removeEventListener("click", this.onClick);
this.unrender();
this.containerEl = null;
this.animation = null;
},
unrender: function () {
unrender: function() {
while (this.containerEl.firstChild) {
this.containerEl.firstChild.remove();
}
},
render: function (animation, tracks) {
render: function(animation, tracks) {
this.unrender();
this.animation = animation;
@ -147,7 +147,7 @@ AnimationTimeBlock.prototype = {
* the bounds of DOM.
* @param {Object} animation
*/
update: function (animation) {
update: function(animation) {
this.animation = animation;
this.updateSummaryGraphViewBox(this.containerEl.querySelector(".summary"));
const delayEl = this.containerEl.querySelector(".delay");
@ -165,7 +165,7 @@ AnimationTimeBlock.prototype = {
* TimeScale.
* @param {Element} summaryEl - SVG element for summary graph.
*/
updateSummaryGraphViewBox: function (summaryEl) {
updateSummaryGraphViewBox: function(summaryEl) {
const {x, delayW} = TimeScale.getAnimationDimensions(this.animation);
const totalDisplayedDuration = this.getTotalDisplayedDuration();
const strokeHeightForViewBox = 0.5 / this.containerEl.clientHeight;
@ -182,7 +182,7 @@ AnimationTimeBlock.prototype = {
* Update bounds of element which represents delay to fit to latest TimeScale.
* @param {Element} delayEl - which represents delay.
*/
updateDelayBounds: function (delayEl) {
updateDelayBounds: function(delayEl) {
const {delayX, delayW} = TimeScale.getAnimationDimensions(this.animation);
delayEl.style.left = `${ delayX }%`;
delayEl.style.width = `${ delayW }%`;
@ -192,17 +192,17 @@ AnimationTimeBlock.prototype = {
* Update bounds of element which represents endDelay to fit to latest TimeScale.
* @param {Element} endDelayEl - which represents endDelay.
*/
updateEndDelayBounds: function (endDelayEl) {
updateEndDelayBounds: function(endDelayEl) {
const {endDelayX, endDelayW} = TimeScale.getAnimationDimensions(this.animation);
endDelayEl.style.left = `${ endDelayX }%`;
endDelayEl.style.width = `${ endDelayW }%`;
},
getTotalDisplayedDuration: function () {
getTotalDisplayedDuration: function() {
return this.animation.state.playbackRate * TimeScale.getDuration();
},
getTooltipText: function (state) {
getTooltipText: function(state) {
let getTime = time => L10N.getFormatStr("player.timeLabel",
L10N.numberWithDecimals(time / 1000, 2));
@ -301,7 +301,7 @@ AnimationTimeBlock.prototype = {
return text;
},
onClick: function (e) {
onClick: function(e) {
e.stopPropagation();
this.emit("selected", this.animation);
},

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

@ -67,7 +67,7 @@ function AnimationsTimeline(inspector, serverTraits) {
exports.AnimationsTimeline = AnimationsTimeline;
AnimationsTimeline.prototype = {
init: function (containerEl) {
init: function(containerEl) {
this.win = containerEl.ownerDocument.defaultView;
this.rootWrapperEl = containerEl;
@ -79,7 +79,7 @@ AnimationsTimeline.prototype = {
this.onWindowResize);
},
setupSplitBox: function () {
setupSplitBox: function() {
const browserRequire = this.win.BrowserLoader({
window: this.win,
useOnlyShared: true
@ -111,7 +111,7 @@ AnimationsTimeline.prototype = {
this.animationRootEl = this.rootWrapperEl.querySelector(".animation-root");
},
setupAnimationTimeline: function () {
setupAnimationTimeline: function() {
const animationTimelineEl = this.rootWrapperEl.querySelector(".animation-timeline");
let scrubberContainer = createNode({
@ -174,7 +174,7 @@ AnimationsTimeline.prototype = {
});
},
setupAnimationDetail: function () {
setupAnimationDetail: function() {
const animationDetailEl = this.rootWrapperEl.querySelector(".animation-detail");
const animationDetailHeaderEl = createNode({
@ -229,7 +229,7 @@ AnimationsTimeline.prototype = {
this.details.init(this.animatedPropertiesEl);
},
destroy: function () {
destroy: function() {
this.stopAnimatingScrubber();
this.unrender();
this.details.destroy();
@ -268,7 +268,7 @@ AnimationsTimeline.prototype = {
/**
* Destroy all sub-components that have been created and stored on this instance.
*/
destroyAllSubComponents: function () {
destroyAllSubComponents: function() {
for (let actorID in this.componentsMap) {
this.destroySubComponents(actorID);
}
@ -278,7 +278,7 @@ AnimationsTimeline.prototype = {
* Destroy sub-components which related to given actor id.
* @param {String} actor id
*/
destroySubComponents: function (actorID) {
destroySubComponents: function(actorID) {
const components = this.componentsMap[actorID];
components.timeBlock.destroy();
components.targetNode.destroy();
@ -288,7 +288,7 @@ AnimationsTimeline.prototype = {
delete this.componentsMap[actorID];
},
unrender: function () {
unrender: function() {
for (let animation of this.animations) {
animation.off("changed", this.onAnimationStateChanged);
}
@ -300,7 +300,7 @@ AnimationsTimeline.prototype = {
this.details.unrender();
},
onWindowResize: function () {
onWindowResize: function() {
// Don't do anything if the root element has a width of 0
if (this.rootWrapperEl.offsetWidth === 0) {
return;
@ -364,7 +364,7 @@ AnimationsTimeline.prototype = {
/**
* When move the scrubber to the corresponding position
*/
onScrubberMouseDown: function (e) {
onScrubberMouseDown: function(e) {
this.moveScrubberTo(e.pageX);
this.win.addEventListener("mouseup", this.onScrubberMouseUp);
this.win.addEventListener("mouseout", this.onScrubberMouseOut);
@ -374,11 +374,11 @@ AnimationsTimeline.prototype = {
e.preventDefault();
},
onScrubberMouseUp: function () {
onScrubberMouseUp: function() {
this.cancelTimeHeaderDragging();
},
onScrubberMouseOut: function (e) {
onScrubberMouseOut: function(e) {
// Check that mouseout happened on the window itself, and if yes, cancel
// the dragging.
if (!this.win.document.contains(e.relatedTarget)) {
@ -386,17 +386,17 @@ AnimationsTimeline.prototype = {
}
},
cancelTimeHeaderDragging: function () {
cancelTimeHeaderDragging: function() {
this.win.removeEventListener("mouseup", this.onScrubberMouseUp);
this.win.removeEventListener("mouseout", this.onScrubberMouseOut);
this.win.removeEventListener("mousemove", this.onScrubberMouseMove);
},
onScrubberMouseMove: function (e) {
onScrubberMouseMove: function(e) {
this.moveScrubberTo(e.pageX);
},
moveScrubberTo: function (pageX, noOffset) {
moveScrubberTo: function(pageX, noOffset) {
this.stopAnimatingScrubber();
// The offset needs to be in % and relative to the timeline's area (so we
@ -423,7 +423,7 @@ AnimationsTimeline.prototype = {
});
},
getCompositorStatusClassName: function (state) {
getCompositorStatusClassName: function(state) {
let className = state.isRunningOnCompositor
? " fast-track"
: "";
@ -523,7 +523,7 @@ AnimationsTimeline.prototype = {
this.emit("animation-timeline-rendering-completed");
}),
updateAnimation: function (animation, tracks, existentComponents) {
updateAnimation: function(animation, tracks, existentComponents) {
// If keyframes (tracks) and effect timing (state) are not changed, we update the
// view box only.
// As an exception, if iterationCount reprensents Infinity, we need to re-render
@ -546,7 +546,7 @@ AnimationsTimeline.prototype = {
}
},
renderAnimation: function (animation, tracks, animationEl) {
renderAnimation: function(animation, tracks, animationEl) {
animationEl.setAttribute("class",
"animation " + animation.state.type +
this.getCompositorStatusClassName(animation.state));
@ -583,20 +583,20 @@ AnimationsTimeline.prototype = {
};
},
isAtLeastOneAnimationPlaying: function () {
isAtLeastOneAnimationPlaying: function() {
return this.animations.some(({state}) => state.playState === "running");
},
wasRewound: function () {
wasRewound: function() {
return !this.isAtLeastOneAnimationPlaying() &&
this.animations.every(({state}) => state.currentTime === 0);
},
hasInfiniteAnimations: function () {
hasInfiniteAnimations: function() {
return this.animations.some(({state}) => !state.iterationCount);
},
startAnimatingScrubber: function (time) {
startAnimatingScrubber: function(time) {
let isOutOfBounds = time < TimeScale.minStartTime ||
time > TimeScale.maxEndTime;
let isAllPaused = !this.isAtLeastOneAnimationPlaying();
@ -638,20 +638,20 @@ AnimationsTimeline.prototype = {
});
},
stopAnimatingScrubber: function () {
stopAnimatingScrubber: function() {
if (this.rafID) {
this.win.cancelAnimationFrame(this.rafID);
this.rafID = null;
}
},
onAnimationStateChanged: function () {
onAnimationStateChanged: function() {
// For now, simply re-render the component. The animation front's state has
// already been updated.
this.render(this.animations);
},
drawHeaderAndBackground: function () {
drawHeaderAndBackground: function() {
let width = this.timeHeaderEl.offsetWidth;
let animationDuration = TimeScale.maxEndTime - TimeScale.minStartTime;
let minTimeInterval = TIME_GRADUATION_MIN_SPACING *
@ -692,14 +692,14 @@ AnimationsTimeline.prototype = {
}
},
onTimelineDataChanged: function ({ time }) {
onTimelineDataChanged: function({ time }) {
this.currentTime = time;
const indicateTime =
TimeScale.minStartTime === Infinity ? 0 : this.currentTime + TimeScale.minStartTime;
this.details.indicateProgress(indicateTime);
},
onDetailCloseButtonClick: function (e) {
onDetailCloseButtonClick: function(e) {
if (!this.animationRootEl.classList.contains("animation-detail-visible")) {
return;
}

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

@ -23,7 +23,7 @@ function Keyframes() {}
exports.Keyframes = Keyframes;
Keyframes.prototype = {
init: function (containerEl) {
init: function(containerEl) {
this.containerEl = containerEl;
this.keyframesEl = createNode({
@ -32,12 +32,12 @@ Keyframes.prototype = {
});
},
destroy: function () {
destroy: function() {
this.keyframesEl.remove();
this.containerEl = this.keyframesEl = this.animation = null;
},
render: function ({keyframes, propertyName, animation, animationType}) {
render: function({keyframes, propertyName, animation, animationType}) {
this.keyframes = keyframes;
this.propertyName = propertyName;
this.animation = animation;

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

@ -31,7 +31,7 @@ function RateSelector() {
exports.RateSelector = RateSelector;
RateSelector.prototype = {
init: function (containerEl) {
init: function(containerEl) {
this.selectEl = createNode({
parent: containerEl,
nodeType: "select",
@ -44,17 +44,17 @@ RateSelector.prototype = {
this.selectEl.addEventListener("change", this.onRateChanged);
},
destroy: function () {
destroy: function() {
this.selectEl.removeEventListener("change", this.onRateChanged);
this.selectEl.remove();
this.selectEl = null;
},
getAnimationsRates: function (animations) {
getAnimationsRates: function(animations) {
return sortedUnique(animations.map(a => a.state.playbackRate));
},
getAllRates: function (animations) {
getAllRates: function(animations) {
let animationsRates = this.getAnimationsRates(animations);
if (animationsRates.length > 1) {
return PLAYBACK_RATES;
@ -63,7 +63,7 @@ RateSelector.prototype = {
return sortedUnique(PLAYBACK_RATES.concat(animationsRates));
},
render: function (animations) {
render: function(animations) {
let allRates = this.getAnimationsRates(animations);
let hasOneRate = allRates.length === 1;
@ -94,7 +94,7 @@ RateSelector.prototype = {
}
},
onRateChanged: function () {
onRateChanged: function() {
let rate = parseFloat(this.selectEl.value);
if (!isNaN(rate)) {
this.emit("rate-changed", rate);

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

@ -71,7 +71,7 @@ ProgressGraphHelper.prototype = {
/**
* Destory this object.
*/
destroy: function () {
destroy: function() {
this.targetEl.remove();
this.animation.cancel();
@ -89,7 +89,7 @@ ProgressGraphHelper.prototype = {
* Return animation duration.
* @return {Number} duration
*/
getDuration: function () {
getDuration: function() {
return this.animation.effect.timing.duration;
},
@ -97,7 +97,7 @@ ProgressGraphHelper.prototype = {
* Return animation's keyframe.
* @return {Object} keyframe
*/
getKeyframes: function () {
getKeyframes: function() {
return this.keyframes;
},
@ -106,7 +106,7 @@ ProgressGraphHelper.prototype = {
* @return {String} if property is 'opacity' or 'transform', return that value.
* Otherwise, return given animation type in constructor.
*/
getGraphType: function () {
getGraphType: function() {
return (this.propertyJSName === "opacity" || this.propertyJSName === "transform")
? this.propertyJSName : this.animationType;
},
@ -118,7 +118,7 @@ ProgressGraphHelper.prototype = {
* - y: y value of graph (float between 0 - 1)
* - style: the computed style value of the property at the time
*/
getSegment: function (time) {
getSegment: function(time) {
this.animation.currentTime = time;
const style = this.win.getComputedStyle(this.targetEl)[this.propertyJSName];
const value = this.valueHelperFunction(style);
@ -130,7 +130,7 @@ ProgressGraphHelper.prototype = {
* @return {function} ValueHelperFunction returns float value of Y axis
* from given progress and style (e.g. rgb(0, 0, 0))
*/
getValueHelperFunction: function () {
getValueHelperFunction: function() {
switch (this.animationType) {
case "none": {
return () => 1;
@ -158,7 +158,7 @@ ProgressGraphHelper.prototype = {
* @return {function} ValueHelperFunction returns float value of Y axis
* from given float (e.g. 1.0, 0.5 and so on)
*/
getFloatValueHelperFunction: function () {
getFloatValueHelperFunction: function() {
let maxValue = 0;
let minValue = Infinity;
this.keyframes.forEach(keyframe => {
@ -176,7 +176,7 @@ ProgressGraphHelper.prototype = {
* @return {function} ValueHelperFunction returns float value of Y axis
* from given style (e.g. 100px)
*/
getCoordinateValueHelperFunction: function () {
getCoordinateValueHelperFunction: function() {
let maxValue = 0;
let minValue = Infinity;
for (let i = 0, n = this.keyframes.length; i < n; i++) {
@ -200,7 +200,7 @@ ProgressGraphHelper.prototype = {
* @return {function} ValueHelperFunction returns float value of Y axis
* from given color (e.g. rgb(0, 0, 0))
*/
getColorValueHelperFunction: function () {
getColorValueHelperFunction: function() {
const maxObject = { distance: 0 };
for (let i = 0; i < this.keyframes.length - 1; i++) {
const value1 = getRGBA(this.keyframes[i].value);
@ -229,7 +229,7 @@ ProgressGraphHelper.prototype = {
* @return {function} ValueHelperFunction returns float value of Y axis
* from given style (e.g. center)
*/
getDiscreteValueHelperFunction: function () {
getDiscreteValueHelperFunction: function() {
const discreteValues = [];
this.keyframes.forEach(keyframe => {
// Set style once since the computed value may differ from specified keyframe value.
@ -255,7 +255,7 @@ ProgressGraphHelper.prototype = {
* @return {Array} path segments -
* [{x: {Number} time, y: {Number} progress}, ...]
*/
createPathSegments: function (duration, minSegmentDuration, minProgressThreshold) {
createPathSegments: function(duration, minSegmentDuration, minProgressThreshold) {
if (!this.valueHelperFunction) {
return createKeyframesPathSegments(duration, this.devtoolsKeyframes);
}
@ -300,7 +300,7 @@ ProgressGraphHelper.prototype = {
* @param {String} cls - Class name.
* @return {Element} path element.
*/
appendShapePath: function (parentEl, pathSegments, cls) {
appendShapePath: function(parentEl, pathSegments, cls) {
return appendShapePath(parentEl, pathSegments, cls);
},
@ -311,7 +311,7 @@ ProgressGraphHelper.prototype = {
* @param {String} cls - Class name.
* @return {Element} path element.
*/
appendLinePath: function (parentEl, pathSegments, cls) {
appendLinePath: function(parentEl, pathSegments, cls) {
const isClosePathNeeded = false;
return appendPathElement(parentEl, pathSegments, cls, isClosePathNeeded);
},
@ -366,7 +366,7 @@ SummaryGraphHelper.prototype = {
/**
* Destory this object.
*/
destroy: function () {
destroy: function() {
this.animation.cancel();
this.targetEl.remove();
this.targetEl = null;
@ -381,7 +381,7 @@ SummaryGraphHelper.prototype = {
* computed timing progress.
* @param {Object} keyframes - Should have offset and easing, or null.
*/
setKeyframes: function (keyframes) {
setKeyframes: function(keyframes) {
let frames = null;
// We need to change the duration resolution in case of interval of keyframes offset
// was narrow.
@ -426,7 +426,7 @@ SummaryGraphHelper.prototype = {
* @param {bool} isOriginalBehavior - true: original behavior
* false: according to spec.
*/
setOriginalBehavior: function (isOriginalBehavior) {
setOriginalBehavior: function(isOriginalBehavior) {
this.isOriginalBehavior = isOriginalBehavior;
},
@ -434,7 +434,7 @@ SummaryGraphHelper.prototype = {
* Set animation fill mode.
* @param {String} fill - "both", "forwards", "backwards" or "both"
*/
setFillMode: function (fill) {
setFillMode: function(fill) {
this.animation.effect.timing.fill = fill;
},
@ -442,7 +442,7 @@ SummaryGraphHelper.prototype = {
* Set true if need to close path in appendShapePath.
* @param {bool} isClosePathNeeded - true: close, false: open.
*/
setClosePathNeeded: function (isClosePathNeeded) {
setClosePathNeeded: function(isClosePathNeeded) {
this.isClosePathNeeded = isClosePathNeeded;
},
@ -450,7 +450,7 @@ SummaryGraphHelper.prototype = {
* SummaryGraphHelper searches and creates the summary graph untill the progress
* distance is less than this minProgressThreshold.
*/
setMinProgressThreshold: function (minProgressThreshold) {
setMinProgressThreshold: function(minProgressThreshold) {
this.minProgressThreshold = minProgressThreshold;
},
@ -460,7 +460,7 @@ SummaryGraphHelper.prototype = {
* - x: x value of graph (float)
* - y: y value of graph (float between 0 - 1)
*/
getSegment: function (time) {
getSegment: function(time) {
if (this.isOriginalBehavior) {
// If the given time is less than 0, returned progress is 0.
if (time < 0) {
@ -482,7 +482,7 @@ SummaryGraphHelper.prototype = {
* @return {Array} path segments -
* [{x: {Number} time, y: {Number} progress}, ...]
*/
createPathSegments: function (startTime, endTime) {
createPathSegments: function(startTime, endTime) {
return createPathSegments(startTime, endTime, this.minSegmentDuration,
this.minProgressThreshold, this, this.durationResolution);
},
@ -495,7 +495,7 @@ SummaryGraphHelper.prototype = {
* @param {String} cls - Class name.
* @return {Element} path element.
*/
appendShapePath: function (parentEl, pathSegments, cls) {
appendShapePath: function(parentEl, pathSegments, cls) {
return appendShapePath(parentEl, pathSegments, cls, this.isClosePathNeeded);
},
@ -503,7 +503,7 @@ SummaryGraphHelper.prototype = {
* Return current computed timing progress of the animation.
* @return {float} computed timing progress as float value of Y axis.
*/
getProgressValue: function () {
getProgressValue: function() {
return Math.max(this.animation.effect.getComputedTiming().progress, 0);
},
@ -511,7 +511,7 @@ SummaryGraphHelper.prototype = {
* Return current computed 'opacity' value of the element which is animating.
* @return {float} computed timing progress as float value of Y axis.
*/
getOpacityValue: function () {
getOpacityValue: function() {
return this.win.getComputedStyle(this.targetEl).opacity;
}
};

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

@ -16,7 +16,7 @@
* or pause
* - {Boolean} pause True to pause the animation, false to play.
*/
addMessageListener("Test:ToggleAnimationPlayer", function (msg) {
addMessageListener("Test:ToggleAnimationPlayer", function(msg) {
let {selector, animationIndex, pause} = msg.data;
let node = superQuerySelector(selector);
if (!node) {
@ -41,7 +41,7 @@ addMessageListener("Test:ToggleAnimationPlayer", function (msg) {
* - {Number} animationIndex The index of the node's animationPlayers to change.
* - {Number} currentTime The current time to set.
*/
addMessageListener("Test:SetAnimationPlayerCurrentTime", function (msg) {
addMessageListener("Test:SetAnimationPlayerCurrentTime", function(msg) {
let {selector, animationIndex, currentTime} = msg.data;
let node = superQuerySelector(selector);
if (!node) {
@ -62,7 +62,7 @@ addMessageListener("Test:SetAnimationPlayerCurrentTime", function (msg) {
* - {Number} animationIndex The index of the node's animationPlayers to change.
* - {Number} playbackRate The rate to set.
*/
addMessageListener("Test:SetAnimationPlayerPlaybackRate", function (msg) {
addMessageListener("Test:SetAnimationPlayerPlaybackRate", function(msg) {
let {selector, animationIndex, playbackRate} = msg.data;
let node = superQuerySelector(selector);
if (!node) {
@ -82,7 +82,7 @@ addMessageListener("Test:SetAnimationPlayerPlaybackRate", function (msg) {
* selector).
* - {Number} animationIndex The index of the node's animationPlayers to check
*/
addMessageListener("Test:GetAnimationPlayerState", function (msg) {
addMessageListener("Test:GetAnimationPlayerState", function(msg) {
let {selector, animationIndex} = msg.data;
let node = superQuerySelector(selector);
if (!node) {

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

@ -47,7 +47,7 @@
/* globals KeyframeEffect, Animation */
"use strict";
setTimeout(function () {
setTimeout(function() {
document.querySelector(".css-transition").style.backgroundColor = "yellow";
}, 0);

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

@ -54,11 +54,11 @@
// The non-delayed animation starts now.
zero.classList.add("move");
// The negative-delayed animation starts in 1 second.
setTimeout(function () {
setTimeout(function() {
negative.classList.add("move");
}, 1000);
// The positive-delayed animation starts in 200 ms.
setTimeout(function () {
setTimeout(function() {
positive.classList.add("move");
}, 200);
</script>

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

@ -50,7 +50,7 @@ function enableAnimationFeatures() {
* @return a promise that resolves to the tab object when the url is loaded
*/
var _addTab = addTab;
addTab = function (url) {
addTab = function(url) {
return enableAnimationFeatures().then(() => _addTab(url)).then(tab => {
let browser = tab.linkedBrowser;
info("Loading the helper frame script " + FRAME_SCRIPT_URL);

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

@ -156,7 +156,7 @@ var TimeScale = {
* Add a new animation to time scale.
* @param {Object} state A PlayerFront.state object.
*/
addAnimation: function (state) {
addAnimation: function(state) {
let {previousStartTime, delay, duration, endDelay,
iterationCount, playbackRate} = state;
@ -190,7 +190,7 @@ var TimeScale = {
/**
* Reset the current time scale.
*/
reset: function () {
reset: function() {
this.minStartTime = Infinity;
this.maxEndTime = 0;
},
@ -200,7 +200,7 @@ var TimeScale = {
* @param {Number} time
* @return {Number}
*/
startTimeToDistance: function (time) {
startTimeToDistance: function(time) {
time -= this.minStartTime;
return this.durationToDistance(time);
},
@ -210,7 +210,7 @@ var TimeScale = {
* @param {Number} time
* @return {Number}
*/
durationToDistance: function (duration) {
durationToDistance: function(duration) {
return duration * 100 / this.getDuration();
},
@ -219,7 +219,7 @@ var TimeScale = {
* @param {Number} distance
* @return {Number}
*/
distanceToTime: function (distance) {
distanceToTime: function(distance) {
return this.minStartTime + (this.getDuration() * distance / 100);
},
@ -229,7 +229,7 @@ var TimeScale = {
* @param {Number} distance
* @return {Number}
*/
distanceToRelativeTime: function (distance) {
distanceToRelativeTime: function(distance) {
let time = this.distanceToTime(distance);
return time - this.minStartTime;
},
@ -240,7 +240,7 @@ var TimeScale = {
* @param {Number} time
* @return {String} The formatted time string.
*/
formatTime: function (time) {
formatTime: function(time) {
// Format in milliseconds if the total duration is short enough.
if (this.getDuration() <= MILLIS_TIME_FORMAT_MAX_DURATION) {
return L10N.getFormatStr("timeline.timeGraduationLabel", time.toFixed(0));
@ -250,7 +250,7 @@ var TimeScale = {
return L10N.getFormatStr("player.timeLabel", (time / 1000).toFixed(1));
},
getDuration: function () {
getDuration: function() {
return this.maxEndTime - this.minStartTime;
},
@ -258,7 +258,7 @@ var TimeScale = {
* Given an animation, get the various dimensions (in %) useful to draw the
* animation in the timeline.
*/
getAnimationDimensions: function ({state}) {
getAnimationDimensions: function({state}) {
let start = state.previousStartTime || 0;
let duration = state.duration;
let rate = state.playbackRate;

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

@ -53,11 +53,11 @@ Tools.options = {
tooltip: l10n("optionsButton.tooltip"),
inMenu: false,
isTargetSupported: function () {
isTargetSupported: function() {
return true;
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new OptionsPanel(iframeWindow, toolbox);
}
};
@ -82,15 +82,15 @@ Tools.inspector = {
],
preventClosingOnKey: true,
onkey: function (panel, toolbox) {
onkey: function(panel, toolbox) {
toolbox.highlighterUtils.togglePicker();
},
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.hasActor("inspector");
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new InspectorPanel(iframeWindow, toolbox);
}
};
@ -119,7 +119,7 @@ Tools.webConsole = {
commands: "devtools/client/webconsole/console-commands",
preventClosingOnKey: true,
onkey: function (panel, toolbox) {
onkey: function(panel, toolbox) {
if (toolbox.splitConsole) {
return toolbox.focusConsoleInput();
}
@ -128,10 +128,10 @@ Tools.webConsole = {
return undefined;
},
isTargetSupported: function () {
isTargetSupported: function() {
return true;
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new WebConsolePanel(iframeWindow, toolbox);
}
};
@ -165,11 +165,11 @@ Tools.jsdebugger = {
inMenu: true,
commands: "devtools/client/debugger/debugger-commands",
isTargetSupported: function () {
isTargetSupported: function() {
return true;
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new DebuggerPanel(iframeWindow, toolbox);
}
};
@ -177,12 +177,12 @@ Tools.jsdebugger = {
function switchDebugger() {
if (Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend")) {
Tools.jsdebugger.url = "chrome://devtools/content/debugger/new/index.html";
Tools.jsdebugger.build = function (iframeWindow, toolbox) {
Tools.jsdebugger.build = function(iframeWindow, toolbox) {
return new NewDebuggerPanel(iframeWindow, toolbox);
};
} else {
Tools.jsdebugger.url = "chrome://devtools/content/debugger/debugger.xul";
Tools.jsdebugger.build = function (iframeWindow, toolbox) {
Tools.jsdebugger.build = function(iframeWindow, toolbox) {
return new DebuggerPanel(iframeWindow, toolbox);
};
}
@ -210,11 +210,11 @@ Tools.styleEditor = {
inMenu: true,
commands: "devtools/client/styleeditor/styleeditor-commands",
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.hasActor("styleSheets");
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new StyleEditorPanel(iframeWindow, toolbox);
}
};
@ -229,11 +229,11 @@ Tools.shaderEditor = {
panelLabel: l10n("ToolboxShaderEditor.panelLabel"),
tooltip: l10n("ToolboxShaderEditor.tooltip"),
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.hasActor("webgl") && !target.chrome;
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new ShaderEditorPanel(iframeWindow, toolbox);
}
};
@ -250,11 +250,11 @@ Tools.canvasDebugger = {
// Hide the Canvas Debugger in the Add-on Debugger and Browser Toolbox
// (bug 1047520).
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.hasActor("canvas") && !target.chrome;
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new CanvasDebuggerPanel(iframeWindow, toolbox);
}
};
@ -277,10 +277,10 @@ Tools.performance = {
function switchPerformancePanel() {
if (Services.prefs.getBoolPref("devtools.performance.new-panel-enabled", false)) {
Tools.performance.url = "chrome://devtools/content/performance-new/perf.xhtml";
Tools.performance.build = function (frame, target) {
Tools.performance.build = function(frame, target) {
return new NewPerformancePanel(frame, target);
};
Tools.performance.isTargetSupported = function (target) {
Tools.performance.isTargetSupported = function(target) {
// Root actors are lazily initialized, so we can't check if the target has
// the perf actor yet. Also this function is not async, so we can't initialize
// the actor yet.
@ -288,10 +288,10 @@ function switchPerformancePanel() {
};
} else {
Tools.performance.url = "chrome://devtools/content/performance/performance.xul";
Tools.performance.build = function (frame, target) {
Tools.performance.build = function(frame, target) {
return new PerformancePanel(frame, target);
};
Tools.performance.isTargetSupported = function (target) {
Tools.performance.isTargetSupported = function(target) {
return target.hasActor("performance");
};
}
@ -313,11 +313,11 @@ Tools.memory = {
panelLabel: l10n("memory.panelLabel"),
tooltip: l10n("memory.tooltip"),
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.getTrait("heapSnapshots") && !target.isAddon;
},
build: function (frame, target) {
build: function(frame, target) {
return new MemoryPanel(frame, target);
}
};
@ -338,11 +338,11 @@ Tools.netMonitor = {
},
inMenu: true,
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.getTrait("networkMonitor");
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new NetMonitorPanel(iframeWindow, toolbox);
}
};
@ -363,12 +363,12 @@ Tools.storage = {
},
inMenu: true,
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.isLocalTab ||
(target.hasActor("storage") && target.getTrait("storageInspector"));
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new StoragePanel(iframeWindow, toolbox);
}
};
@ -383,11 +383,11 @@ Tools.webAudioEditor = {
panelLabel: l10n("ToolboxWebAudioEditor1.panelLabel"),
tooltip: l10n("ToolboxWebAudioEditor1.tooltip"),
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return !target.chrome && target.hasActor("webaudio");
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new WebAudioEditorPanel(iframeWindow, toolbox);
}
};
@ -404,11 +404,11 @@ Tools.scratchpad = {
inMenu: false,
commands: "devtools/client/scratchpad/scratchpad-commands",
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.hasActor("console");
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new ScratchpadPanel(iframeWindow, toolbox);
}
};
@ -429,11 +429,11 @@ Tools.dom = {
},
inMenu: true,
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.getTrait("webConsoleCommands");
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new DomPanel(iframeWindow, toolbox);
}
};

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

@ -17,7 +17,7 @@ function DomDecorator() {
* appending an icon to read only properties.
*/
DomDecorator.prototype = {
getRowClass: function (object) {
getRowClass: function(object) {
if (object instanceof Property) {
let value = object.value;
let names = [];
@ -42,7 +42,7 @@ DomDecorator.prototype = {
* Return custom React template for specified object. The template
* might depend on specified column.
*/
getValueRep: function (value, colId) {
getValueRep: function(value, colId) {
}
};

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

@ -36,7 +36,7 @@ function DomView(localStore) {
}
DomView.prototype = {
initialize: function (rootGrip) {
initialize: function(rootGrip) {
let content = document.querySelector("#content");
let mainFrame = MainFrame({
object: rootGrip,
@ -50,7 +50,7 @@ DomView.prototype = {
this.mainFrame = ReactDOM.render(provider, content);
},
onMessage: function (event) {
onMessage: function(event) {
let data = event.data;
let method = data.type;

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

@ -23,7 +23,7 @@ GripProvider.prototype = {
* Fetches properties from the backend. These properties might be
* displayed as child objects in e.g. a tree UI widget.
*/
getChildren: function (object) {
getChildren: function(object) {
let grip = object;
if (object instanceof Property) {
grip = this.getValue(object);
@ -43,7 +43,7 @@ GripProvider.prototype = {
return props;
},
hasChildren: function (object) {
hasChildren: function(object) {
if (object instanceof Property) {
let value = this.getValue(object);
if (!value) {
@ -70,7 +70,7 @@ GripProvider.prototype = {
return null;
},
getValue: function (object) {
getValue: function(object) {
if (object instanceof Property) {
let value = object.value;
return (typeof value.value != "undefined") ? value.value :
@ -80,15 +80,15 @@ GripProvider.prototype = {
return object;
},
getLabel: function (object) {
getLabel: function(object) {
return (object instanceof Property) ? object.name : null;
},
getKey: function (object) {
getKey: function(object) {
return (object instanceof Property) ? object.key : null;
},
getType: function (object) {
getType: function(object) {
return object.class ? object.class : "";
},
};

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

@ -10,7 +10,7 @@
* (all after the last dot).
*/
const DefaultL10N = {
getStr: function (key) {
getStr: function(key) {
let index = key.lastIndexOf(".");
return key.substr(index + 1);
}

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

@ -60,7 +60,7 @@ DomPanel.prototype = {
// Initialization
initialize: function () {
initialize: function() {
this.panelWin.addEventListener("devtools/content/message",
this.onContentMessage, true);
@ -97,7 +97,7 @@ DomPanel.prototype = {
// Events
refresh: function () {
refresh: function() {
// Do not refresh if the panel isn't visible.
if (!this.isPanelVisible()) {
return;
@ -121,7 +121,7 @@ DomPanel.prototype = {
* The panel is refreshed immediately if it's currently selected
* or lazily when the user actually selects it.
*/
onTabNavigated: function () {
onTabNavigated: function() {
this.shouldRefresh = true;
this.refresh();
},
@ -129,7 +129,7 @@ DomPanel.prototype = {
/**
* Make sure the panel is refreshed (if needed) when it's selected.
*/
onPanelVisibilityChange: function () {
onPanelVisibilityChange: function() {
this.refresh();
},
@ -138,11 +138,11 @@ DomPanel.prototype = {
/**
* Return true if the DOM panel is currently selected.
*/
isPanelVisible: function () {
isPanelVisible: function() {
return this._toolbox.currentToolId === "dom";
},
getPrototypeAndProperties: function (grip) {
getPrototypeAndProperties: function(grip) {
let deferred = defer();
if (!grip.actor) {
@ -179,14 +179,14 @@ DomPanel.prototype = {
return deferred.promise;
},
openLink: function (url) {
openLink: function(url) {
let parentDoc = this._toolbox.doc;
let iframe = parentDoc.getElementById("this._toolbox");
let top = iframe.ownerDocument.defaultView.top;
top.openUILinkIn(url, "tab");
},
getRootGrip: function () {
getRootGrip: function() {
let deferred = defer();
// Attach Console. It might involve RDP communication, so wait
@ -198,7 +198,7 @@ DomPanel.prototype = {
return deferred.promise;
},
postContentMessage: function (type, args) {
postContentMessage: function(type, args) {
let data = {
type: type,
args: args,
@ -213,7 +213,7 @@ DomPanel.prototype = {
this.panelWin.dispatchEvent(event);
},
onContentMessage: function (event) {
onContentMessage: function(event) {
let data = event.data;
let method = data.type;
if (typeof this[method] == "function") {

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

@ -13,13 +13,13 @@ const { require, DevToolsLoader } = ChromeUtils.import("resource://devtools/shar
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "Subprocess", "resource://gre/modules/Subprocess.jsm");
XPCOMUtils.defineLazyGetter(this, "Telemetry", function () {
XPCOMUtils.defineLazyGetter(this, "Telemetry", function() {
return require("devtools/client/shared/telemetry");
});
XPCOMUtils.defineLazyGetter(this, "EventEmitter", function () {
XPCOMUtils.defineLazyGetter(this, "EventEmitter", function() {
return require("devtools/shared/old-event-emitter");
});
XPCOMUtils.defineLazyGetter(this, "system", function () {
XPCOMUtils.defineLazyGetter(this, "system", function() {
return require("devtools/shared/system");
});
const promise = require("promise");
@ -45,7 +45,7 @@ this.BrowserToolboxProcess = function BrowserToolboxProcess(onClose, onRun, opti
this.off = emitter.off.bind(emitter);
this.once = emitter.once.bind(emitter);
// Forward any events to the shared emitter.
this.emit = function (...args) {
this.emit = function(...args) {
emitter.emit(...args);
BrowserToolboxProcess.emit(...args);
};
@ -89,7 +89,7 @@ EventEmitter.decorate(BrowserToolboxProcess);
* Initializes and starts a chrome toolbox process.
* @return object
*/
BrowserToolboxProcess.init = function (onClose, onRun, options) {
BrowserToolboxProcess.init = function(onClose, onRun, options) {
if (!Services.prefs.getBoolPref("devtools.chrome.enabled") ||
!Services.prefs.getBoolPref("devtools.debugger.remote-enabled")) {
console.error("Could not start Browser Toolbox, you need to enable it.");
@ -102,7 +102,7 @@ BrowserToolboxProcess.init = function (onClose, onRun, options) {
* Figure out if there are any open Browser Toolboxes that'll need to be restored.
* @return bool
*/
BrowserToolboxProcess.getBrowserToolboxSessionState = function () {
BrowserToolboxProcess.getBrowserToolboxSessionState = function() {
for (let process of processes.values()) {
// Don't worry about addon toolboxes, we only want to restore the Browser Toolbox.
if (!process._options || !process._options.addonID) {
@ -121,7 +121,7 @@ BrowserToolboxProcess.getBrowserToolboxSessionState = function () {
* The options.
* @return a promise that will be resolved when complete.
*/
BrowserToolboxProcess.setAddonOptions = function (id, options) {
BrowserToolboxProcess.setAddonOptions = function(id, options) {
let promises = [];
for (let process of processes.values()) {
@ -135,7 +135,7 @@ BrowserToolboxProcess.prototype = {
/**
* Initializes the debugger server.
*/
_initServer: function () {
_initServer: function() {
if (this.debuggerServer) {
dumpn("The chrome toolbox server is already running.");
return;
@ -184,7 +184,7 @@ BrowserToolboxProcess.prototype = {
/**
* Initializes a profile for the remote debugger process.
*/
_initProfile: function () {
_initProfile: function() {
dumpn("Initializing the chrome toolbox user profile.");
// We used to use `ProfLD` instead of `ProfD`, so migrate old profiles if they exist.
@ -260,7 +260,7 @@ BrowserToolboxProcess.prototype = {
/**
* Creates and initializes the profile & process for the remote debugger.
*/
_create: function () {
_create: function() {
dumpn("Initializing chrome debugging process.");
let command = Services.dirsvc.get("XREExeF", Ci.nsIFile).path;
@ -333,7 +333,7 @@ BrowserToolboxProcess.prototype = {
* @param {DebuggerServerConnection} connection
* The connection that was opened or closed.
*/
_onConnectionChange: function (what, connection) {
_onConnectionChange: function(what, connection) {
let wrappedJSObject = { what, connection };
Services.obs.notifyObservers({ wrappedJSObject }, "toolbox-connection-change");
},
@ -341,7 +341,7 @@ BrowserToolboxProcess.prototype = {
/**
* Closes the remote debugging server and kills the toolbox process.
*/
close: async function () {
close: async function() {
if (this.closed) {
return;
}

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

@ -419,7 +419,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
* @return {Promise} promise that resolves when the stylesheet is loaded (or rejects
* if it fails to load).
*/
loadBrowserStyleSheet: function (win) {
loadBrowserStyleSheet: function(win) {
if (this._browserStyleSheets.has(win)) {
return Promise.resolve();
}
@ -529,7 +529,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
});
}
debugService.activationHandler = function (window) {
debugService.activationHandler = function(window) {
let chromeWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
@ -555,12 +555,12 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
utils.leaveModalState();
};
debugService.remoteActivationHandler = function (browser, callback) {
debugService.remoteActivationHandler = function(browser, callback) {
let chromeWindow = browser.ownerDocument.defaultView;
let tab = chromeWindow.gBrowser.getTabForBrowser(browser);
chromeWindow.gBrowser.selected = tab;
slowScriptDebugHandler(tab, function () {
slowScriptDebugHandler(tab, function() {
callback.finishDebuggerStartup();
});
};
@ -740,7 +740,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
gDevTools.getToolDefinitionArray()
.forEach(def => gDevToolsBrowser._addToolToWindows(def));
// and the new ones.
gDevTools.on("tool-registered", function (ev, toolId) {
gDevTools.on("tool-registered", function(ev, toolId) {
let toolDefinition = gDevTools._tools.get(toolId);
// If the tool has been registered globally, add to all the
// available windows.
@ -749,7 +749,7 @@ gDevTools.on("tool-registered", function (ev, toolId) {
}
});
gDevTools.on("tool-unregistered", function (ev, toolId) {
gDevTools.on("tool-unregistered", function(ev, toolId) {
gDevToolsBrowser._removeToolFromWindows(toolId);
});

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

@ -396,7 +396,7 @@ DevTools.prototype = {
* @param {Object} state
* A SessionStore state object that gets modified by reference
*/
saveDevToolsSession: function (state) {
saveDevToolsSession: function(state) {
state.browserConsole = HUDService.getBrowserConsoleSessionState();
state.browserToolbox = BrowserToolboxProcess.getBrowserToolboxSessionState();
@ -410,7 +410,7 @@ DevTools.prototype = {
/**
* Restore the devtools session state as provided by SessionStore.
*/
restoreDevToolsSession: function ({scratchpads, browserConsole, browserToolbox}) {
restoreDevToolsSession: function({scratchpads, browserConsole, browserToolbox}) {
if (scratchpads) {
ScratchpadManager.restoreSession(scratchpads);
}
@ -573,7 +573,7 @@ DevTools.prototype = {
*
* @return {TabTarget} A target object
*/
getTargetForTab: function (tab) {
getTargetForTab: function(tab) {
return TargetFactory.forTab(tab);
},
@ -584,7 +584,7 @@ DevTools.prototype = {
* web-extensions need to use dedicated instances of TabTarget and cannot reuse the
* cached instances managed by DevTools target factory.
*/
createTargetForTab: function (tab) {
createTargetForTab: function(tab) {
return new TabTarget(tab);
},
@ -592,7 +592,7 @@ DevTools.prototype = {
* Compatibility layer for web-extensions. Used by DevToolsShim for
* browser/components/extensions/ext-devtools-inspectedWindow.js
*/
createWebExtensionInspectedWindowFront: function (tabTarget) {
createWebExtensionInspectedWindowFront: function(tabTarget) {
return new WebExtensionInspectedWindowFront(tabTarget.client, tabTarget.form);
},
@ -600,7 +600,7 @@ DevTools.prototype = {
* Compatibility layer for web-extensions. Used by DevToolsShim for
* toolkit/components/extensions/ext-c-toolkit.js
*/
openBrowserConsole: function () {
openBrowserConsole: function() {
let {HUDService} = require("devtools/client/webconsole/hudservice");
HUDService.openBrowserConsoleOrFocus();
},

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

@ -66,7 +66,7 @@ exports.Selection = Selection;
Selection.prototype = {
_walker: null,
_onMutations: function (mutations) {
_onMutations: function(mutations) {
let attributeChange = false;
let pseudoChange = false;
let detached = false;
@ -101,11 +101,11 @@ Selection.prototype = {
}
},
destroy: function () {
destroy: function() {
this.setWalker(null);
},
setWalker: function (walker) {
setWalker: function(walker) {
if (this._walker) {
this._walker.off("mutations", this._onMutations);
}
@ -115,7 +115,7 @@ Selection.prototype = {
}
},
setNodeFront: function (value, reason = "unknown") {
setNodeFront: function(value, reason = "unknown") {
this.reason = reason;
// If an inlineTextChild text node is being set, then set it's parent instead.
@ -136,17 +136,17 @@ Selection.prototype = {
return this._nodeFront;
},
isRoot: function () {
isRoot: function() {
return this.isNode() &&
this.isConnected() &&
this._nodeFront.isDocumentElement;
},
isNode: function () {
isNode: function() {
return !!this._nodeFront;
},
isConnected: function () {
isConnected: function() {
let node = this._nodeFront;
if (!node || !node.actorID) {
return false;
@ -161,64 +161,64 @@ Selection.prototype = {
return false;
},
isHTMLNode: function () {
isHTMLNode: function() {
let xhtmlNs = "http://www.w3.org/1999/xhtml";
return this.isNode() && this.nodeFront.namespaceURI == xhtmlNs;
},
// Node type
isElementNode: function () {
isElementNode: function() {
return this.isNode() && this.nodeFront.nodeType == nodeConstants.ELEMENT_NODE;
},
isPseudoElementNode: function () {
isPseudoElementNode: function() {
return this.isNode() && this.nodeFront.isPseudoElement;
},
isAnonymousNode: function () {
isAnonymousNode: function() {
return this.isNode() && this.nodeFront.isAnonymous;
},
isAttributeNode: function () {
isAttributeNode: function() {
return this.isNode() && this.nodeFront.nodeType == nodeConstants.ATTRIBUTE_NODE;
},
isTextNode: function () {
isTextNode: function() {
return this.isNode() && this.nodeFront.nodeType == nodeConstants.TEXT_NODE;
},
isCDATANode: function () {
isCDATANode: function() {
return this.isNode() && this.nodeFront.nodeType == nodeConstants.CDATA_SECTION_NODE;
},
isEntityRefNode: function () {
isEntityRefNode: function() {
return this.isNode() &&
this.nodeFront.nodeType == nodeConstants.ENTITY_REFERENCE_NODE;
},
isEntityNode: function () {
isEntityNode: function() {
return this.isNode() && this.nodeFront.nodeType == nodeConstants.ENTITY_NODE;
},
isProcessingInstructionNode: function () {
isProcessingInstructionNode: function() {
return this.isNode() &&
this.nodeFront.nodeType == nodeConstants.PROCESSING_INSTRUCTION_NODE;
},
isCommentNode: function () {
isCommentNode: function() {
return this.isNode() &&
this.nodeFront.nodeType == nodeConstants.PROCESSING_INSTRUCTION_NODE;
},
isDocumentNode: function () {
isDocumentNode: function() {
return this.isNode() && this.nodeFront.nodeType == nodeConstants.DOCUMENT_NODE;
},
/**
* @returns true if the selection is the <body> HTML element.
*/
isBodyNode: function () {
isBodyNode: function() {
return this.isHTMLNode() &&
this.isConnected() &&
this.nodeFront.nodeName === "BODY";
@ -227,22 +227,22 @@ Selection.prototype = {
/**
* @returns true if the selection is the <head> HTML element.
*/
isHeadNode: function () {
isHeadNode: function() {
return this.isHTMLNode() &&
this.isConnected() &&
this.nodeFront.nodeName === "HEAD";
},
isDocumentTypeNode: function () {
isDocumentTypeNode: function() {
return this.isNode() && this.nodeFront.nodeType == nodeConstants.DOCUMENT_TYPE_NODE;
},
isDocumentFragmentNode: function () {
isDocumentFragmentNode: function() {
return this.isNode() &&
this.nodeFront.nodeType == nodeConstants.DOCUMENT_FRAGMENT_NODE;
},
isNotationNode: function () {
isNotationNode: function() {
return this.isNode() && this.nodeFront.nodeType == nodeConstants.NOTATION_NODE;
},
};

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

@ -30,7 +30,7 @@ const TargetFactory = exports.TargetFactory = {
*
* @return A target object
*/
forTab: function (tab) {
forTab: function(tab) {
let target = targets.get(tab);
if (target == null) {
target = new TabTarget(tab);
@ -52,7 +52,7 @@ const TargetFactory = exports.TargetFactory = {
*
* @return A promise of a target object
*/
forRemoteTab: function (options) {
forRemoteTab: function(options) {
let targetPromise = promiseTargets.get(options);
if (targetPromise == null) {
let target = new TabTarget(options);
@ -62,7 +62,7 @@ const TargetFactory = exports.TargetFactory = {
return targetPromise;
},
forWorker: function (workerClient) {
forWorker: function(workerClient) {
let target = targets.get(workerClient);
if (target == null) {
target = new WorkerTarget(workerClient);
@ -78,7 +78,7 @@ const TargetFactory = exports.TargetFactory = {
* target for a tab without creating a target
* @return true/false
*/
isKnownTab: function (tab) {
isKnownTab: function(tab) {
return targets.has(tab);
},
};
@ -185,7 +185,7 @@ TabTarget.prototype = {
* "events": {}
* }
*/
getActorDescription: function (actorName) {
getActorDescription: function(actorName) {
if (!this.client) {
throw new Error("TabTarget#getActorDescription() can only be called on " +
"remote tabs.");
@ -213,7 +213,7 @@ TabTarget.prototype = {
* @param {String} actorName
* @return {Boolean}
*/
hasActor: function (actorName) {
hasActor: function(actorName) {
if (!this.client) {
throw new Error("TabTarget#hasActor() can only be called on remote " +
"tabs.");
@ -235,7 +235,7 @@ TabTarget.prototype = {
* @param {String} methodName
* @return {Promise}
*/
actorHasMethod: function (actorName, methodName) {
actorHasMethod: function(actorName, methodName) {
if (!this.client) {
throw new Error("TabTarget#actorHasMethod() can only be called on " +
"remote tabs.");
@ -254,7 +254,7 @@ TabTarget.prototype = {
* @param {String} traitName
* @return {Mixed}
*/
getTrait: function (traitName) {
getTrait: function(traitName) {
if (!this.client) {
throw new Error("TabTarget#getTrait() can only be called on remote " +
"tabs.");
@ -286,7 +286,7 @@ TabTarget.prototype = {
return this._root;
},
_getRoot: function () {
_getRoot: function() {
return new Promise((resolve, reject) => {
this.client.mainRoot.getRoot(response => {
if (response.error) {
@ -394,7 +394,7 @@ TabTarget.prototype = {
* for tools that support the Remote Debugging Protocol even for local
* connections.
*/
makeRemote: async function () {
makeRemote: async function() {
if (this._remote) {
return this._remote.promise;
}
@ -493,7 +493,7 @@ TabTarget.prototype = {
/**
* Listen to the different events.
*/
_setupListeners: function () {
_setupListeners: function() {
this._webProgressListener = new TabWebProgressListener(this);
this.tab.linkedBrowser.addProgressListener(this._webProgressListener);
this.tab.addEventListener("TabClose", this);
@ -505,7 +505,7 @@ TabTarget.prototype = {
/**
* Teardown event listeners.
*/
_teardownListeners: function () {
_teardownListeners: function() {
if (this._webProgressListener) {
this._webProgressListener.destroy();
}
@ -519,7 +519,7 @@ TabTarget.prototype = {
/**
* Setup listeners for remote debugging, updating existing ones as necessary.
*/
_setupRemoteListeners: function () {
_setupRemoteListeners: function() {
this.client.addListener("closed", this.destroy);
this._onTabDetached = (type, packet) => {
@ -573,7 +573,7 @@ TabTarget.prototype = {
/**
* Teardown listeners for remote debugging.
*/
_teardownRemoteListeners: function () {
_teardownRemoteListeners: function() {
this.client.removeListener("closed", this.destroy);
this.client.removeListener("tabNavigated", this._onTabNavigated);
this.client.removeListener("tabDetached", this._onTabDetached);
@ -588,7 +588,7 @@ TabTarget.prototype = {
/**
* Handle tabs events.
*/
handleEvent: function (event) {
handleEvent: function(event) {
switch (event.type) {
case "TabClose":
case "unload":
@ -612,7 +612,7 @@ TabTarget.prototype = {
* loaded within the parent process and loaded from a content process.
* Process change can go in both ways.
*/
onRemotenessChange: function () {
onRemotenessChange: function() {
// Responsive design do a crazy dance around tabs and triggers
// remotenesschange events. But we should ignore them as at the end
// the content doesn't change its remoteness.
@ -638,7 +638,7 @@ TabTarget.prototype = {
/**
* Target is not alive anymore.
*/
destroy: function () {
destroy: function() {
// If several things call destroy then we give them all the same
// destruction promise so we're sure to destroy only once
if (this._destroyer) {
@ -689,7 +689,7 @@ TabTarget.prototype = {
/**
* Clean up references to what this target points to.
*/
_cleanup: function () {
_cleanup: function() {
if (this._tab) {
targets.delete(this._tab);
} else {
@ -708,7 +708,7 @@ TabTarget.prototype = {
this.threadActor = null;
},
toString: function () {
toString: function() {
let id = this._tab ? this._tab : (this._form && this._form.actor);
return `TabTarget:${id}`;
},
@ -721,7 +721,7 @@ TabTarget.prototype = {
* @param {String} category
* The category of the message. @see nsIScriptError.
*/
logErrorInPage: function (text, category) {
logErrorInPage: function(text, category) {
if (this.activeTab && this.activeTab.traits.logInPage) {
const errorFlag = 0;
let packet = {
@ -743,7 +743,7 @@ TabTarget.prototype = {
* @param {String} category
* The category of the message. @see nsIScriptError.
*/
logWarningInPage: function (text, category) {
logWarningInPage: function(text, category) {
if (this.activeTab && this.activeTab.traits.logInPage) {
const warningFlag = 1;
let packet = {
@ -774,7 +774,7 @@ TabWebProgressListener.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference]),
onStateChange: function (progress, request, flag) {
onStateChange: function(progress, request, flag) {
let isStart = flag & Ci.nsIWebProgressListener.STATE_START;
let isDocument = flag & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT;
let isNetwork = flag & Ci.nsIWebProgressListener.STATE_IS_NETWORK;
@ -797,11 +797,11 @@ TabWebProgressListener.prototype = {
}
},
onProgressChange: function () {},
onSecurityChange: function () {},
onStatusChange: function () {},
onProgressChange: function() {},
onSecurityChange: function() {},
onStatusChange: function() {},
onLocationChange: function (webProgress, request, URI, flags) {
onLocationChange: function(webProgress, request, URI, flags) {
if (this.target &&
!(flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
let window = webProgress.DOMWindow;
@ -818,7 +818,7 @@ TabWebProgressListener.prototype = {
/**
* Destroy the progress listener instance.
*/
destroy: function () {
destroy: function() {
if (this.target.tab) {
try {
this.target.tab.linkedBrowser.removeProgressListener(this);
@ -888,11 +888,11 @@ WorkerTarget.prototype = {
return this._workerClient.client;
},
destroy: function () {
destroy: function() {
this._workerClient.detach();
},
hasActor: function (name) {
hasActor: function(name) {
// console is the only one actor implemented by WorkerActor
if (name == "console") {
return true;
@ -900,19 +900,19 @@ WorkerTarget.prototype = {
return false;
},
getTrait: function () {
getTrait: function() {
return undefined;
},
makeRemote: function () {
makeRemote: function() {
return Promise.resolve();
},
logErrorInPage: function () {
logErrorInPage: function() {
// No-op. See bug 1368680.
},
logWarningInPage: function () {
logWarningInPage: function() {
// No-op. See bug 1368680.
},
};

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

@ -28,7 +28,7 @@ const flags = require("devtools/shared/flags");
* @param {Toolbox} toolbox
* @return {Object} the highlighterUtils public API
*/
exports.getHighlighterUtils = function (toolbox) {
exports.getHighlighterUtils = function(toolbox) {
if (!toolbox || !toolbox.target) {
throw new Error("Missing or invalid toolbox passed to getHighlighterUtils");
}
@ -49,7 +49,7 @@ exports.getHighlighterUtils = function (toolbox) {
/**
* Release this utils, nullifying the references to the toolbox
*/
exported.release = function () {
exported.release = function() {
toolbox = target = null;
};
@ -59,7 +59,7 @@ exports.getHighlighterUtils = function (toolbox) {
* which doesn't have the highlighter actor. This can be removed as soon as
* the minimal supported version becomes 1.4 (29)
*/
let isRemoteHighlightable = exported.isRemoteHighlightable = function () {
let isRemoteHighlightable = exported.isRemoteHighlightable = function() {
return target.client.traits.highlightable;
};
@ -94,7 +94,7 @@ exports.getHighlighterUtils = function (toolbox) {
* activated.
* @return A promise that resolves when done
*/
exported.togglePicker = function (doFocus) {
exported.togglePicker = function(doFocus) {
if (isPicking) {
return cancelPicker();
}

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

@ -54,7 +54,7 @@ BottomHost.prototype = {
/**
* Create a box at the bottom of the host tab.
*/
create: async function () {
create: async function() {
await gDevToolsBrowser.loadBrowserStyleSheet(this.hostTab.ownerGlobal);
let gBrowser = this.hostTab.ownerDocument.defaultView.gBrowser;
@ -97,7 +97,7 @@ BottomHost.prototype = {
/**
* Raise the host.
*/
raise: function () {
raise: function() {
focusTab(this.hostTab);
},
@ -106,7 +106,7 @@ BottomHost.prototype = {
* @param {Number} height The height to minimize to. Defaults to 0, which
* means that the toolbox won't be visible at all once minimized.
*/
minimize: function (height = 0) {
minimize: function(height = 0) {
if (this.isMinimized) {
return;
}
@ -130,7 +130,7 @@ BottomHost.prototype = {
* If the host was minimized before, maximize it again (the host will be
* maximized to the height it previously had).
*/
maximize: function () {
maximize: function() {
if (!this.isMinimized) {
return;
}
@ -154,7 +154,7 @@ BottomHost.prototype = {
* Toggle the minimize mode.
* @param {Number} minHeight The height to minimize to.
*/
toggleMinimizeMode: function (minHeight) {
toggleMinimizeMode: function(minHeight) {
this.isMinimized ? this.maximize() : this.minimize(minHeight);
},
@ -162,12 +162,12 @@ BottomHost.prototype = {
* Set the toolbox title.
* Nothing to do for this host type.
*/
setTitle: function () {},
setTitle: function() {},
/**
* Destroy the bottom dock.
*/
destroy: function () {
destroy: function() {
if (!this._destroyed) {
this._destroyed = true;
@ -200,7 +200,7 @@ SidebarHost.prototype = {
/**
* Create a box in the sidebar of the host tab.
*/
create: async function () {
create: async function() {
await gDevToolsBrowser.loadBrowserStyleSheet(this.hostTab.ownerGlobal);
let gBrowser = this.hostTab.ownerDocument.defaultView.gBrowser;
@ -240,7 +240,7 @@ SidebarHost.prototype = {
/**
* Raise the host.
*/
raise: function () {
raise: function() {
focusTab(this.hostTab);
},
@ -248,12 +248,12 @@ SidebarHost.prototype = {
* Set the toolbox title.
* Nothing to do for this host type.
*/
setTitle: function () {},
setTitle: function() {},
/**
* Destroy the sidebar.
*/
destroy: function () {
destroy: function() {
if (!this._destroyed) {
this._destroyed = true;
@ -283,7 +283,7 @@ WindowHost.prototype = {
/**
* Create a new xul window to contain the toolbox.
*/
create: function () {
create: function() {
let deferred = defer();
let flags = "chrome,centerscreen,resizable,dialog=no";
@ -319,7 +319,7 @@ WindowHost.prototype = {
/**
* Catch the user closing the window.
*/
_boundUnload: function (event) {
_boundUnload: function(event) {
if (event.target.location != this.WINDOW_URL) {
return;
}
@ -331,21 +331,21 @@ WindowHost.prototype = {
/**
* Raise the host.
*/
raise: function () {
raise: function() {
this._window.focus();
},
/**
* Set the toolbox title.
*/
setTitle: function (title) {
setTitle: function(title) {
this._window.document.title = title;
},
/**
* Destroy the window.
*/
destroy: function () {
destroy: function() {
if (!this._destroyed) {
this._destroyed = true;
@ -369,7 +369,7 @@ function CustomHost(hostTab, options) {
CustomHost.prototype = {
type: "custom",
_sendMessageToTopWindow: function (msg, data) {
_sendMessageToTopWindow: function(msg, data) {
// It's up to the custom frame owner (parent window) to honor
// "close" or "raise" instructions.
let topWindow = this.frame.ownerDocument.defaultView;
@ -386,28 +386,28 @@ CustomHost.prototype = {
/**
* Create a new xul window to contain the toolbox.
*/
create: function () {
create: function() {
return promise.resolve(this.frame);
},
/**
* Raise the host.
*/
raise: function () {
raise: function() {
this._sendMessageToTopWindow("raise");
},
/**
* Set the toolbox title.
*/
setTitle: function (title) {
setTitle: function(title) {
this._sendMessageToTopWindow("title", { value: title });
},
/**
* Destroy the window.
*/
destroy: function () {
destroy: function() {
if (!this._destroyed) {
this._destroyed = true;
this._sendMessageToTopWindow("close");

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

@ -97,7 +97,7 @@ OptionsPanel.prototype = {
return this;
}),
_addListeners: function () {
_addListeners: function() {
Services.prefs.addObserver("devtools.cache.disabled", this._prefChanged);
Services.prefs.addObserver("devtools.theme", this._prefChanged);
Services.prefs.addObserver("devtools.source-map.client-service.enabled",
@ -106,7 +106,7 @@ OptionsPanel.prototype = {
gDevTools.on("theme-unregistered", this._themeUnregistered);
},
_removeListeners: function () {
_removeListeners: function() {
Services.prefs.removeObserver("devtools.cache.disabled", this._prefChanged);
Services.prefs.removeObserver("devtools.theme", this._prefChanged);
Services.prefs.removeObserver("devtools.source-map.client-service.enabled",
@ -115,7 +115,7 @@ OptionsPanel.prototype = {
gDevTools.off("theme-unregistered", this._themeUnregistered);
},
_prefChanged: function (subject, topic, prefName) {
_prefChanged: function(subject, topic, prefName) {
if (prefName === "devtools.cache.disabled") {
let cacheDisabled = GetPref(prefName);
let cbx = this.panelDoc.getElementById("devtools-disable-cache");
@ -127,11 +127,11 @@ OptionsPanel.prototype = {
}
},
_themeRegistered: function (event, themeId) {
_themeRegistered: function(event, themeId) {
this.setupThemeList();
},
_themeUnregistered: function (event, theme) {
_themeUnregistered: function(event, theme) {
let themeBox = this.panelDoc.getElementById("devtools-theme-box");
let themeInput = themeBox.querySelector(`[value=${theme.id}]`);
@ -189,7 +189,7 @@ OptionsPanel.prototype = {
}
}),
setupToolsList: function () {
setupToolsList: function() {
let defaultToolsBox = this.panelDoc.getElementById("default-tools-box");
let additionalToolsBox = this.panelDoc.getElementById(
"additional-tools-box");
@ -201,7 +201,7 @@ OptionsPanel.prototype = {
// Signal tool registering/unregistering globally (for the tools registered
// globally) and per toolbox (for the tools registered to a single toolbox).
let onCheckboxClick = function (id) {
let onCheckboxClick = function(id) {
let toolDefinition = gDevTools._tools.get(id) || toolbox.getToolDefinition(id);
// Set the kill switch pref boolean to true
Services.prefs.setBoolPref(toolDefinition.visibilityswitch, this.checked);
@ -272,7 +272,7 @@ OptionsPanel.prototype = {
this.panelWin.focus();
},
setupThemeList: function () {
setupThemeList: function() {
let themeBox = this.panelDoc.getElementById("devtools-theme-box");
let themeLabels = themeBox.querySelectorAll("label");
for (let label of themeLabels) {
@ -285,7 +285,7 @@ OptionsPanel.prototype = {
inputRadio.setAttribute("type", "radio");
inputRadio.setAttribute("value", theme.id);
inputRadio.setAttribute("name", "devtools-theme-item");
inputRadio.addEventListener("change", function (e) {
inputRadio.addEventListener("change", function(e) {
SetPref(themeBox.getAttribute("data-pref"),
e.target.value);
});
@ -310,7 +310,7 @@ OptionsPanel.prototype = {
/**
* Add common preferences enabled only on Nightly.
*/
setupNightlyOptions: function () {
setupNightlyOptions: function() {
let isNightly = system.constants.NIGHTLY_BUILD;
if (!isNightly) {
return;
@ -369,7 +369,7 @@ OptionsPanel.prototype = {
if (GetPref(prefCheckbox.getAttribute("data-pref"))) {
prefCheckbox.setAttribute("checked", true);
}
prefCheckbox.addEventListener("change", function (e) {
prefCheckbox.addEventListener("change", function(e) {
let checkbox = e.target;
SetPref(checkbox.getAttribute("data-pref"), checkbox.checked);
});
@ -385,7 +385,7 @@ OptionsPanel.prototype = {
radioInput.setAttribute("checked", true);
}
radioInput.addEventListener("change", function (e) {
radioInput.addEventListener("change", function(e) {
SetPref(radioGroup.getAttribute("data-pref"),
e.target.value);
});
@ -395,7 +395,7 @@ OptionsPanel.prototype = {
for (let prefSelect of prefSelects) {
let pref = GetPref(prefSelect.getAttribute("data-pref"));
let options = [...prefSelect.options];
options.some(function (option) {
options.some(function(option) {
let value = option.value;
// non strict check to allow int values.
if (value == pref) {
@ -405,7 +405,7 @@ OptionsPanel.prototype = {
return false;
});
prefSelect.addEventListener("change", function (e) {
prefSelect.addEventListener("change", function(e) {
let select = e.target;
SetPref(select.getAttribute("data-pref"),
select.options[select.selectedIndex].value);
@ -423,7 +423,7 @@ OptionsPanel.prototype = {
}
}),
updateCurrentTheme: function () {
updateCurrentTheme: function() {
let currentTheme = GetPref("devtools.theme");
let themeBox = this.panelDoc.getElementById("devtools-theme-box");
let themeRadioInput = themeBox.querySelector(`[value=${currentTheme}]`);
@ -437,7 +437,7 @@ OptionsPanel.prototype = {
}
},
updateSourceMapPref: function () {
updateSourceMapPref: function() {
const prefName = "devtools.source-map.client-service.enabled";
let enabled = GetPref(prefName);
let box = this.panelDoc.querySelector(`[data-pref="${prefName}"]`);
@ -454,7 +454,7 @@ OptionsPanel.prototype = {
* @param {Event} event
* The event sent by checking / unchecking the disable JS checkbox.
*/
_disableJSClicked: function (event) {
_disableJSClicked: function(event) {
let checked = event.target.checked;
let options = {
@ -464,7 +464,7 @@ OptionsPanel.prototype = {
this.target.activeTab.reconfigure(options);
},
destroy: function () {
destroy: function() {
if (this.destroyPromise) {
return this.destroyPromise;
}

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

@ -53,7 +53,7 @@ function hideStatusMessage() {
toggleStatusMessage(false);
}
var connect = async function () {
var connect = async function() {
// Initiate the connection
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
@ -106,7 +106,7 @@ function setPrefDefaults() {
Services.prefs.setBoolPref("devtools.preference.new-panel-enabled", false);
Services.prefs.setBoolPref("layout.css.emulate-moz-box-with-flex", false);
}
window.addEventListener("load", async function () {
window.addEventListener("load", async function() {
let cmdClose = document.getElementById("toolbox-cmd-close");
cmdClose.addEventListener("command", onCloseCommand);
setPrefDefaults();

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

@ -279,14 +279,14 @@ Toolbox.prototype = {
* @return {Map} panels
* All the running panels in the toolbox
*/
getToolPanels: function () {
getToolPanels: function() {
return new Map(this._toolPanels);
},
/**
* Access the panel for a given tool
*/
getPanel: function (id) {
getPanel: function(id) {
return this._toolPanels.get(id);
},
@ -303,7 +303,7 @@ Toolbox.prototype = {
* @returns Promise
* A promise that resolves once the panel is ready.
*/
getPanelWhenReady: function (id) {
getPanelWhenReady: function(id) {
let deferred = defer();
let panel = this.getPanel(id);
if (panel) {
@ -322,7 +322,7 @@ Toolbox.prototype = {
* likely that we're going to want to get the panel that we've just made
* visible
*/
getCurrentPanel: function () {
getCurrentPanel: function() {
return this._toolPanels.get(this.currentToolId);
},
@ -413,7 +413,7 @@ Toolbox.prototype = {
/**
* Get the focused state of the split console
*/
isSplitConsoleFocused: function () {
isSplitConsoleFocused: function() {
if (!this._splitConsole) {
return false;
}
@ -425,7 +425,7 @@ Toolbox.prototype = {
/**
* Open the toolbox
*/
open: function () {
open: function() {
return Task.spawn(function* () {
this.browserRequire = BrowserLoader({
window: this.doc.defaultView,
@ -592,7 +592,7 @@ Toolbox.prototype = {
/**
* Unconditionally create and get the source map service.
*/
_createSourceMapService: function () {
_createSourceMapService: function() {
if (this._sourceMapService) {
return this._sourceMapService;
}
@ -690,7 +690,7 @@ Toolbox.prototype = {
},
// Return HostType id for telemetry
_getTelemetryHostId: function () {
_getTelemetryHostId: function() {
switch (this.hostType) {
case Toolbox.HostType.BOTTOM: return 0;
case Toolbox.HostType.SIDE: return 1;
@ -700,7 +700,7 @@ Toolbox.prototype = {
}
},
_pingTelemetry: function () {
_pingTelemetry: function() {
this._telemetry.toolOpened("toolbox");
this._telemetry.logOncePerBrowserVersion(SCREENSIZE_HISTOGRAM,
@ -747,7 +747,7 @@ Toolbox.prototype = {
* is toggled or not. The function should return true when
* the button should be displayed as toggled on.
*/
_createButtonState: function (options) {
_createButtonState: function(options) {
let isCheckedValue = false;
const {
id,
@ -813,7 +813,7 @@ Toolbox.prototype = {
return button;
},
_buildOptions: function () {
_buildOptions: function() {
let selectOptions = event => {
// Flip back to the last used panel if we are already
// on the options panel.
@ -830,7 +830,7 @@ Toolbox.prototype = {
this.shortcuts.on(L10N.getStr("toolbox.help.key"), selectOptions);
},
_splitConsoleOnKeypress: function (e) {
_splitConsoleOnKeypress: function(e) {
if (e.keyCode === KeyCodes.DOM_VK_ESCAPE) {
this.toggleSplitConsole();
// If the debugger is paused, don't let the ESC key stop any pending
@ -853,7 +853,7 @@ Toolbox.prototype = {
* The tool the key belongs to. The corresponding handler will only be triggered
* if this tool is active.
*/
useKeyWithSplitConsole: function (key, handler, whichTool) {
useKeyWithSplitConsole: function(key, handler, whichTool) {
this.shortcuts.on(key, event => {
if (this.currentToolId === whichTool && this.isSplitConsoleFocused()) {
handler();
@ -862,7 +862,7 @@ Toolbox.prototype = {
});
},
_addReloadKeys: function () {
_addReloadKeys: function() {
[
["reload", false],
["reload2", false],
@ -879,7 +879,7 @@ Toolbox.prototype = {
});
},
_addHostListeners: function () {
_addHostListeners: function() {
this.shortcuts.on(L10N.getStr("toolbox.nextTool.key"),
event => {
this.selectNextTool();
@ -907,7 +907,7 @@ Toolbox.prototype = {
this.win.addEventListener("message", this._onBrowserMessage, true);
},
_removeHostListeners: function () {
_removeHostListeners: function() {
// The host iframe's contentDocument may already be gone.
if (this.doc) {
this.doc.removeEventListener("keypress", this._splitConsoleOnKeypress);
@ -918,7 +918,7 @@ Toolbox.prototype = {
},
// Called whenever the chrome send a message
_onBrowserMessage: function (event) {
_onBrowserMessage: function(event) {
if (!event.data) {
return;
}
@ -939,11 +939,11 @@ Toolbox.prototype = {
}
},
_registerOverlays: function () {
_registerOverlays: function() {
registerHarOverlay(this);
},
_saveSplitConsoleHeight: function () {
_saveSplitConsoleHeight: function() {
Services.prefs.setIntPref(SPLITCONSOLE_HEIGHT_PREF,
this.webconsolePanel.height);
},
@ -960,7 +960,7 @@ Toolbox.prototype = {
* then we should hide the console and splitter, and show the deck
* at full height.
*/
_refreshConsoleDisplay: function () {
_refreshConsoleDisplay: function() {
let deck = this.doc.getElementById("toolbox-deck");
let webconsolePanel = this.webconsolePanel;
let splitter = this.doc.getElementById("toolbox-console-splitter");
@ -985,7 +985,7 @@ Toolbox.prototype = {
/**
* Adds the keys and commands to the Toolbox Window in window mode.
*/
_addKeysToWindow: function () {
_addKeysToWindow: function() {
if (this.hostType != Toolbox.HostType.WINDOW) {
return;
}
@ -1041,7 +1041,7 @@ Toolbox.prototype = {
* @param {string} toolId Which tool to run the command on (skip if not
* current)
*/
fireCustomKey: function (toolId) {
fireCustomKey: function(toolId) {
let toolDefinition = gDevTools.getToolDefinition(toolId);
if (toolDefinition.onkey &&
@ -1075,7 +1075,7 @@ Toolbox.prototype = {
* Build the buttons for changing hosts. Called every time
* the host changes.
*/
_buildDockButtons: function () {
_buildDockButtons: function() {
if (!this._target.isLocalTab) {
this.component.setDockButtonsEnabled(false);
return;
@ -1114,21 +1114,21 @@ Toolbox.prototype = {
this.component.setHostTypes(hostTypes);
},
_onBottomHostMinimized: function () {
_onBottomHostMinimized: function() {
this.component.setMinimizeState("minimized");
},
_onBottomHostMaximized: function () {
_onBottomHostMaximized: function() {
this.component.setMinimizeState("maximized");
},
_onToolSelectWhileMinimized: function () {
_onToolSelectWhileMinimized: function() {
this.postMessage({
name: "maximize-host"
});
},
postMessage: function (msg) {
postMessage: function(msg) {
// We sometime try to send messages in middle of destroy(), where the
// toolbox iframe may already be detached and no longer have a parent.
if (this.win.parent) {
@ -1139,7 +1139,7 @@ Toolbox.prototype = {
}
},
_onBottomHostWillChange: function () {
_onBottomHostWillChange: function() {
this.postMessage({
name: "maximize-host"
});
@ -1147,7 +1147,7 @@ Toolbox.prototype = {
this.off("before-select", this._onToolSelectWhileMinimized);
},
_toggleMinimizeMode: function () {
_toggleMinimizeMode: function() {
if (this.hostType !== Toolbox.HostType.BOTTOM) {
return;
}
@ -1165,7 +1165,7 @@ Toolbox.prototype = {
/**
* Initiate ToolboxTabs React component and all it's properties. Do the initial render.
*/
_buildTabs: function () {
_buildTabs: function() {
// Get the initial list of tab definitions. This list can be amended at a later time
// by tools registering themselves.
const definitions = gDevTools.getToolDefinitionArray();
@ -1180,7 +1180,7 @@ Toolbox.prototype = {
this.component.setOptionsPanel(definitions.find(({id}) => id === "options"));
},
_mountReactComponent: function () {
_mountReactComponent: function() {
// Ensure the toolbar doesn't try to render until the tool is ready.
const element = this.React.createElement(this.ToolboxController, {
L10N,
@ -1201,7 +1201,7 @@ Toolbox.prototype = {
* results in navigating away from the toolbar container.
* @param {FocusEvent} event
*/
_onToolbarFocus: function (id) {
_onToolbarFocus: function(id) {
this.component.setFocusedButton(id);
},
@ -1213,7 +1213,7 @@ Toolbox.prototype = {
* for if they are the focused element.
* @param {KeyboardEvent} event
*/
_onToolbarArrowKeypress: function (event) {
_onToolbarArrowKeypress: function(event) {
let { key, target, ctrlKey, shiftKey, altKey, metaKey } = event;
// If any of the modifier keys are pressed do not attempt navigation as it
@ -1319,7 +1319,7 @@ Toolbox.prototype = {
* Note: Toggle picker can be overwritten by panel other than the inspector to
* allow for custom picker behaviour.
*/
_onPickerClick: function () {
_onPickerClick: function() {
let focus = this.hostType === Toolbox.HostType.BOTTOM ||
this.hostType === Toolbox.HostType.SIDE;
let currentPanel = this.getCurrentPanel();
@ -1334,7 +1334,7 @@ Toolbox.prototype = {
* If the picker is activated, then allow the Escape key to deactivate the
* functionality instead of the default behavior of toggling the console.
*/
_onPickerKeypress: function (event) {
_onPickerKeypress: function(event) {
if (event.keyCode === KeyCodes.DOM_VK_ESCAPE) {
let currentPanel = this.getCurrentPanel();
if (currentPanel.cancelPicker) {
@ -1347,11 +1347,11 @@ Toolbox.prototype = {
}
},
_onPickerStarted: function () {
_onPickerStarted: function() {
this.doc.addEventListener("keypress", this._onPickerKeypress, true);
},
_onPickerStopped: function () {
_onPickerStopped: function() {
this.doc.removeEventListener("keypress", this._onPickerKeypress, true);
},
@ -1377,7 +1377,7 @@ Toolbox.prototype = {
* Apply the current cache setting from devtools.cache.disabled to this
* toolbox's tab.
*/
_applyCacheSettings: function () {
_applyCacheSettings: function() {
let pref = "devtools.cache.disabled";
let cacheDisabled = Services.prefs.getBoolPref(pref);
@ -1390,7 +1390,7 @@ Toolbox.prototype = {
* Apply the current service workers testing setting from
* devtools.serviceWorkers.testing.enabled to this toolbox's tab.
*/
_applyServiceWorkersTestingSettings: function () {
_applyServiceWorkersTestingSettings: function() {
let pref = "devtools.serviceWorkers.testing.enabled";
let serviceWorkersTestingEnabled =
Services.prefs.getBoolPref(pref) || false;
@ -1442,7 +1442,7 @@ Toolbox.prototype = {
/**
* Ensure the visibility of each toolbox button matches the preference value.
*/
_commandIsVisible: function (button) {
_commandIsVisible: function(button) {
const {
isTargetSupported,
visibilityswitch
@ -1463,7 +1463,7 @@ Toolbox.prototype = {
* @param {string} toolDefinition
* Tool definition of the tool to build a tab for.
*/
_buildPanelForTool: function (toolDefinition) {
_buildPanelForTool: function(toolDefinition) {
if (!toolDefinition.isTargetSupported(this._target)) {
return;
}
@ -1656,7 +1656,7 @@ Toolbox.prototype = {
* @param {string} id
* The id of the tool to load.
*/
loadTool: function (id) {
loadTool: function(id) {
if (id === "inspector" && !this._inspector) {
return this.initInspector().then(() => this.loadTool(id));
}
@ -1792,7 +1792,7 @@ Toolbox.prototype = {
*
* @param {IFrameElement} iframe
*/
setIframeDocumentDir: function (iframe) {
setIframeDocumentDir: function(iframe) {
let docEl = iframe.contentWindow && iframe.contentWindow.document.documentElement;
if (!docEl || docEl.namespaceURI !== HTML_NS) {
// Bail out if the content window or document is not ready or if the document is not
@ -1813,7 +1813,7 @@ Toolbox.prototype = {
* @param {string} id
* The Id of the item within the collection to select
*/
selectSingleNode: function (collection, id) {
selectSingleNode: function(collection, id) {
[...collection].forEach(node => {
if (node.id === id) {
node.setAttribute("selected", "true");
@ -1849,7 +1849,7 @@ Toolbox.prototype = {
* It will help panel react differently depending on them being displayed or in
* background.
*/
setIframeVisible: function (iframe, visible) {
setIframeVisible: function(iframe, visible) {
let state = visible ? "visible" : "hidden";
let win = iframe.contentWindow;
let doc = win.document;
@ -1869,7 +1869,7 @@ Toolbox.prototype = {
* @param {string} id
* The id of the tool to switch to
*/
selectTool: function (id) {
selectTool: function(id) {
this.emit("before-select", id);
if (this.currentToolId == id) {
@ -1930,7 +1930,7 @@ Toolbox.prototype = {
* @param {string} id
* The id of tool to focus
*/
focusTool: function (id, state = true) {
focusTool: function(id, state = true) {
let iframe = this.doc.getElementById("toolbox-panel-iframe-" + id);
if (state) {
@ -1943,7 +1943,7 @@ Toolbox.prototype = {
/**
* Focus split console's input line
*/
focusConsoleInput: function () {
focusConsoleInput: function() {
let consolePanel = this.getPanel("webconsole");
if (consolePanel) {
consolePanel.focusInput();
@ -1955,7 +1955,7 @@ Toolbox.prototype = {
* of the console, then store the newly focused element, so that
* it can be restored once the split console closes.
*/
_onFocus: function ({originalTarget}) {
_onFocus: function({originalTarget}) {
// Ignore any non element nodes, or any elements contained
// within the webconsole frame.
let webconsoleURL = gDevTools.getToolDefinition("webconsole").url;
@ -1973,7 +1973,7 @@ Toolbox.prototype = {
* @returns {Promise} a promise that resolves once the tool has been
* loaded and focused.
*/
openSplitConsole: function () {
openSplitConsole: function() {
this._splitConsole = true;
Services.prefs.setBoolPref(SPLITCONSOLE_ENABLED_PREF, true);
this._refreshConsoleDisplay();
@ -1996,7 +1996,7 @@ Toolbox.prototype = {
* @returns {Promise} a promise that resolves once the tool has been
* closed.
*/
closeSplitConsole: function () {
closeSplitConsole: function() {
this._splitConsole = false;
Services.prefs.setBoolPref(SPLITCONSOLE_ENABLED_PREF, false);
this._refreshConsoleDisplay();
@ -2015,7 +2015,7 @@ Toolbox.prototype = {
* @returns {Promise} a promise that resolves once the tool has been
* opened or closed.
*/
toggleSplitConsole: function () {
toggleSplitConsole: function() {
if (this.currentToolId !== "webconsole") {
return this.splitConsole ?
this.closeSplitConsole() :
@ -2028,14 +2028,14 @@ Toolbox.prototype = {
/**
* Tells the target tab to reload.
*/
reloadTarget: function (force) {
reloadTarget: function(force) {
this.target.activeTab.reload({ force: force });
},
/**
* Loads the tool next to the currently selected tool.
*/
selectNextTool: function () {
selectNextTool: function() {
let definitions = this.component.panelDefinitions;
const index = definitions.findIndex(({id}) => id === this.currentToolId);
let definition = definitions[index + 1];
@ -2048,7 +2048,7 @@ Toolbox.prototype = {
/**
* Loads the tool just left to the currently selected tool.
*/
selectPreviousTool: function () {
selectPreviousTool: function() {
let definitions = this.component.panelDefinitions;
const index = definitions.findIndex(({id}) => id === this.currentToolId);
let definition = definitions[index - 1];
@ -2089,7 +2089,7 @@ Toolbox.prototype = {
/**
* Raise the toolbox host.
*/
raise: function () {
raise: function() {
this.postMessage({
name: "raise-host"
});
@ -2122,7 +2122,7 @@ Toolbox.prototype = {
/**
* Refresh the host's title.
*/
_refreshHostTitle: function () {
_refreshHostTitle: function() {
let title;
if (this.target.name && this.target.name != this.target.url) {
const url = this.target.isWebExtension ?
@ -2173,7 +2173,7 @@ Toolbox.prototype = {
return yield prefFront.getBoolPref(DISABLE_AUTOHIDE_PREF);
}),
_listFrames: function (event) {
_listFrames: function(event) {
if (!this._target.activeTab || !this._target.activeTab.traits.frames) {
// We are not targetting a regular TabActor
// it can be either an addon or browser toolbox actor
@ -2191,7 +2191,7 @@ Toolbox.prototype = {
/**
* Show a drop down menu that allows the user to switch frames.
*/
showFramesMenu: async function (event) {
showFramesMenu: async function(event) {
let menu = new Menu();
let target = event.target;
@ -2255,7 +2255,7 @@ Toolbox.prototype = {
/**
* Handle keyDown event on 'frames' button to show available frames
*/
handleKeyDownOnFramesButton: function (event) {
handleKeyDownOnFramesButton: function(event) {
this.shortcuts.on(L10N.getStr("toolbox.showFrames.key"),
this.showFramesMenuOnKeyDown);
},
@ -2263,7 +2263,7 @@ Toolbox.prototype = {
/**
* Show 'frames' menu on key down
*/
showFramesMenuOnKeyDown: function (event) {
showFramesMenuOnKeyDown: function(event) {
if (event.target.id == "command-button-frames") {
this.showFramesMenu(event);
}
@ -2272,7 +2272,7 @@ Toolbox.prototype = {
/**
* Select a frame by sending 'switchToFrame' packet to the backend.
*/
onSelectFrame: function (frameId) {
onSelectFrame: function(frameId) {
// Send packet to the backend to select specified frame and
// wait for 'frameUpdate' event packet to update the UI.
let packet = {
@ -2286,7 +2286,7 @@ Toolbox.prototype = {
/**
* Highlight a frame in the page
*/
onHightlightFrame: async function (frameId) {
onHightlightFrame: async function(frameId) {
// Only enable frame highlighting when the top level document is targeted
if (this._supportsFrameHighlight &&
this.frameMap.get(this.selectedFrameId).parentID === undefined) {
@ -2309,7 +2309,7 @@ Toolbox.prototype = {
* parentID {Number}: ID of the parent frame (not set
* for top level window)
*/
_updateFrames: function (event, data) {
_updateFrames: function(event, data) {
if (!Services.prefs.getBoolPref("devtools.command-button-frames.enabled")) {
return;
}
@ -2365,7 +2365,7 @@ Toolbox.prototype = {
/**
* Switch to the last used host for the toolbox UI.
*/
switchToPreviousHost: function () {
switchToPreviousHost: function() {
return this.switchHost("previous");
},
@ -2376,7 +2376,7 @@ Toolbox.prototype = {
* @param {string} hostType
* The host type of the new host object
*/
switchHost: function (hostType) {
switchHost: function(hostType) {
if (hostType == this.hostType || !this._target.isLocalTab) {
return null;
}
@ -2398,7 +2398,7 @@ Toolbox.prototype = {
return this.once("host-changed");
},
_onSwitchedHost: function ({ hostType }) {
_onSwitchedHost: function({ hostType }) {
this._hostType = hostType;
this._buildDockButtons();
@ -2423,7 +2423,7 @@ Toolbox.prototype = {
* @returns {bool}
* Returns true if the tool is registered globally or on this toolbox.
*/
isToolRegistered: function (toolId) {
isToolRegistered: function(toolId) {
return !!this.getToolDefinition(toolId);
},
@ -2438,7 +2438,7 @@ Toolbox.prototype = {
* @returns {object}
* The plain javascript object that represents the requested tool definition.
*/
getToolDefinition: function (toolId) {
getToolDefinition: function(toolId) {
return gDevTools.getToolDefinition(toolId) ||
this.additionalToolDefinitions.get(toolId);
},
@ -2451,7 +2451,7 @@ Toolbox.prototype = {
* @param {string} toolId
* Id of the tool to be removed.
*/
unloadTool: function (toolId) {
unloadTool: function(toolId) {
if (typeof toolId != "string") {
throw new Error("Unexpected non-string toolId received.");
}
@ -2508,7 +2508,7 @@ Toolbox.prototype = {
* @param {string} toolId
* Id of the tool that was registered
*/
_toolRegistered: function (event, toolId) {
_toolRegistered: function(event, toolId) {
// Tools can either be in the global devtools, or added to this specific toolbox
// as an additional tool.
let definition = gDevTools.getToolDefinition(toolId);
@ -2540,7 +2540,7 @@ Toolbox.prototype = {
* @param {string} toolId
* id of the tool that was unregistered
*/
_toolUnregistered: function (event, toolId) {
_toolUnregistered: function(event, toolId) {
this.unloadTool(toolId);
// Emit the event so tools can listen to it from the toolbox level
// instead of gDevTools
@ -2551,7 +2551,7 @@ Toolbox.prototype = {
* Initialize the inspector/walker/selection/highlighter fronts.
* Returns a promise that resolves when the fronts are initialized
*/
initInspector: function () {
initInspector: function() {
if (!this._initInspector) {
this._initInspector = Task.spawn(function* () {
this._inspector = InspectorFront(this._target.client, this._target.form);
@ -2573,18 +2573,18 @@ Toolbox.prototype = {
return this._initInspector;
},
_onNewSelectedNodeFront: function (evt) {
_onNewSelectedNodeFront: function(evt) {
// Emit a "selection-changed" event when the toolbox.selection has been set
// to a new node (or cleared). Currently used in the WebExtensions APIs (to
// provide the `devtools.panels.elements.onSelectionChanged` event).
this.emit("selection-changed");
},
_onInspectObject: function (evt, packet) {
_onInspectObject: function(evt, packet) {
this.inspectObjectActor(packet.objectActor, packet.inspectFromAnnotation);
},
inspectObjectActor: async function (objectActor, inspectFromAnnotation) {
inspectObjectActor: async function(objectActor, inspectFromAnnotation) {
if (objectActor.preview &&
objectActor.preview.nodeType === domNodeConstants.ELEMENT_NODE) {
// Open the inspector and select the DOM Element.
@ -2611,7 +2611,7 @@ Toolbox.prototype = {
* Destroy the inspector/walker/selection fronts
* Returns a promise that resolves when the fronts are destroyed
*/
destroyInspector: function () {
destroyInspector: function() {
if (this._destroyingInspector) {
return this._destroyingInspector;
}
@ -2667,14 +2667,14 @@ Toolbox.prototype = {
*
* @return The notification box component.
*/
getNotificationBox: function () {
getNotificationBox: function() {
return this.notificationBox;
},
/**
* Remove all UI elements, detach from target and clear up
*/
destroy: function () {
destroy: function() {
// If several things call destroy then we give them all the same
// destruction promise so we're sure to destroy only once
if (this._destroyer) {
@ -2854,11 +2854,11 @@ Toolbox.prototype = {
return this._destroyer;
},
_highlighterReady: function () {
_highlighterReady: function() {
this.emit("highlighter-ready");
},
_highlighterHidden: function () {
_highlighterHidden: function() {
this.emit("highlighter-hide");
},
@ -2866,7 +2866,7 @@ Toolbox.prototype = {
* For displaying the promotional Doorhanger on first opening of
* the developer tools, promoting the Developer Edition.
*/
_showDevEditionPromo: function () {
_showDevEditionPromo: function() {
// Do not display in browser toolbox
if (this.target.chrome) {
return;
@ -2877,7 +2877,7 @@ Toolbox.prototype = {
/**
* Enable / disable necessary textbox menu items using globalOverlay.js.
*/
_updateTextBoxMenuItems: function () {
_updateTextBoxMenuItems: function() {
let window = this.win;
["cmd_undo", "cmd_delete", "cmd_cut",
"cmd_copy", "cmd_paste", "cmd_selectAll"].forEach(window.goUpdateCommand);
@ -2890,7 +2890,7 @@ Toolbox.prototype = {
* @param {Number} x
* @param {Number} y
*/
openTextBoxContextMenu: function (x, y) {
openTextBoxContextMenu: function(x, y) {
this.textBoxContextMenuPopup.openPopupAtScreen(x, y, true);
},
@ -2944,7 +2944,7 @@ Toolbox.prototype = {
* Return the style sheets front, creating it if necessary. If the
* style sheets front is not supported by the target, returns null.
*/
initStyleSheetsFront: function () {
initStyleSheetsFront: function() {
if (!this._styleSheets && this.target.hasActor("styleSheets")) {
this._styleSheets = StyleSheetsFront(this.target.client, this.target.form);
}
@ -3017,7 +3017,7 @@ Toolbox.prototype = {
* Opens source in style editor. Falls back to plain "view-source:".
* @see devtools/client/shared/source-utils.js
*/
viewSourceInStyleEditor: function (sourceURL, sourceLine) {
viewSourceInStyleEditor: function(sourceURL, sourceLine) {
return viewSource.viewSourceInStyleEditor(this, sourceURL, sourceLine);
},
@ -3025,7 +3025,7 @@ Toolbox.prototype = {
* Opens source in debugger. Falls back to plain "view-source:".
* @see devtools/client/shared/source-utils.js
*/
viewSourceInDebugger: function (sourceURL, sourceLine) {
viewSourceInDebugger: function(sourceURL, sourceLine) {
return viewSource.viewSourceInDebugger(this, sourceURL, sourceLine);
},
@ -3038,7 +3038,7 @@ Toolbox.prototype = {
*
* @see devtools/client/shared/source-utils.js
*/
viewSourceInScratchpad: function (sourceURL, sourceLine) {
viewSourceInScratchpad: function(sourceURL, sourceLine) {
return viewSource.viewSourceInScratchpad(sourceURL, sourceLine);
},
@ -3046,7 +3046,7 @@ Toolbox.prototype = {
* Opens source in plain "view-source:".
* @see devtools/client/shared/source-utils.js
*/
viewSource: function (sourceURL, sourceLine) {
viewSource: function(sourceURL, sourceLine) {
return viewSource.viewSource(this, sourceURL, sourceLine);
},
@ -3055,7 +3055,7 @@ Toolbox.prototype = {
/**
* Returns data (HAR) collected by the Network panel.
*/
getHARFromNetMonitor: function () {
getHARFromNetMonitor: function() {
let netPanel = this.getPanel("netmonitor");
// The panel doesn't have to exist (it must be selected
@ -3077,7 +3077,7 @@ Toolbox.prototype = {
* a function that takes ({harEntry, requestId})
* as first argument.
*/
addRequestFinishedListener: function (listener) {
addRequestFinishedListener: function(listener) {
// Log console message informing the extension developer
// that the Network panel needs to be selected at least
// once in order to receive `onRequestFinished` events.
@ -3089,11 +3089,11 @@ Toolbox.prototype = {
this._requestFinishedListeners.add(listener);
},
removeRequestFinishedListener: function (listener) {
removeRequestFinishedListener: function(listener) {
this._requestFinishedListeners.delete(listener);
},
getRequestFinishedListeners: function () {
getRequestFinishedListeners: function() {
return this._requestFinishedListeners;
},
@ -3105,7 +3105,7 @@ Toolbox.prototype = {
* Id of the request for which the response content
* should be fetched.
*/
fetchResponseContent: function (requestId) {
fetchResponseContent: function(requestId) {
let netPanel = this.getPanel("netmonitor");
// The panel doesn't have to exist (it must be selected

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

@ -58,7 +58,7 @@ const reducers = {
},
};
module.exports = function (state = INITIAL_STATE, action) {
module.exports = function(state = INITIAL_STATE, action) {
const reducer = reducers[action.type];
return reducer ? reducer(state, action) : state;
};

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

@ -18,7 +18,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_simple_animation.html");
const { inspector, panel } = await openAnimationInspector();

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

@ -22,7 +22,7 @@ const TEST_DATA = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_simple_animation.html");
const { inspector, panel } = await openAnimationInspector();

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

@ -5,7 +5,7 @@
// Test that whether close button in header of animation detail works.
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { animationInspector, panel } = await openAnimationInspector();

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

@ -20,7 +20,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { inspector, panel } = await openAnimationInspector();

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

@ -7,7 +7,7 @@
requestLongerTimeout(2);
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { animationInspector, inspector, panel } = await openAnimationInspector();

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

@ -5,7 +5,7 @@
// Test that whether animations ui could be displayed
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_simple_animation.html");
const { animationInspector, inspector, panel } = await openAnimationInspector();

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

@ -8,7 +8,7 @@
// * number of elements
// * content of element
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_simple_animation.html");
const { animationInspector, inspector, panel } = await openAnimationInspector();

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

@ -16,7 +16,7 @@ const { findOptimalTimeInterval } =
// AnimationTimeTickList component.
const TIME_GRADUATION_MIN_SPACING = 40;
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_simple_animation.html");
const { animationInspector, inspector, panel } = await openAnimationInspector();
const timeScale = new TimeScale(animationInspector.animations);

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

@ -6,7 +6,7 @@ requestLongerTimeout(2);
// Test that the panel shows no animation data for invalid or not animated nodes
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_simple_animation.html");
const { inspector, panel } = await openAnimationInspector();

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

@ -5,7 +5,7 @@
// Test whether AnimationInspector and base pane exists.
add_task(async function () {
add_task(async function() {
const { animationInspector, panel } = await openAnimationInspector();
ok(animationInspector, "AnimationInspector should exist");
ok(panel, "Main animation-inspector panel should exist");

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

@ -408,7 +408,7 @@ const TEST_DATA = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_keyframes.html");
const { inspector, panel } = await openAnimationInspector();

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

@ -189,7 +189,7 @@ const TEST_DATA = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_easings.html");
const { inspector, panel } = await openAnimationInspector();

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

@ -133,7 +133,7 @@ const TEST_DATA = [
}
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_keyframes.html");
const { inspector, panel } = await openAnimationInspector();

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

@ -29,7 +29,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { panel } = await openAnimationInspector();

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

@ -6,7 +6,7 @@
// Test that when animations displayed in the timeline are running on the
// compositor, they get a special icon and information in the tooltip.
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_simple_animation.html");
const { inspector, panel } = await openAnimationInspector();

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

@ -389,7 +389,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { panel } = await openAnimationInspector();

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

@ -49,7 +49,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { panel } = await openAnimationInspector();

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

@ -29,7 +29,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { panel } = await openAnimationInspector();

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

@ -41,7 +41,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { panel } = await openAnimationInspector();

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

@ -22,7 +22,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { panel } = await openAnimationInspector();

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

@ -23,7 +23,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { panel } = await openAnimationInspector();

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

@ -174,7 +174,7 @@ const TEST_CASES = [
},
];
add_task(async function () {
add_task(async function() {
await addTab(URL_ROOT + "doc_multi_timings.html");
const { panel } = await openAnimationInspector();

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

@ -32,7 +32,7 @@ registerCleanupFunction(() => {
*
* @return {Promise} that resolves when the inspector is ready.
*/
const openAnimationInspector = async function () {
const openAnimationInspector = async function() {
const { inspector, toolbox } = await openInspectorSidebarTab(TAB_NAME);
await inspector.once("inspector-updated");
const { animationinspector: animationInspector } = inspector;
@ -46,7 +46,7 @@ const openAnimationInspector = async function () {
*
* @return {Promise} that resolves when the toolbox has closed.
*/
const closeAnimationInspector = async function () {
const closeAnimationInspector = async function() {
const target = TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.closeToolbox(target);
};
@ -57,7 +57,7 @@ const closeAnimationInspector = async function () {
* * parts of the Web Animations API (Bug 1264101), and
* * the frames() timing function (Bug 1379582).
*/
const enableAnimationFeatures = function () {
const enableAnimationFeatures = function() {
return new Promise(resolve => {
SpecialPowers.pushPrefEnv({"set": [
["dom.animations-api.core.enabled", true],
@ -74,7 +74,7 @@ const enableAnimationFeatures = function () {
* @return a promise that resolves to the tab object when the url is loaded
*/
const _addTab = addTab;
addTab = async function (url) {
addTab = async function(url) {
await enableAnimationFeatures();
const tab = await _addTab(url);
const browser = tab.linkedBrowser;
@ -93,7 +93,7 @@ addTab = async function (url) {
* @param {Number} index
* The index of the animation to click on.
*/
const clickOnAnimation = async function (animationInspector, panel, index) {
const clickOnAnimation = async function(animationInspector, panel, index) {
info("Click on animation " + index + " in the timeline");
const summaryGraphEl = panel.querySelectorAll(".animation-summary-graph")[index];
// Scroll to show the timeBlock since the element may be out of displayed area.
@ -112,7 +112,7 @@ const clickOnAnimation = async function (animationInspector, panel, index) {
* @param {AnimationsPanel} panel
* The panel instance.
*/
const clickOnDetailCloseButton = function (panel) {
const clickOnDetailCloseButton = function(panel) {
info("Click on close button for animation detail pane");
const buttonEl = panel.querySelector(".animation-detail-close-button");
const bounds = buttonEl.getBoundingClientRect();
@ -135,7 +135,7 @@ const clickOnDetailCloseButton = function (panel) {
* @return {Promise} Resolves when the inspector is updated with the new node
* and animations of its subtree are properly displayed.
*/
const selectNodeAndWaitForAnimations = async function (data, inspector, reason = "test") {
const selectNodeAndWaitForAnimations = async function(data, inspector, reason = "test") {
// We want to make sure the rest of the test waits for the animations to
// be properly displayed (wait for all target DOM nodes to be previewed).
const onUpdated = inspector.once("inspector-updated");
@ -153,7 +153,7 @@ const selectNodeAndWaitForAnimations = async function (data, inspector, reason =
* The instance of InspectorPanel currently loaded in the toolbox
* @return {Promise} Resolves when the sidebar size changed.
*/
const setSidebarWidth = async function (width, inspector) {
const setSidebarWidth = async function(width, inspector) {
const onUpdated = inspector.toolbox.once("inspector-sidebar-resized");
inspector.splitBox.setState({ width });
await onUpdated;
@ -164,7 +164,7 @@ const setSidebarWidth = async function (width, inspector) {
*
* @param {AnimationInspector} animationInspector
*/
const waitForRendering = async function (animationInspector) {
const waitForRendering = async function(animationInspector) {
await Promise.all([
waitForAllAnimationTargets(animationInspector),
waitForAllSummaryGraph(animationInspector),
@ -177,7 +177,7 @@ const waitForRendering = async function (animationInspector) {
*
* @param {AnimationInspector} inspector
*/
const waitForAnimationDetail = async function (animationInspector) {
const waitForAnimationDetail = async function(animationInspector) {
if (animationInspector.animations.length === 1) {
await animationInspector.once("animation-keyframes-rendered");
}
@ -189,7 +189,7 @@ const waitForAnimationDetail = async function (animationInspector) {
*
* @param {AnimationInspector} animationInspector
*/
const waitForAllAnimationTargets = async function (animationInspector) {
const waitForAllAnimationTargets = async function(animationInspector) {
for (let i = 0; i < animationInspector.animations.length; i++) {
await animationInspector.once("animation-target-rendered");
}
@ -200,7 +200,7 @@ const waitForAllAnimationTargets = async function (animationInspector) {
*
* @param {AnimationInspector} inspector
*/
const waitForAllSummaryGraph = async function (animationInspector) {
const waitForAllSummaryGraph = async function(animationInspector) {
for (let i = 0; i < animationInspector.animations.length; i++) {
await animationInspector.once("animation-summary-graph-rendered");
}

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

@ -38,7 +38,7 @@ let reducers = {
};
module.exports = function (boxModel = INITIAL_BOX_MODEL, action) {
module.exports = function(boxModel = INITIAL_BOX_MODEL, action) {
let reducer = reducers[action.type];
if (!reducer) {
return boxModel;

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

@ -17,13 +17,13 @@ const TEST_URL = "data:text/html;charset=utf-8," + encodeURIComponent(HTML);
var highlightedNodeFront, highlighterOptions;
add_task(async function () {
add_task(async function() {
await addTab(TEST_URL);
let {toolbox, inspector, view} = await openBoxModelView();
await selectNode("div", inspector);
// Mock the highlighter by replacing the showBoxModel method.
toolbox.highlighter.showBoxModel = function (nodeFront, options) {
toolbox.highlighter.showBoxModel = function(nodeFront, options) {
highlightedNodeFront = nodeFront;
highlighterOptions = options;
};

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

@ -57,10 +57,10 @@ function openBoxModelView() {
// The actual highligher show/hide methods are mocked in box model tests.
// The highlighter is tested in devtools/inspector/test.
function mockHighlighter({highlighter}) {
highlighter.showBoxModel = function () {
highlighter.showBoxModel = function() {
return promise.resolve();
};
highlighter.hideBoxModel = function () {
highlighter.hideBoxModel = function() {
return promise.resolve();
};
}

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

@ -38,7 +38,7 @@ EditingSession.prototype = {
* The name of the property.
* @return {String} the value.
*/
getPropertyFromRule: function (rule, property) {
getPropertyFromRule: function(rule, property) {
// Use the parsed declarations in the StyleRuleFront object if available.
let index = this.getPropertyIndex(property, rule);
if (index !== -1) {
@ -58,7 +58,7 @@ EditingSession.prototype = {
* @param {String} property
* The name of the property as a string
*/
getProperty: function (property) {
getProperty: function(property) {
// Create a hidden element for getPropertyFromRule to use
let div = this._doc.createElement("div");
div.setAttribute("style", "display: none");
@ -89,7 +89,7 @@ EditingSession.prototype = {
* Optional, defaults to the element style rule.
* @return {Number} The property index in the rule.
*/
getPropertyIndex: function (name, rule = this._rules[0]) {
getPropertyIndex: function(name, rule = this._rules[0]) {
let elementStyleRule = this._rules[0];
if (!elementStyleRule.declarations.length) {
return -1;
@ -174,7 +174,7 @@ EditingSession.prototype = {
}
}),
destroy: function () {
destroy: function() {
this._doc = null;
this._rules = null;
this._modifications.clear();

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

@ -45,7 +45,7 @@ ArrowScrollBox.prototype = {
* Build the HTML, add to the DOM and start listening to
* events
*/
init: function () {
init: function() {
this.constructHtml();
this.onUnderflow();
@ -72,7 +72,7 @@ ArrowScrollBox.prototype = {
/**
* Determine whether the current text directionality is RTL
*/
isRtl: function () {
isRtl: function() {
return this.doc.dir === "rtl";
},
@ -81,7 +81,7 @@ ArrowScrollBox.prototype = {
* @param {Element} element element to scroll
* @param {String} block desired alignment of element after scrolling
*/
scrollToElement: function (element, block) {
scrollToElement: function(element, block) {
element.scrollIntoView({ block: block, behavior: this.scrollBehavior });
},
@ -90,7 +90,7 @@ ArrowScrollBox.prototype = {
* while the mouse button is held
* @param {Function} repeatFn the function to repeat while the button is held
*/
clickOrHold: function (repeatFn) {
clickOrHold: function(repeatFn) {
let timer;
let container = this.container;
@ -119,7 +119,7 @@ ArrowScrollBox.prototype = {
/**
* When start button is dbl clicked scroll to first element
*/
onStartBtnDblClick: function () {
onStartBtnDblClick: function() {
let children = this.inner.childNodes;
if (children.length < 1) {
return;
@ -132,7 +132,7 @@ ArrowScrollBox.prototype = {
/**
* When end button is dbl clicked scroll to last element
*/
onEndBtnDblClick: function () {
onEndBtnDblClick: function() {
let children = this.inner.childNodes;
if (children.length < 1) {
return;
@ -145,7 +145,7 @@ ArrowScrollBox.prototype = {
/**
* When start arrow button is clicked scroll towards first element
*/
onStartBtnClick: function () {
onStartBtnClick: function() {
let scrollToStart = () => {
let element = this.getFirstInvisibleElement();
if (!element) {
@ -162,7 +162,7 @@ ArrowScrollBox.prototype = {
/**
* When end arrow button is clicked scroll towards last element
*/
onEndBtnClick: function () {
onEndBtnClick: function() {
let scrollToEnd = () => {
let element = this.getLastInvisibleElement();
if (!element) {
@ -180,7 +180,7 @@ ArrowScrollBox.prototype = {
* Event handler for scrolling, update the
* enabled/disabled status of the arrow buttons
*/
onScroll: function () {
onScroll: function() {
let first = this.getFirstInvisibleElement();
if (!first) {
this.startBtn.setAttribute("disabled", "true");
@ -199,7 +199,7 @@ ArrowScrollBox.prototype = {
/**
* On underflow, make the arrow buttons invisible
*/
onUnderflow: function () {
onUnderflow: function() {
this.startBtn.style.visibility = "collapse";
this.endBtn.style.visibility = "collapse";
this.emit("underflow");
@ -208,7 +208,7 @@ ArrowScrollBox.prototype = {
/**
* On overflow, show the arrow buttons
*/
onOverflow: function () {
onOverflow: function() {
this.startBtn.style.visibility = "visible";
this.endBtn.style.visibility = "visible";
this.emit("overflow");
@ -222,7 +222,7 @@ ArrowScrollBox.prototype = {
* @param {Number} elementLeft the left edge of the element
* @param {Number} elementRight the right edge of the element
*/
elementLeftOfContainer: function (left, right, elementLeft, elementRight) {
elementLeftOfContainer: function(left, right, elementLeft, elementRight) {
return elementLeft < (left - SCROLL_MARGIN)
&& elementRight < (right - SCROLL_MARGIN);
},
@ -235,7 +235,7 @@ ArrowScrollBox.prototype = {
* @param {Number} elementLeft the left edge of the element
* @param {Number} elementRight the right edge of the element
*/
elementRightOfContainer: function (left, right, elementLeft, elementRight) {
elementRightOfContainer: function(left, right, elementLeft, elementRight) {
return elementLeft > (left + SCROLL_MARGIN)
&& elementRight > (right + SCROLL_MARGIN);
},
@ -244,7 +244,7 @@ ArrowScrollBox.prototype = {
* Get the first (i.e. furthest left for LTR)
* non or partly visible element in the scroll box
*/
getFirstInvisibleElement: function () {
getFirstInvisibleElement: function() {
let elementsList = Array.from(this.inner.childNodes).reverse();
let predicate = this.isRtl() ?
@ -256,7 +256,7 @@ ArrowScrollBox.prototype = {
* Get the last (i.e. furthest right for LTR)
* non or partly visible element in the scroll box
*/
getLastInvisibleElement: function () {
getLastInvisibleElement: function() {
let predicate = this.isRtl() ?
this.elementLeftOfContainer : this.elementRightOfContainer;
return this.findFirstWithBounds(this.inner.childNodes, predicate);
@ -269,7 +269,7 @@ ArrowScrollBox.prototype = {
* @param {Function} predicate a function to be called with bounds
* information
*/
findFirstWithBounds: function (elements, predicate) {
findFirstWithBounds: function(elements, predicate) {
let left = this.inner.scrollLeft;
let right = left + this.inner.clientWidth;
for (let element of elements) {
@ -289,7 +289,7 @@ ArrowScrollBox.prototype = {
/**
* Build the HTML for the scroll box and insert it into the DOM
*/
constructHtml: function () {
constructHtml: function() {
this.startBtn = this.createElement("div", "scrollbutton-up",
this.container);
this.createElement("div", "toolbarbutton-icon", this.startBtn);
@ -314,7 +314,7 @@ ArrowScrollBox.prototype = {
* @param {DOMNode} parent the parent node to which it should be appended
* @return {DOMNode} The new element
*/
createElement: function (tagName, className, parent) {
createElement: function(tagName, className, parent) {
let el = this.doc.createElementNS(NS_XHTML, tagName);
el.className = className;
if (parent) {
@ -327,7 +327,7 @@ ArrowScrollBox.prototype = {
/**
* Remove event handlers and clean up
*/
destroy: function () {
destroy: function() {
this.inner.removeEventListener("scroll", this.onScroll);
this.startBtn.removeEventListener("mousedown",
this.onStartBtnClick);
@ -370,7 +370,7 @@ HTMLBreadcrumbs.prototype = {
return this.inspector.walker;
},
_init: function () {
_init: function() {
this.outer = this.doc.getElementById("inspector-breadcrumbs");
this.arrowScrollBox = new ArrowScrollBox(
this.win,
@ -415,7 +415,7 @@ HTMLBreadcrumbs.prototype = {
* @param {NodeFront} node The node to pretty-print
* @return {String}
*/
prettyPrintNodeAsText: function (node) {
prettyPrintNodeAsText: function(node) {
let text = node.displayName;
if (node.isPseudoElement) {
text = node.isBeforePseudoElement ? "::before" : "::after";
@ -447,7 +447,7 @@ HTMLBreadcrumbs.prototype = {
* @param {NodeFront} node The node to pretty-print
* @returns {DocumentFragment}
*/
prettyPrintNodeAsXHTML: function (node) {
prettyPrintNodeAsXHTML: function(node) {
let tagLabel = this.doc.createElementNS(NS_XHTML, "span");
tagLabel.className = "breadcrumbs-widget-item-tag plain";
@ -509,7 +509,7 @@ HTMLBreadcrumbs.prototype = {
* Generic event handler.
* @param {DOMEvent} event.
*/
handleEvent: function (event) {
handleEvent: function(event) {
if (event.type == "click" && event.button == 0) {
this.handleClick(event);
} else if (event.type == "mouseover") {
@ -527,7 +527,7 @@ HTMLBreadcrumbs.prototype = {
* breadcrumb. Ensures that the focus stays on the container at all times.
* @param {DOMEvent} event.
*/
handleFocus: function (event) {
handleFocus: function(event) {
event.stopPropagation();
let node = this.nodeHierarchy[this.currentIndex];
@ -544,7 +544,7 @@ HTMLBreadcrumbs.prototype = {
* On click navigate to the correct node.
* @param {DOMEvent} event.
*/
handleClick: function (event) {
handleClick: function(event) {
let target = event.originalTarget;
if (target.tagName == "button") {
target.onBreadcrumbsClick();
@ -555,7 +555,7 @@ HTMLBreadcrumbs.prototype = {
* On mouse over, highlight the corresponding content DOM Node.
* @param {DOMEvent} event.
*/
handleMouseOver: function (event) {
handleMouseOver: function(event) {
let target = event.originalTarget;
if (target.tagName == "button") {
target.onBreadcrumbsHover();
@ -566,7 +566,7 @@ HTMLBreadcrumbs.prototype = {
* On mouse out, make sure to unhighlight.
* @param {DOMEvent} event.
*/
handleMouseOut: function (event) {
handleMouseOut: function(event) {
this.inspector.toolbox.highlighterUtils.unhighlight();
},
@ -578,7 +578,7 @@ HTMLBreadcrumbs.prototype = {
* @param {DOMEvent} event
* Original event that triggered the shortcut.
*/
handleShortcut: function (event) {
handleShortcut: function(event) {
if (!this.selection.isElementNode()) {
return;
}
@ -608,7 +608,7 @@ HTMLBreadcrumbs.prototype = {
/**
* Remove nodes and clean up.
*/
destroy: function () {
destroy: function() {
this.selection.off("new-node-front", this.update);
this.selection.off("pseudoclass", this.updateSelectors);
this.selection.off("attribute-changed", this.updateSelectors);
@ -635,7 +635,7 @@ HTMLBreadcrumbs.prototype = {
/**
* Empty the breadcrumbs container.
*/
empty: function () {
empty: function() {
while (this.container.hasChildNodes()) {
this.container.firstChild.remove();
}
@ -645,7 +645,7 @@ HTMLBreadcrumbs.prototype = {
* Set which button represent the selected node.
* @param {Number} index Index of the displayed-button to select.
*/
setCursor: function (index) {
setCursor: function(index) {
// Unselect the previously selected button
if (this.currentIndex > -1
&& this.currentIndex < this.nodeHierarchy.length) {
@ -665,7 +665,7 @@ HTMLBreadcrumbs.prototype = {
* @param {NodeFront} node.
* @returns {Number} The index for this node or -1 if not found.
*/
indexOf: function (node) {
indexOf: function(node) {
for (let i = this.nodeHierarchy.length - 1; i >= 0; i--) {
if (this.nodeHierarchy[i].node === node) {
return i;
@ -679,7 +679,7 @@ HTMLBreadcrumbs.prototype = {
* index.
* @param {Number} index.
*/
cutAfter: function (index) {
cutAfter: function(index) {
while (this.nodeHierarchy.length > (index + 1)) {
let toRemove = this.nodeHierarchy.pop();
this.container.removeChild(toRemove.button);
@ -691,7 +691,7 @@ HTMLBreadcrumbs.prototype = {
* @param {NodeFront} node The node from the page.
* @return {DOMNode} The <button> for this node.
*/
buildButton: function (node) {
buildButton: function(node) {
let button = this.doc.createElementNS(NS_XHTML, "button");
button.appendChild(this.prettyPrintNodeAsXHTML(node));
button.className = "breadcrumbs-widget-item";
@ -719,7 +719,7 @@ HTMLBreadcrumbs.prototype = {
* Connecting the end of the breadcrumbs to a node.
* @param {NodeFront} node The node to reach.
*/
expand: function (node) {
expand: function(node) {
let fragment = this.doc.createDocumentFragment();
let lastButtonInserted = null;
let originalLength = this.nodeHierarchy.length;
@ -748,7 +748,7 @@ HTMLBreadcrumbs.prototype = {
* @param {NodeFront} node.
* @return {Number} Index of the ancestor in the cache, or -1 if not found.
*/
getCommonAncestor: function (node) {
getCommonAncestor: function(node) {
while (node) {
let idx = this.indexOf(node);
if (idx > -1) {
@ -762,7 +762,7 @@ HTMLBreadcrumbs.prototype = {
/**
* Ensure the selected node is visible.
*/
scroll: function () {
scroll: function() {
// FIXME bug 684352: make sure its immediate neighbors are visible too.
if (!this.isDestroyed) {
let element = this.nodeHierarchy[this.currentIndex].button;
@ -773,7 +773,7 @@ HTMLBreadcrumbs.prototype = {
/**
* Update all button outputs.
*/
updateSelectors: function () {
updateSelectors: function() {
if (this.isDestroyed) {
return;
}
@ -806,7 +806,7 @@ HTMLBreadcrumbs.prototype = {
* @param {Array} mutations The mutations array.
* @return {Boolean}
*/
_hasInterestingMutations: function (mutations) {
_hasInterestingMutations: function(mutations) {
if (!mutations || !mutations.length) {
return false;
}
@ -835,7 +835,7 @@ HTMLBreadcrumbs.prototype = {
* @param {Array} mutations An array of mutations in case this was called as
* the "markupmutation" event listener.
*/
update: function (reason, mutations) {
update: function(reason, mutations) {
if (this.isDestroyed) {
return;
}

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

@ -10,7 +10,7 @@ let reducers = {
};
module.exports = function (changes = INITIAL_CHANGES, action) {
module.exports = function(changes = INITIAL_CHANGES, action) {
let reducer = reducers[action.type];
if (!reducer) {
return changes;

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

@ -62,10 +62,10 @@ function UpdateProcess(win, array, options) {
this.index = 0;
this.array = array;
this.onItem = options.onItem || function () {};
this.onBatch = options.onBatch || function () {};
this.onDone = options.onDone || function () {};
this.onCancel = options.onCancel || function () {};
this.onItem = options.onItem || function() {};
this.onBatch = options.onBatch || function() {};
this.onDone = options.onDone || function() {};
this.onCancel = options.onCancel || function() {};
this.threshold = options.threshold || 45;
this.canceled = false;
@ -80,7 +80,7 @@ UpdateProcess.prototype = {
/**
* Schedule a new batch on the main loop.
*/
schedule: function () {
schedule: function() {
if (this.canceled) {
return;
}
@ -91,7 +91,7 @@ UpdateProcess.prototype = {
* Cancel the running process. onItem will not be called again,
* and onCancel will be called.
*/
cancel: function () {
cancel: function() {
if (this._timeout) {
clearTimeout(this._timeout);
this._timeout = 0;
@ -100,7 +100,7 @@ UpdateProcess.prototype = {
this.onCancel();
},
_timeoutHandler: function () {
_timeoutHandler: function() {
this._timeout = null;
try {
this._runBatch();
@ -116,7 +116,7 @@ UpdateProcess.prototype = {
}
},
_runBatch: function () {
_runBatch: function() {
let time = Date.now();
while (!this.canceled) {
let next = this._next();
@ -132,7 +132,7 @@ UpdateProcess.prototype = {
* Returns the item at the current index and increases the index.
* If all items have already been processed, will throw ERROR_ITERATION_DONE.
*/
_next: function () {
_next: function() {
if (this.index < this.array.length) {
return this.array[this.index++];
}
@ -227,7 +227,7 @@ function CssComputedView(inspector, document, pageStyle) {
* The key to lookup.
* @returns {String} localized version of the given key.
*/
CssComputedView.l10n = function (name) {
CssComputedView.l10n = function(name) {
try {
return STYLE_INSPECTOR_L10N.getStr(name);
} catch (ex) {
@ -252,7 +252,7 @@ CssComputedView.prototype = {
// Number of visible properties
numVisibleProperties: 0,
setPageStyle: function (pageStyle) {
setPageStyle: function(pageStyle) {
this.pageStyle = pageStyle;
},
@ -260,7 +260,7 @@ CssComputedView.prototype = {
return this.includeBrowserStylesCheckbox.checked;
},
_handlePrefChange: function (event, data) {
_handlePrefChange: function(event, data) {
if (this._computed) {
this.refreshPanel();
}
@ -274,7 +274,7 @@ CssComputedView.prototype = {
* The highlighted node to get styles for.
* @returns a promise that will be resolved when highlighting is complete.
*/
selectElement: function (element) {
selectElement: function(element) {
if (!element) {
this._viewedElement = null;
this.noResults.hidden = false;
@ -311,7 +311,7 @@ CssComputedView.prototype = {
* - value {Object} Depends on the type of the node
* returns null if the node isn't anything we care about
*/
getNodeInfo: function (node) {
getNodeInfo: function(node) {
if (!node) {
return null;
}
@ -415,7 +415,7 @@ CssComputedView.prototype = {
};
},
_createPropertyViews: function () {
_createPropertyViews: function() {
if (this._createViewsPromise) {
return this._createViewsPromise;
}
@ -459,7 +459,7 @@ CssComputedView.prototype = {
/**
* Refresh the panel content.
*/
refreshPanel: function () {
refreshPanel: function() {
if (!this._viewedElement) {
return promise.resolve();
}
@ -535,7 +535,7 @@ CssComputedView.prototype = {
/**
* Handle the shortcut events in the computed view.
*/
_onShortcut: function (name, event) {
_onShortcut: function(name, event) {
if (!event.target.closest("#sidebar-panel-computedview")) {
return;
}
@ -556,7 +556,7 @@ CssComputedView.prototype = {
* @param {String} value
* The search value.
*/
setFilterStyles: function (value = "") {
setFilterStyles: function(value = "") {
this.searchField.value = value;
this.searchField.focus();
this._onFilterStyles();
@ -565,7 +565,7 @@ CssComputedView.prototype = {
/**
* Called when the user enters a search term in the filter style search box.
*/
_onFilterStyles: function () {
_onFilterStyles: function() {
if (this._filterChangedTimeout) {
clearTimeout(this._filterChangedTimeout);
}
@ -592,7 +592,7 @@ CssComputedView.prototype = {
* Called when the user clicks on the clear button in the filter style search
* box. Returns true if the search box is cleared and false otherwise.
*/
_onClearSearch: function () {
_onClearSearch: function() {
if (this.searchField.value) {
this.setFilterStyles("");
return true;
@ -604,7 +604,7 @@ CssComputedView.prototype = {
/**
* The change event handler for the includeBrowserStyles checkbox.
*/
_onIncludeBrowserStyles: function () {
_onIncludeBrowserStyles: function() {
this.refreshSourceFilter();
this.refreshPanel();
},
@ -615,7 +615,7 @@ CssComputedView.prototype = {
* document or one of thedocument's stylesheets. If .checked is false we
* display all properties including those that come from UA stylesheets.
*/
refreshSourceFilter: function () {
refreshSourceFilter: function() {
this._matchedProperties = null;
this._sourceFilter = this.includeBrowserStyles ?
CssLogic.FILTER.UA :
@ -625,7 +625,7 @@ CssComputedView.prototype = {
/**
* Render the box model view.
*/
createBoxModelView: function () {
createBoxModelView: function() {
let {
setSelectedNode,
onShowBoxModelHighlighterForNode,
@ -657,7 +657,7 @@ CssComputedView.prototype = {
/**
* The CSS as displayed by the UI.
*/
createStyleViews: function () {
createStyleViews: function() {
if (CssComputedView.propertyNames) {
return;
}
@ -707,18 +707,18 @@ CssComputedView.prototype = {
/**
* Focus the window on mousedown.
*/
focusWindow: function () {
focusWindow: function() {
this.styleWindow.focus();
},
/**
* Context menu handler.
*/
_onContextMenu: function (event) {
_onContextMenu: function(event) {
this._contextmenu.show(event);
},
_onClick: function (event) {
_onClick: function(event) {
let target = event.target;
if (target.nodeName === "a") {
@ -735,7 +735,7 @@ CssComputedView.prototype = {
* @param {Event} event
* copy event object.
*/
_onCopy: function (event) {
_onCopy: function(event) {
let win = this.styleWindow;
let text = win.getSelection().toString().trim();
if (text !== "") {
@ -747,7 +747,7 @@ CssComputedView.prototype = {
/**
* Copy the current selection to the clipboard
*/
copySelection: function () {
copySelection: function() {
try {
let win = this.styleWindow;
let text = win.getSelection().toString().trim();
@ -761,7 +761,7 @@ CssComputedView.prototype = {
/**
* Destructor for CssComputedView.
*/
destroy: function () {
destroy: function() {
this._viewedElement = null;
this._outputParser = null;
@ -960,7 +960,7 @@ PropertyView.prototype = {
*
* @return {Element}
*/
buildMain: function () {
buildMain: function() {
let doc = this.tree.styleDocument;
// Build the container element
@ -1041,7 +1041,7 @@ PropertyView.prototype = {
return this.element;
},
buildSelectorContainer: function () {
buildSelectorContainer: function() {
let doc = this.tree.styleDocument;
let element = doc.createElementNS(HTML_NS, "div");
element.setAttribute("class", this.propertyContentClassName);
@ -1055,7 +1055,7 @@ PropertyView.prototype = {
/**
* Refresh the panel's CSS property value.
*/
refresh: function () {
refresh: function() {
this.element.className = this.propertyHeaderClassName;
this.element.nextElementSibling.className = this.propertyContentClassName;
@ -1093,7 +1093,7 @@ PropertyView.prototype = {
/**
* Refresh the panel matched rules.
*/
refreshMatchedSelectors: function () {
refreshMatchedSelectors: function() {
let hasMatchedSelectors = this.hasMatchedSelectors;
this.matchedSelectorsContainer.parentNode.hidden = !hasMatchedSelectors;
@ -1129,7 +1129,7 @@ PropertyView.prototype = {
return this._matchedSelectorResponse;
},
_buildMatchedSelectors: function () {
_buildMatchedSelectors: function() {
let frag = this.element.ownerDocument.createDocumentFragment();
for (let selector of this.matchedSelectorViews) {
@ -1195,7 +1195,7 @@ PropertyView.prototype = {
* Used to determine the class name of the targets click
* event.
*/
onMatchedToggle: function (event) {
onMatchedToggle: function(event) {
if (event.shiftKey) {
return;
}
@ -1207,7 +1207,7 @@ PropertyView.prototype = {
/**
* The action when a user clicks on the MDN help link for a property.
*/
mdnLinkClick: function (event) {
mdnLinkClick: function(event) {
let inspector = this.tree.inspector;
if (inspector.target.tab) {
@ -1219,7 +1219,7 @@ PropertyView.prototype = {
/**
* Destroy this property view, removing event listeners
*/
destroy: function () {
destroy: function() {
if (this._matchedSelectorViews) {
for (let view of this._matchedSelectorViews) {
view.destroy();
@ -1297,7 +1297,7 @@ SelectorView.prototype = {
* bundle.
* @see css-logic.js - the CssLogic.STATUS array.
*/
_cacheStatusNames: function () {
_cacheStatusNames: function() {
if (SelectorView.STATUS_NAMES.length) {
return;
}
@ -1379,7 +1379,7 @@ SelectorView.prototype = {
* @param {number} column
* The original column number
*/
_updateLocation: function (enabled, url, line, column) {
_updateLocation: function(enabled, url, line, column) {
if (!this.tree.element) {
return;
}
@ -1411,7 +1411,7 @@ SelectorView.prototype = {
* We can only view stylesheets contained in document.styleSheets inside the
* style editor.
*/
openStyleEditor: function () {
openStyleEditor: function() {
let inspector = this.tree.inspector;
let rule = this.selectorInfo.rule;
@ -1430,7 +1430,7 @@ SelectorView.prototype = {
let {href, line, column} = this.currentLocation;
let target = inspector.target;
if (ToolDefinitions.styleEditor.isTargetSupported(target)) {
gDevTools.showToolbox(target, "styleeditor").then(function (toolbox) {
gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) {
toolbox.getCurrentPanel().selectStyleSheet(href, line, column);
});
}
@ -1439,7 +1439,7 @@ SelectorView.prototype = {
/**
* Destroy this selector view, removing event listeners
*/
destroy: function () {
destroy: function() {
let rule = this.selectorInfo.rule;
if (rule && rule.parentStyleSheet && rule.type != ELEMENT_STYLE) {
const url = rule.parentStyleSheet.href || rule.parentStyleSheet.nodeHref;
@ -1476,14 +1476,14 @@ function ComputedViewTool(inspector, window) {
}
ComputedViewTool.prototype = {
isSidebarActive: function () {
isSidebarActive: function() {
if (!this.computedView) {
return false;
}
return this.inspector.sidebar.getCurrentTabID() == "computedview";
},
onSelected: function (event) {
onSelected: function(event) {
// Ignore the event if the view has been destroyed, or if it's inactive.
// But only if the current selection isn't null. If it's been set to null,
// let the update go through as this is needed to empty the view on
@ -1514,13 +1514,13 @@ ComputedViewTool.prototype = {
}
},
refresh: function () {
refresh: function() {
if (this.isSidebarActive()) {
this.computedView.refreshPanel();
}
},
onPanelSelected: function () {
onPanelSelected: function() {
if (this.inspector.selection.nodeFront === this.computedView._viewedElement) {
this.refresh();
} else {
@ -1532,7 +1532,7 @@ ComputedViewTool.prototype = {
* When markup mutations occur, if an attribute of the selected node changes,
* we need to refresh the view as that might change the node's styles.
*/
onMutations: function (mutations) {
onMutations: function(mutations) {
for (let {type, target} of mutations) {
if (target === this.inspector.selection.nodeFront &&
type === "attributes") {
@ -1546,11 +1546,11 @@ ComputedViewTool.prototype = {
* When the window gets resized, this may cause media-queries to match, and
* therefore, different styles may apply.
*/
onResized: function () {
onResized: function() {
this.refresh();
},
destroy: function () {
destroy: function() {
this.inspector.walker.off("mutations", this.onMutations);
this.inspector.walker.off("resize", this.onResized);
this.inspector.sidebar.off("computedview-selected", this.refresh);

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

@ -53,7 +53,7 @@ const TEST_DATA = [
getHoveredNode: function* () {
return null;
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo, null);
}
},
@ -62,7 +62,7 @@ const TEST_DATA = [
getHoveredNode: function* (view) {
return view.element;
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo, null);
}
},
@ -71,7 +71,7 @@ const TEST_DATA = [
getHoveredNode: function* (view) {
return getComputedViewProperty(view, "color").nameSpan;
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo.type, VIEW_NODE_PROPERTY_TYPE);
ok("property" in nodeInfo.value);
ok("value" in nodeInfo.value);
@ -84,7 +84,7 @@ const TEST_DATA = [
getHoveredNode: function* (view) {
return getComputedViewProperty(view, "color").valueSpan;
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo.type, VIEW_NODE_VALUE_TYPE);
ok("property" in nodeInfo.value);
ok("value" in nodeInfo.value);
@ -98,7 +98,7 @@ const TEST_DATA = [
let {valueSpan} = getComputedViewProperty(view, "background-image");
return valueSpan.querySelector(".theme-link");
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo.type, VIEW_NODE_IMAGE_URL_TYPE);
ok("property" in nodeInfo.value);
ok("value" in nodeInfo.value);
@ -114,7 +114,7 @@ const TEST_DATA = [
let el = yield getComputedViewMatchedRules(view, "background-color");
return el.querySelector(".bestmatch");
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo.type, VIEW_NODE_SELECTOR_TYPE);
is(nodeInfo.value, "div div");
}
@ -125,7 +125,7 @@ const TEST_DATA = [
let el = yield getComputedViewMatchedRules(view, "background-color");
return el.querySelector(".matched");
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo.type, VIEW_NODE_SELECTOR_TYPE);
is(nodeInfo.value, "div");
}
@ -136,7 +136,7 @@ const TEST_DATA = [
let el = yield getComputedViewMatchedRules(view, "color");
return el.querySelector(".parentmatch");
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo.type, VIEW_NODE_SELECTOR_TYPE);
is(nodeInfo.value, "body");
}
@ -147,7 +147,7 @@ const TEST_DATA = [
let el = yield getComputedViewMatchedRules(view, "color");
return el.querySelector(".computed-other-property-value");
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo.type, VIEW_NODE_VALUE_TYPE);
is(nodeInfo.value.property, "color");
is(nodeInfo.value.value, "red");
@ -159,7 +159,7 @@ const TEST_DATA = [
let el = yield getComputedViewMatchedRules(view, "color");
return el.querySelector(".rule-link .theme-link");
},
assertNodeInfo: function (nodeInfo) {
assertNodeInfo: function(nodeInfo) {
is(nodeInfo, null);
}
}

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

@ -72,7 +72,7 @@ function checkHelpLinkKeybinding(view) {
info("Check that MDN link is opened on \"F1\"");
let propView = getFirstVisiblePropertyView(view);
return new Promise(resolve => {
propView.mdnLinkClick = function (event) {
propView.mdnLinkClick = function(event) {
ok(true, "Pressing F1 opened the MDN link");
resolve();
};

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

@ -30,7 +30,7 @@ add_task(function* () {
function getPropertyView(computedView, name) {
let propertyView = null;
computedView.propertyViews.some(function (view) {
computedView.propertyViews.some(function(view) {
if (view.name == name) {
propertyView = view;
return true;

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

@ -10,7 +10,7 @@ let reducers = {
};
module.exports = function (events = INITIAL_EVENTS, action) {
module.exports = function(events = INITIAL_EVENTS, action) {
let reducer = reducers[action.type];
if (!reducer) {
return events;

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

@ -47,7 +47,7 @@ let reducers = {
};
module.exports = function (sidebar = INITIAL_SIDEBAR, action) {
module.exports = function(sidebar = INITIAL_SIDEBAR, action) {
let reducer = reducers[action.type];
if (!reducer) {
return sidebar;

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

@ -37,7 +37,7 @@ let reducers = {
};
module.exports = function (flexbox = INITIAL_FLEXBOX, action) {
module.exports = function(flexbox = INITIAL_FLEXBOX, action) {
let reducer = reducers[action.type];
if (!reducer) {
return flexbox;

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

@ -20,7 +20,7 @@ let reducers = {
};
module.exports = function (fontOptions = INITIAL_FONT_OPTIONS, action) {
module.exports = function(fontOptions = INITIAL_FONT_OPTIONS, action) {
let reducer = reducers[action.type];
if (!reducer) {
return fontOptions;

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

@ -21,7 +21,7 @@ let reducers = {
};
module.exports = function (fontData = INITIAL_FONT_DATA, action) {
module.exports = function(fontData = INITIAL_FONT_DATA, action) {
let reducer = reducers[action.type];
if (!reducer) {
return fontData;

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

@ -42,7 +42,7 @@ let reducers = {
};
module.exports = function (grids = INITIAL_GRIDS, action) {
module.exports = function(grids = INITIAL_GRIDS, action) {
let reducer = reducers[action.type];
if (!reducer) {
return grids;

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

@ -38,7 +38,7 @@ let reducers = {
};
module.exports = function (highlighterSettings = INITIAL_HIGHLIGHTER_SETTINGS, action) {
module.exports = function(highlighterSettings = INITIAL_HIGHLIGHTER_SETTINGS, action) {
let reducer = reducers[action.type];
if (!reducer) {
return highlighterSettings;

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

@ -60,7 +60,7 @@ const TEST_URI = `
</div>
`;
add_task(async function () {
add_task(async function() {
await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let { inspector, gridInspector } = await openLayoutView();

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

@ -18,7 +18,7 @@ const TEST_URI = `
</div>
`;
add_task(async function () {
add_task(async function() {
await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let { inspector, gridInspector, toolbox } = await openLayoutView();
let { document: doc } = gridInspector;

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

@ -42,6 +42,6 @@ var simulateColorPickerChange = Task.async(function* (colorPicker, newRgba) {
spectrum.onChange();
});
registerCleanupFunction(async function () {
registerCleanupFunction(async function() {
await asyncStorage.removeItem("gridInspectorHostColors");
});

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

@ -82,7 +82,7 @@ exports.items = [{
runAt: "server",
name: "eyedropper_server",
hidden: true,
exec: function (args, {environment}) {
exec: function(args, {environment}) {
let eyeDropper = windowEyeDroppers.get(environment.window);
if (!eyeDropper) {
@ -106,7 +106,7 @@ exports.items = [{
runAt: "server",
name: "eyedropper_server_hide",
hidden: true,
exec: function (args, {environment}) {
exec: function(args, {environment}) {
let eyeDropper = windowEyeDroppers.get(environment.window);
if (eyeDropper) {
eyeDropper.hide();

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

@ -61,7 +61,7 @@ InspectorSearch.prototype = {
return this.inspector.walker;
},
destroy: function () {
destroy: function() {
this.searchBox.removeEventListener("keydown", this._onKeyDown, true);
this.searchBox.removeEventListener("input", this._onInput, true);
this.searchClearButton.removeEventListener("click", this._onClearSearch);
@ -70,7 +70,7 @@ InspectorSearch.prototype = {
this.autocompleter.destroy();
},
_onSearch: function (reverse = false) {
_onSearch: function(reverse = false) {
this.doFullTextSearch(this.searchBox.value, reverse)
.catch(console.error);
},
@ -106,7 +106,7 @@ InspectorSearch.prototype = {
}
}),
_onInput: function () {
_onInput: function() {
if (this.searchBox.value.length === 0) {
this.searchClearButton.hidden = true;
this._onSearch();
@ -115,7 +115,7 @@ InspectorSearch.prototype = {
}
},
_onKeyDown: function (event) {
_onKeyDown: function(event) {
if (event.keyCode === KeyCodes.DOM_VK_RETURN) {
this._onSearch(event.shiftKey);
}
@ -128,7 +128,7 @@ InspectorSearch.prototype = {
}
},
_onClearSearch: function () {
_onClearSearch: function() {
this.searchBox.classList.remove("devtools-style-searchbox-no-match");
this.searchBox.value = "";
this.searchClearButton.hidden = true;
@ -311,7 +311,7 @@ SelectorAutocompleter.prototype = {
/**
* Removes event listeners and cleans up references.
*/
destroy: function () {
destroy: function() {
this.searchBox.removeEventListener("input", this.showSuggestions, true);
this.searchBox.removeEventListener("keypress",
this._onSearchKeypress, true);
@ -325,7 +325,7 @@ SelectorAutocompleter.prototype = {
/**
* Handles keypresses inside the input box.
*/
_onSearchKeypress: function (event) {
_onSearchKeypress: function(event) {
let popup = this.searchPopup;
switch (event.keyCode) {
case KeyCodes.DOM_VK_RETURN:
@ -387,7 +387,7 @@ SelectorAutocompleter.prototype = {
/**
* Handles click events from the autocomplete popup.
*/
_onSearchPopupClick: function (event) {
_onSearchPopupClick: function(event) {
let selectedItem = this.searchPopup.selectedItem;
if (selectedItem) {
this.searchBox.value = selectedItem.label;
@ -402,7 +402,7 @@ SelectorAutocompleter.prototype = {
* Reset previous search results on markup-mutations to make sure we search
* again after nodes have been added/removed/changed.
*/
_onMarkupMutation: function () {
_onMarkupMutation: function() {
this._searchResults = null;
this._lastSearched = null;
},
@ -413,7 +413,7 @@ SelectorAutocompleter.prototype = {
* @return {Promise} promise that will resolve when the autocomplete popup is fully
* displayed or hidden.
*/
_showPopup: function (list, firstPart, popupState) {
_showPopup: function(list, firstPart, popupState) {
let total = 0;
let query = this.searchBox.value;
let items = [];
@ -472,7 +472,7 @@ SelectorAutocompleter.prototype = {
/**
* Hide the suggestion popup if necessary.
*/
hidePopup: function () {
hidePopup: function() {
let onPopupClosed = this.searchPopup.once("popup-closed");
this.searchPopup.hidePopup();
return onPopupClosed;
@ -482,7 +482,7 @@ SelectorAutocompleter.prototype = {
* Suggests classes,ids and tags based on the user input as user types in the
* searchbox.
*/
showSuggestions: function () {
showSuggestions: function() {
let query = this.searchBox.value;
let state = this.state;
let firstPart = "";

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

@ -39,7 +39,7 @@ loader.lazyRequireGetter(this, "clipboardHelper", "devtools/shared/platform/clip
const {LocalizationHelper, localizeMarkup} = require("devtools/shared/l10n");
const INSPECTOR_L10N =
new LocalizationHelper("devtools/client/locales/inspector.properties");
loader.lazyGetter(this, "TOOLBOX_L10N", function () {
loader.lazyGetter(this, "TOOLBOX_L10N", function() {
return new LocalizationHelper("devtools/client/locales/toolbox.properties");
});
@ -216,13 +216,13 @@ Inspector.prototype = {
* This is useful to silence useless errors that happen when the inspector is closed
* while still initializing (and making protocol requests).
*/
_handleRejectionIfNotDestroyed: function (e) {
_handleRejectionIfNotDestroyed: function(e) {
if (!this._panelDestroyer) {
console.error(e);
}
},
_deferredOpen: async function (defaultSelection) {
_deferredOpen: async function(defaultSelection) {
this.breadcrumbs = new HTMLBreadcrumbs(this);
this.walker.on("new-root", this.onNewRoot);
@ -293,14 +293,14 @@ Inspector.prototype = {
return this;
},
_onBeforeNavigate: function () {
_onBeforeNavigate: function() {
this._defaultNode = null;
this.selection.setNodeFront(null);
this._destroyMarkup();
this._pendingSelection = null;
},
_getPageStyle: function () {
_getPageStyle: function() {
return this.inspector.getPageStyle().then(pageStyle => {
this.pageStyle = pageStyle;
}, this._handleRejectionIfNotDestroyed);
@ -309,7 +309,7 @@ Inspector.prototype = {
/**
* Return a promise that will resolve to the default node for selection.
*/
_getDefaultNodeForSelection: function () {
_getDefaultNodeForSelection: function() {
if (this._defaultNode) {
return this._defaultNode;
}
@ -377,7 +377,7 @@ Inspector.prototype = {
/**
* Hooks the searchbar to show result and auto completion suggestions.
*/
setupSearchBox: function () {
setupSearchBox: function() {
this.searchBox = this.panelDoc.getElementById("inspector-searchbox");
this.searchClearButton = this.panelDoc.getElementById("inspector-searchinput-clear");
this.searchResultsLabel = this.panelDoc.getElementById("inspector-searchlabel");
@ -405,7 +405,7 @@ Inspector.prototype = {
return this.search.autocompleter;
},
_updateSearchResultsLabel: function (event, result) {
_updateSearchResultsLabel: function(event, result) {
let str = "";
if (event !== "search-cleared") {
if (result) {
@ -449,7 +449,7 @@ Inspector.prototype = {
*
* @return {Boolean} true if the inspector should be in landscape mode.
*/
useLandscapeMode: function () {
useLandscapeMode: function() {
let { clientWidth } = this.panelDoc.getElementById("inspector-splitter-box");
return clientWidth > PORTRAIT_MODE_WIDTH;
},
@ -458,7 +458,7 @@ Inspector.prototype = {
* Build Splitter located between the main and side area of
* the Inspector panel.
*/
setupSplitter: function () {
setupSplitter: function() {
let SplitBox = this.React.createFactory(this.browserRequire(
"devtools/client/shared/components/splitter/SplitBox"));
let { width, height, splitSidebarWidth } = this.getSidebarSize();
@ -503,7 +503,7 @@ Inspector.prototype = {
/**
* Splitter clean up.
*/
teardownSplitter: function () {
teardownSplitter: function() {
this.panelWin.removeEventListener("resize", this.onPanelWindowResize, true);
this.sidebar.off("show", this.onSidebarShown);
@ -515,13 +515,13 @@ Inspector.prototype = {
* If Toolbox width is less than 600 px, the splitter changes its mode
* to `horizontal` to support portrait view.
*/
onPanelWindowResize: function () {
onPanelWindowResize: function() {
this.splitBox.setState({
vert: this.useLandscapeMode(),
});
},
getSidebarSize: function () {
getSidebarSize: function() {
let width;
let height;
let splitSidebarWidth;
@ -546,7 +546,7 @@ Inspector.prototype = {
return { width, height, splitSidebarWidth };
},
onSidebarHidden: function () {
onSidebarHidden: function() {
// Store the current splitter size to preferences.
let state = this.splitBox.state;
Services.prefs.setIntPref("devtools.toolsidebar-width.inspector", state.width);
@ -555,11 +555,11 @@ Inspector.prototype = {
this.sidebarSplitBox.state.width);
},
onSidebarResized: function (width, height) {
onSidebarResized: function(width, height) {
this.toolbox.emit("inspector-sidebar-resized", { width, height });
},
onSidebarSelect: function (event, toolId) {
onSidebarSelect: function(event, toolId) {
// Save the currently selected sidebar panel
Services.prefs.setCharPref("devtools.inspector.activeSidebar", toolId);
@ -570,13 +570,13 @@ Inspector.prototype = {
this.toolbox.emit("inspector-sidebar-select", toolId);
},
onSidebarShown: function () {
onSidebarShown: function() {
let { width, height, splitSidebarWidth } = this.getSidebarSize();
this.splitBox.setState({ width, height });
this.sidebarSplitBox.setState({ width: splitSidebarWidth });
},
onSidebarToggle: function () {
onSidebarToggle: function() {
Services.prefs.setBoolPref(SPLIT_RULE_VIEW_PREF, !this.isSplitRuleViewEnabled);
},
@ -652,7 +652,7 @@ Inspector.prototype = {
/**
* Lazily get and create panel instances displayed in the sidebar
*/
getPanel: function (id) {
getPanel: function(id) {
if (this._panels.has(id)) {
return this._panels.get(id);
}
@ -887,7 +887,7 @@ Inspector.prototype = {
* @param {String} options.title
* The tab title
*/
addExtensionSidebar: function (id, {title}) {
addExtensionSidebar: function(id, {title}) {
if (this._panels.has(id)) {
throw new Error(`Cannot create an extension sidebar for the existent id: ${id}`);
}
@ -914,7 +914,7 @@ Inspector.prototype = {
* @param {String} id
* The id of the sidebar tab to destroy.
*/
removeExtensionSidebar: function (id) {
removeExtensionSidebar: function(id) {
if (!this._panels.has(id)) {
throw new Error(`Unable to find a sidebar panel with id "${id}"`);
}
@ -940,7 +940,7 @@ Inspector.prototype = {
* @param {React.Component} panel component. See `InspectorPanelTab` as an example.
* @param {boolean} selected true if the panel should be selected
*/
addSidebarTab: function (id, title, panel, selected) {
addSidebarTab: function(id, title, panel, selected) {
this.sidebar.addTab(id, title, panel, selected);
},
@ -1021,7 +1021,7 @@ Inspector.prototype = {
}
}),
teardownToolbar: function () {
teardownToolbar: function() {
if (this.addNodeButton) {
this.addNodeButton.removeEventListener("click", this.addNode);
this.addNodeButton = null;
@ -1036,7 +1036,7 @@ Inspector.prototype = {
/**
* Reset the inspector on new root mutation.
*/
onNewRoot: function () {
onNewRoot: function() {
// Record new-root timing for telemetry
this._newRootStart = this.panelWin.performance.now();
@ -1140,7 +1140,7 @@ Inspector.prototype = {
* Can a new HTML element be inserted into the currently selected element?
* @return {Boolean}
*/
canAddHTMLChild: function () {
canAddHTMLChild: function() {
let selection = this.selection;
// Don't allow to insert an element into these elements. This should only
@ -1158,7 +1158,7 @@ Inspector.prototype = {
/**
* When a new node is selected.
*/
onNewSelection: function (event, value, reason) {
onNewSelection: function(event, value, reason) {
if (reason === "selection-destroy") {
return;
}
@ -1201,7 +1201,7 @@ Inspector.prototype = {
* invoked when the tool is done updating with the node
* that the tool is viewing.
*/
updating: function (name) {
updating: function(name) {
if (this._updateProgress && this._updateProgress.node != this.selection.nodeFront) {
this.cancelUpdate();
}
@ -1212,7 +1212,7 @@ Inspector.prototype = {
this._updateProgress = {
node: this.selection.nodeFront,
outstanding: new Set(),
checkDone: function () {
checkDone: function() {
if (this !== self._updateProgress) {
return;
}
@ -1233,7 +1233,7 @@ Inspector.prototype = {
}
let progress = this._updateProgress;
let done = function () {
let done = function() {
progress.outstanding.delete(done);
progress.checkDone();
};
@ -1244,7 +1244,7 @@ Inspector.prototype = {
/**
* Cancel notification of inspector updates.
*/
cancelUpdate: function () {
cancelUpdate: function() {
this._updateProgress = null;
},
@ -1253,7 +1253,7 @@ Inspector.prototype = {
* parent is found (may happen when deleting an iframe inside which the
* node was selected).
*/
onDetached: function (event, parentNode) {
onDetached: function(event, parentNode) {
this.breadcrumbs.cutAfter(this.breadcrumbs.indexOf(parentNode));
this.selection.setNodeFront(parentNode ? parentNode : this._defaultNode, "detached");
},
@ -1261,7 +1261,7 @@ Inspector.prototype = {
/**
* Destroy the inspector.
*/
destroy: function () {
destroy: function() {
if (this._panelDestroyer) {
return this._panelDestroyer;
}
@ -1346,7 +1346,7 @@ Inspector.prototype = {
* Returns the clipboard content if it is appropriate for pasting
* into the current node's outer HTML, otherwise returns null.
*/
_getClipboardContentForPaste: function () {
_getClipboardContentForPaste: function() {
let content = clipboardHelper.getText();
if (content && content.trim().length > 0) {
return content;
@ -1354,7 +1354,7 @@ Inspector.prototype = {
return null;
},
_onContextMenu: function (e) {
_onContextMenu: function(e) {
if (e.originalTarget.closest("input[type=text]") ||
e.originalTarget.closest("input:not([type])") ||
e.originalTarget.closest("textarea")) {
@ -1371,7 +1371,7 @@ Inspector.prototype = {
});
},
_openMenu: function ({ target, screenX = 0, screenY = 0 } = { }) {
_openMenu: function({ target, screenX = 0, screenY = 0 } = { }) {
let markupContainer = this.markup.getContainer(this.selection.nodeFront);
this.contextMenuTarget = target;
@ -1526,7 +1526,7 @@ Inspector.prototype = {
return menu;
},
_getCopySubmenu: function (markupContainer, isSelectionElement) {
_getCopySubmenu: function(markupContainer, isSelectionElement) {
let copySubmenu = new Menu();
copySubmenu.append(new MenuItem({
id: "node-menu-copyinner",
@ -1580,7 +1580,7 @@ Inspector.prototype = {
return copySubmenu;
},
_getPasteSubmenu: function (isEditableElement) {
_getPasteSubmenu: function(isEditableElement) {
let isPasteable = isEditableElement && this._getClipboardContentForPaste();
let disableAdjacentPaste = !isPasteable ||
!this.canPasteInnerOrAdjacentHTML || this.selection.isRoot() ||
@ -1640,7 +1640,7 @@ Inspector.prototype = {
return pasteSubmenu;
},
_getAttributesSubmenu: function (isEditableElement) {
_getAttributesSubmenu: function(isEditableElement) {
let attributesSubmenu = new Menu();
let nodeInfo = this.nodeMenuTriggerInfo;
let isAttributeClicked = isEditableElement && nodeInfo &&
@ -1687,7 +1687,7 @@ Inspector.prototype = {
*
* @return {Array} list of visible menu items related to links.
*/
_getNodeLinkMenuItems: function () {
_getNodeLinkMenuItems: function() {
let linkFollow = new MenuItem({
id: "node-menu-link-follow",
visible: false,
@ -1734,7 +1734,7 @@ Inspector.prototype = {
return [linkFollow, linkCopy];
},
_initMarkup: function () {
_initMarkup: function() {
let doc = this.panelDoc;
this._markupBox = doc.getElementById("markup-box");
@ -1755,7 +1755,7 @@ Inspector.prototype = {
INSPECTOR_L10N.getStr("inspector.panelLabel.markupView"));
},
_onMarkupFrameLoad: function () {
_onMarkupFrameLoad: function() {
this._markupFrame.removeEventListener("load", this._onMarkupFrameLoad, true);
this._markupFrame.contentWindow.focus();
@ -1766,7 +1766,7 @@ Inspector.prototype = {
this.emit("markuploaded");
},
_destroyMarkup: function () {
_destroyMarkup: function() {
let destroyPromise;
if (this._markupFrame) {
@ -1791,25 +1791,25 @@ Inspector.prototype = {
return destroyPromise;
},
onEyeDropperButtonClicked: function () {
onEyeDropperButtonClicked: function() {
this.eyeDropperButton.classList.contains("checked")
? this.hideEyeDropper()
: this.showEyeDropper();
},
startEyeDropperListeners: function () {
startEyeDropperListeners: function() {
this.inspector.once("color-pick-canceled", this.onEyeDropperDone);
this.inspector.once("color-picked", this.onEyeDropperDone);
this.walker.once("new-root", this.onEyeDropperDone);
},
stopEyeDropperListeners: function () {
stopEyeDropperListeners: function() {
this.inspector.off("color-pick-canceled", this.onEyeDropperDone);
this.inspector.off("color-picked", this.onEyeDropperDone);
this.walker.off("new-root", this.onEyeDropperDone);
},
onEyeDropperDone: function () {
onEyeDropperDone: function() {
this.eyeDropperButton.classList.remove("checked");
this.stopEyeDropperListeners();
},
@ -1818,7 +1818,7 @@ Inspector.prototype = {
* Show the eyedropper on the page.
* @return {Promise} resolves when the eyedropper is visible.
*/
showEyeDropper: function () {
showEyeDropper: function() {
// The eyedropper button doesn't exist, most probably because the actor doesn't
// support the pickColorFromPage, or because the page isn't HTML.
if (!this.eyeDropperButton) {
@ -1836,7 +1836,7 @@ Inspector.prototype = {
* Hide the eyedropper.
* @return {Promise} resolves when the eyedropper is hidden.
*/
hideEyeDropper: function () {
hideEyeDropper: function() {
// The eyedropper button doesn't exist, most probably because the page isn't HTML.
if (!this.eyeDropperButton) {
return null;
@ -1871,7 +1871,7 @@ Inspector.prototype = {
/**
* Toggle a pseudo class.
*/
togglePseudoClass: function (pseudo) {
togglePseudoClass: function(pseudo) {
if (this.selection.isElementNode()) {
let node = this.selection.nodeFront;
if (node.hasPseudoClassLock(pseudo)) {
@ -1887,7 +1887,7 @@ Inspector.prototype = {
/**
* Show DOM properties
*/
showDOMProperties: function () {
showDOMProperties: function() {
this._toolbox.openSplitConsole().then(() => {
let panel = this._toolbox.getPanel("webconsole");
let jsterm = panel.hud.jsterm;
@ -1904,7 +1904,7 @@ Inspector.prototype = {
* temp variable on the content window. Also opens the split console and
* autofills it with the temp variable.
*/
useInConsole: function () {
useInConsole: function() {
this._toolbox.openSplitConsole().then(() => {
let panel = this._toolbox.getPanel("webconsole");
let jsterm = panel.hud.jsterm;
@ -1930,7 +1930,7 @@ Inspector.prototype = {
/**
* Edit the outerHTML of the selected Node.
*/
editHTML: function () {
editHTML: function() {
if (!this.selection.isNode()) {
return;
}
@ -1942,7 +1942,7 @@ Inspector.prototype = {
/**
* Paste the contents of the clipboard into the selected Node's outer HTML.
*/
pasteOuterHTML: function () {
pasteOuterHTML: function() {
let content = this._getClipboardContentForPaste();
if (!content) {
return promise.reject("No clipboard content for paste");
@ -1957,7 +1957,7 @@ Inspector.prototype = {
/**
* Paste the contents of the clipboard into the selected Node's inner HTML.
*/
pasteInnerHTML: function () {
pasteInnerHTML: function() {
let content = this._getClipboardContentForPaste();
if (!content) {
return promise.reject("No clipboard content for paste");
@ -1975,7 +1975,7 @@ Inspector.prototype = {
* The position as specified for Element.insertAdjacentHTML
* (i.e. "beforeBegin", "afterBegin", "beforeEnd", "afterEnd").
*/
pasteAdjacentHTML: function (position) {
pasteAdjacentHTML: function(position) {
let content = this._getClipboardContentForPaste();
if (!content) {
return promise.reject("No clipboard content for paste");
@ -1988,7 +1988,7 @@ Inspector.prototype = {
/**
* Copy the innerHTML of the selected Node to the clipboard.
*/
copyInnerHTML: function () {
copyInnerHTML: function() {
if (!this.selection.isNode()) {
return;
}
@ -1998,7 +1998,7 @@ Inspector.prototype = {
/**
* Copy the outerHTML of the selected Node to the clipboard.
*/
copyOuterHTML: function () {
copyOuterHTML: function() {
if (!this.selection.isNode()) {
return;
}
@ -2022,7 +2022,7 @@ Inspector.prototype = {
/**
* Copy the data-uri for the currently selected image in the clipboard.
*/
copyImageDataUri: function () {
copyImageDataUri: function() {
let container = this.markup.getContainer(this.selection.nodeFront);
if (container && container.isPreviewable()) {
container.copyImageDataUri();
@ -2037,7 +2037,7 @@ Inspector.prototype = {
* @return {Promise} promise resolving (with no argument) when the
* string is sent to the clipboard
*/
_copyLongString: function (longStringActorPromise) {
_copyLongString: function(longStringActorPromise) {
return this._getLongString(longStringActorPromise).then(string => {
clipboardHelper.copyString(string);
}).catch(console.error);
@ -2049,7 +2049,7 @@ Inspector.prototype = {
* promise expected to resolve a LongStringActor instance
* @return {Promise} promise resolving with the retrieved string as argument
*/
_getLongString: function (longStringActorPromise) {
_getLongString: function(longStringActorPromise) {
return longStringActorPromise.then(longStringActor => {
return longStringActor.string().then(string => {
longStringActor.release().catch(console.error);
@ -2061,7 +2061,7 @@ Inspector.prototype = {
/**
* Copy a unique selector of the selected Node to the clipboard.
*/
copyUniqueSelector: function () {
copyUniqueSelector: function() {
if (!this.selection.isNode()) {
return;
}
@ -2075,7 +2075,7 @@ Inspector.prototype = {
/**
* Copy the full CSS Path of the selected Node to the clipboard.
*/
copyCssPath: function () {
copyCssPath: function() {
if (!this.selection.isNode()) {
return;
}
@ -2089,7 +2089,7 @@ Inspector.prototype = {
/**
* Copy the XPath of the selected Node to the clipboard.
*/
copyXPath: function () {
copyXPath: function() {
if (!this.selection.isNode()) {
return;
}
@ -2124,7 +2124,7 @@ Inspector.prototype = {
/**
* Scroll the node into view.
*/
scrollNodeIntoView: function () {
scrollNodeIntoView: function() {
if (!this.selection.isNode()) {
return;
}
@ -2135,7 +2135,7 @@ Inspector.prototype = {
/**
* Duplicate the selected node
*/
duplicateNode: function () {
duplicateNode: function() {
let selection = this.selection;
if (!selection.isElementNode() ||
selection.isRoot() ||
@ -2149,7 +2149,7 @@ Inspector.prototype = {
/**
* Delete the selected node.
*/
deleteNode: function () {
deleteNode: function() {
if (!this.selection.isNode() ||
this.selection.isRoot()) {
return;
@ -2169,7 +2169,7 @@ Inspector.prototype = {
* Add attribute to node.
* Used for node context menu and shouldn't be called directly.
*/
onAddAttribute: function () {
onAddAttribute: function() {
let container = this.markup.getContainer(this.selection.nodeFront);
container.addAttribute();
},
@ -2178,7 +2178,7 @@ Inspector.prototype = {
* Copy attribute value for node.
* Used for node context menu and shouldn't be called directly.
*/
onCopyAttributeValue: function () {
onCopyAttributeValue: function() {
clipboardHelper.copyString(this.nodeMenuTriggerInfo.value);
},
@ -2186,7 +2186,7 @@ Inspector.prototype = {
* Edit attribute for node.
* Used for node context menu and shouldn't be called directly.
*/
onEditAttribute: function () {
onEditAttribute: function() {
let container = this.markup.getContainer(this.selection.nodeFront);
container.editAttribute(this.nodeMenuTriggerInfo.name);
},
@ -2195,16 +2195,16 @@ Inspector.prototype = {
* Remove attribute from node.
* Used for node context menu and shouldn't be called directly.
*/
onRemoveAttribute: function () {
onRemoveAttribute: function() {
let container = this.markup.getContainer(this.selection.nodeFront);
container.removeAttribute(this.nodeMenuTriggerInfo.name);
},
expandNode: function () {
expandNode: function() {
this.markup.expandAll(this.selection.nodeFront);
},
collapseAll: function () {
collapseAll: function() {
this.markup.collapseAll(this.selection.nodeFront);
},
@ -2212,7 +2212,7 @@ Inspector.prototype = {
* This method is here for the benefit of the node-menu-link-follow menu item
* in the inspector contextual-menu.
*/
onFollowLink: function () {
onFollowLink: function() {
let type = this.contextMenuTarget.dataset.type;
let link = this.contextMenuTarget.dataset.link;
@ -2224,7 +2224,7 @@ Inspector.prototype = {
* attempt to follow that link (which may result in opening a new tab, the
* style editor or debugger).
*/
followAttributeLink: function (type, link) {
followAttributeLink: function(type, link) {
if (!type || !link) {
return;
}
@ -2261,7 +2261,7 @@ Inspector.prototype = {
* This method is here for the benefit of the node-menu-link-copy menu item
* in the inspector contextual-menu.
*/
onCopyLink: function () {
onCopyLink: function() {
let link = this.contextMenuTarget.dataset.link;
this.copyAttributeLink(link);
@ -2270,7 +2270,7 @@ Inspector.prototype = {
/**
* This method is here for the benefit of copying links.
*/
copyAttributeLink: function (link) {
copyAttributeLink: function(link) {
this.inspector.resolveRelativeURL(link, this.selection.nodeFront).then(url => {
clipboardHelper.copyString(url);
}, console.error);
@ -2355,7 +2355,7 @@ const buildFakeToolbox = Task.async(function* (
const { Selection } = require("devtools/client/framework/selection");
const { getHighlighterUtils } = require("devtools/client/framework/toolbox-highlighter-utils");
let notImplemented = function () {
let notImplemented = function() {
throw new Error("Not implemented in a tab");
};
let fakeToolbox = {

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

@ -153,13 +153,13 @@ MarkupView.prototype = {
* This is useful to silence useless errors that happen when the markup view is
* destroyed while still initializing (and making protocol requests).
*/
_handleRejectionIfNotDestroyed: function (e) {
_handleRejectionIfNotDestroyed: function(e) {
if (!this._destroyer) {
console.error(e);
}
},
_initTooltips: function () {
_initTooltips: function() {
// The tooltips will be attached to the toolbox document.
this.eventDetailsTooltip = new HTMLTooltip(this.toolbox.doc, {
type: "arrow",
@ -172,16 +172,16 @@ MarkupView.prototype = {
this._enableImagePreviewTooltip();
},
_enableImagePreviewTooltip: function () {
_enableImagePreviewTooltip: function() {
this.imagePreviewTooltip.startTogglingOnHover(this._elt,
this._isImagePreviewTarget);
},
_disableImagePreviewTooltip: function () {
_disableImagePreviewTooltip: function() {
this.imagePreviewTooltip.stopTogglingOnHover();
},
_onToolboxPickerHover: function (event, nodeFront) {
_onToolboxPickerHover: function(event, nodeFront) {
this.showNode(nodeFront).then(() => {
this._showContainerAsHovered(nodeFront);
}, console.error);
@ -191,7 +191,7 @@ MarkupView.prototype = {
* If the element picker gets canceled, make sure and re-center the view on the
* current selected element.
*/
_onToolboxPickerCanceled: function () {
_onToolboxPickerCanceled: function() {
if (this._selectedContainer) {
scrollIntoViewIfNeeded(this._selectedContainer.editor.elt);
}
@ -200,7 +200,7 @@ MarkupView.prototype = {
isDragging: false,
_draggedContainer: null,
_onMouseMove: function (event) {
_onMouseMove: function(event) {
let target = event.target;
if (this._draggedContainer) {
@ -235,7 +235,7 @@ MarkupView.prototype = {
* If focus is moved outside of the markup view document and there is a
* selected container, make its contents not focusable by a keyboard.
*/
_onBlur: function (event) {
_onBlur: function(event) {
if (!this._selectedContainer) {
return;
}
@ -255,7 +255,7 @@ MarkupView.prototype = {
* Auto-scrolls the view to reveal nodes below the fold to drop the dragged
* node in.
*/
_autoScroll: function (event) {
_autoScroll: function(event) {
let docEl = this.doc.documentElement;
if (this._autoScrollAnimationFrame) {
@ -304,7 +304,7 @@ MarkupView.prototype = {
/**
* Run a loop on the requestAnimationFrame.
*/
_runUpdateLoop: function (update) {
_runUpdateLoop: function(update) {
let loop = () => {
update();
this._autoScrollAnimationFrame = this.win.requestAnimationFrame(loop);
@ -312,7 +312,7 @@ MarkupView.prototype = {
loop();
},
_onMouseClick: function (event) {
_onMouseClick: function(event) {
// From the target passed here, let's find the parent MarkupContainer
// and ask it if the tooltip should be shown
let parentNode = event.target;
@ -333,7 +333,7 @@ MarkupView.prototype = {
}
},
_onMouseUp: function (event) {
_onMouseUp: function(event) {
if (this._draggedContainer) {
this._draggedContainer.onMouseUp(event);
}
@ -345,7 +345,7 @@ MarkupView.prototype = {
}
},
_onCollapseAttributesPrefChange: function () {
_onCollapseAttributesPrefChange: function() {
this.collapseAttributes =
Services.prefs.getBoolPref(ATTR_COLLAPSE_ENABLED_PREF);
this.collapseAttributeLength =
@ -353,7 +353,7 @@ MarkupView.prototype = {
this.update();
},
cancelDragging: function () {
cancelDragging: function() {
if (!this.isDragging) {
return;
}
@ -380,7 +380,7 @@ MarkupView.prototype = {
* @param {NodeFront} nodeFront
* The node to show as hovered
*/
_showContainerAsHovered: function (nodeFront) {
_showContainerAsHovered: function(nodeFront) {
if (this._hoveredNode === nodeFront) {
return;
}
@ -396,7 +396,7 @@ MarkupView.prototype = {
this.emit("showcontainerhovered");
},
_onMouseOut: function (event) {
_onMouseOut: function(event) {
// Emulate mouseleave by skipping any relatedTarget inside the markup-view.
if (this._elt.contains(event.relatedTarget)) {
return;
@ -427,7 +427,7 @@ MarkupView.prototype = {
* shown, taking into account that there could already be highlighter
* requests queued up
*/
_showBoxModel: function (nodeFront) {
_showBoxModel: function(nodeFront) {
return this.toolbox.highlighterUtils.highlightNodeFront(nodeFront)
.catch(this._handleRejectionIfNotDestroyed);
},
@ -441,14 +441,14 @@ MarkupView.prototype = {
* hidden, taking into account that there could already be highlighter
* requests queued up
*/
_hideBoxModel: function (forceHide) {
_hideBoxModel: function(forceHide) {
return this.toolbox.highlighterUtils.unhighlight(forceHide)
.catch(this._handleRejectionIfNotDestroyed);
},
_briefBoxModelTimer: null,
_clearBriefBoxModelTimer: function () {
_clearBriefBoxModelTimer: function() {
if (this._briefBoxModelTimer) {
clearTimeout(this._briefBoxModelTimer);
this._briefBoxModelPromise.resolve();
@ -457,7 +457,7 @@ MarkupView.prototype = {
}
},
_brieflyShowBoxModel: function (nodeFront) {
_brieflyShowBoxModel: function(nodeFront) {
this._clearBriefBoxModelTimer();
let onShown = this._showBoxModel(nodeFront);
@ -477,11 +477,11 @@ MarkupView.prototype = {
* Get the MarkupContainer object for a given node, or undefined if
* none exists.
*/
getContainer: function (node) {
getContainer: function(node) {
return this._containers.get(node);
},
update: function () {
update: function() {
let updateChildren = (node) => {
this.getContainer(node).update();
for (let child of node.treeChildren()) {
@ -551,7 +551,7 @@ MarkupView.prototype = {
* already being hovered over, since in that case it will already be
* highlighted.
*/
_shouldNewSelectionBeHighlighted: function () {
_shouldNewSelectionBeHighlighted: function() {
let reason = this.inspector.selection.reason;
let unwantedReasons = [
"inspector-open",
@ -568,7 +568,7 @@ MarkupView.prototype = {
* Highlights the node if needed, and make sure it is shown and selected in
* the view.
*/
_onNewSelection: function () {
_onNewSelection: function() {
let selection = this.inspector.selection;
if (this.htmlEditor) {
@ -613,7 +613,7 @@ MarkupView.prototype = {
* Maybe make selected the current node selection's MarkupContainer depending
* on why the current node got selected.
*/
maybeNavigateToNewSelection: function () {
maybeNavigateToNewSelection: function() {
let {reason, nodeFront} = this.inspector.selection;
// The list of reasons that should lead to navigating to the node.
@ -644,11 +644,11 @@ MarkupView.prototype = {
* Create a TreeWalker to find the next/previous
* node for selection.
*/
_selectionWalker: function (start) {
_selectionWalker: function(start) {
let walker = this.doc.createTreeWalker(
start || this._elt,
nodeFilterConstants.SHOW_ELEMENT,
function (element) {
function(element) {
if (element.container &&
element.container.elt === element &&
element.container.visible) {
@ -661,7 +661,7 @@ MarkupView.prototype = {
return walker;
},
_onCopy: function (evt) {
_onCopy: function(evt) {
// Ignore copy events from editors
if (this._isInputOrTextarea(evt.target)) {
return;
@ -678,7 +678,7 @@ MarkupView.prototype = {
/**
* Register all key shortcuts.
*/
_initShortcuts: function () {
_initShortcuts: function() {
let shortcuts = new KeyShortcuts({
window: this.win,
});
@ -837,7 +837,7 @@ MarkupView.prototype = {
/**
* Check if a node is an input or textarea
*/
_isInputOrTextarea: function (element) {
_isInputOrTextarea: function(element) {
let name = element.tagName.toLowerCase();
return name === "input" || name === "textarea";
},
@ -850,7 +850,7 @@ MarkupView.prototype = {
* If set to true and if we're deleting the node, focus the previous
* sibling after deletion, otherwise the next one.
*/
deleteNodeOrAttribute: function (moveBackward) {
deleteNodeOrAttribute: function(moveBackward) {
let focusedAttribute = this.doc.activeElement
? this.doc.activeElement.closest(".attreditor")
: null;
@ -872,7 +872,7 @@ MarkupView.prototype = {
* @param {Boolean} moveBackward
* If set to true, focus the previous sibling, otherwise the next one.
*/
deleteNode: function (node, moveBackward) {
deleteNode: function(node, moveBackward) {
if (!this.inspector.isDeletable(node)) {
return;
}
@ -923,7 +923,7 @@ MarkupView.prototype = {
/**
* If an editable item is focused, select its container.
*/
_onFocus: function (event) {
_onFocus: function(event) {
let parent = event.target;
while (!parent.container) {
parent = parent.parentNode;
@ -940,7 +940,7 @@ MarkupView.prototype = {
* @param {MarkupContainer} container
* The container we're navigating to.
*/
navigate: function (container) {
navigate: function(container) {
if (!container) {
return;
}
@ -958,7 +958,7 @@ MarkupView.prototype = {
* Whether the newly imported node should be flashed
* @return {MarkupContainer} The MarkupContainer object for this element.
*/
importNode: function (node, flashNode) {
importNode: function(node, flashNode) {
if (!node) {
return null;
}
@ -999,7 +999,7 @@ MarkupView.prototype = {
/**
* Mutation observer used for included nodes.
*/
_mutationObserver: function (mutations) {
_mutationObserver: function(mutations) {
for (let mutation of mutations) {
let type = mutation.type;
let target = mutation.target;
@ -1061,7 +1061,7 @@ MarkupView.prototype = {
* @param {Array} nodes
* An array of nodeFronts
*/
_onDisplayChange: function (nodes) {
_onDisplayChange: function(nodes) {
for (let node of nodes) {
let container = this.getContainer(node);
if (container) {
@ -1074,7 +1074,7 @@ MarkupView.prototype = {
* Given a list of mutations returned by the mutation observer, flash the
* corresponding containers to attract attention.
*/
_flashMutatedNodes: function (mutations) {
_flashMutatedNodes: function(mutations) {
let addedOrEditedContainers = new Set();
let removedContainers = new Set();
@ -1125,7 +1125,7 @@ MarkupView.prototype = {
* Make sure the given node's parents are expanded and the
* node is scrolled on to screen.
*/
showNode: function (node, centered = true) {
showNode: function(node, centered = true) {
let parent = node;
this.importNode(node);
@ -1148,7 +1148,7 @@ MarkupView.prototype = {
/**
* Expand the container's children.
*/
_expandContainer: function (container) {
_expandContainer: function(container) {
return this._updateChildren(container, {expand: true}).then(() => {
if (this._destroyer) {
// Could not expand the node, the markup-view was destroyed in the meantime. Just
@ -1162,7 +1162,7 @@ MarkupView.prototype = {
/**
* Expand the node's children.
*/
expandNode: function (node) {
expandNode: function(node) {
let container = this.getContainer(node);
return this._expandContainer(container);
},
@ -1173,7 +1173,7 @@ MarkupView.prototype = {
* @param {MarkupContainer} container
* The container to expand.
*/
_expandAll: function (container) {
_expandAll: function(container) {
return this._expandContainer(container).then(() => {
let child = container.children.firstChild;
let promises = [];
@ -1191,7 +1191,7 @@ MarkupView.prototype = {
* @param {DOMNode} node
* The node to expand, or null to start from the top.
*/
expandAll: function (node) {
expandAll: function(node) {
node = node || this._rootNode;
return this._expandAll(this.getContainer(node));
},
@ -1199,12 +1199,12 @@ MarkupView.prototype = {
/**
* Collapse the node's children.
*/
collapseNode: function (node) {
collapseNode: function(node) {
let container = this.getContainer(node);
container.setExpanded(false);
},
_collapseAll: function (container) {
_collapseAll: function(container) {
container.setExpanded(false);
let children = container.getChildContainers() || [];
children.forEach(child => this._collapseAll(child));
@ -1213,7 +1213,7 @@ MarkupView.prototype = {
/**
* Collapse the entire tree beneath a node.
*/
collapseAll: function (node) {
collapseAll: function(node) {
this._collapseAll(this.getContainer(node));
},
@ -1227,7 +1227,7 @@ MarkupView.prototype = {
* otherwise the innerHTML.
* @return {Promise} that will be resolved with the outerHTML / innerHTML.
*/
_getNodeHTML: function (node, isOuter) {
_getNodeHTML: function(node, isOuter) {
let walkerPromise = null;
if (isOuter) {
@ -1251,7 +1251,7 @@ MarkupView.prototype = {
* The NodeFront to get the outerHTML for.
* @return {Promise} that will be resolved with the outerHTML.
*/
getNodeOuterHTML: function (node) {
getNodeOuterHTML: function(node) {
return this._getNodeHTML(node, true);
},
@ -1262,7 +1262,7 @@ MarkupView.prototype = {
* The NodeFront to get the innerHTML for.
* @return {Promise} that will be resolved with the innerHTML.
*/
getNodeInnerHTML: function (node) {
getNodeInnerHTML: function(node) {
return this._getNodeHTML(node);
},
@ -1272,7 +1272,7 @@ MarkupView.prototype = {
* This is useful when changing the outerHTML or the tag name so that the
* newly inserted node gets selected instead of the one that just got removed.
*/
reselectOnRemoved: function (removedNode, reason) {
reselectOnRemoved: function(removedNode, reason) {
// Only allow one removed node reselection at a time, so that when there are
// more than 1 request in parallel, the last one wins.
this.cancelReselectOnRemoved();
@ -1326,7 +1326,7 @@ MarkupView.prototype = {
* reselect the corresponding node when that happens.
* Useful when the outerHTML/tagname edition failed.
*/
cancelReselectOnRemoved: function () {
cancelReselectOnRemoved: function() {
if (this._removedNodeObserver) {
this.inspector.off("markupmutation", this._removedNodeObserver);
this._removedNodeObserver = null;
@ -1346,7 +1346,7 @@ MarkupView.prototype = {
* The old outerHTML that will be used if the user undoes the update.
* @return {Promise} that will resolve when the outer HTML has been updated.
*/
updateNodeOuterHTML: function (node, newValue) {
updateNodeOuterHTML: function(node, newValue) {
let container = this.getContainer(node);
if (!container) {
return promise.reject();
@ -1371,7 +1371,7 @@ MarkupView.prototype = {
* The old innerHTML that will be used if the user undoes the update.
* @return {Promise} that will resolve when the inner HTML has been updated.
*/
updateNodeInnerHTML: function (node, newValue, oldValue) {
updateNodeInnerHTML: function(node, newValue, oldValue) {
let container = this.getContainer(node);
if (!container) {
return promise.reject();
@ -1399,7 +1399,7 @@ MarkupView.prototype = {
* @return {Promise} that will resolve when the adjacent HTML has
* been inserted.
*/
insertAdjacentHTMLToNode: function (node, position, value) {
insertAdjacentHTMLToNode: function(node, position, value) {
let container = this.getContainer(node);
if (!container) {
return promise.reject();
@ -1429,7 +1429,7 @@ MarkupView.prototype = {
* @param {NodeFront} node
* The NodeFront to edit.
*/
beginEditingOuterHTML: function (node) {
beginEditingOuterHTML: function(node) {
this.getNodeOuterHTML(node).then(oldValue => {
let container = this.getContainer(node);
if (!container) {
@ -1465,7 +1465,7 @@ MarkupView.prototype = {
* @param {Boolean} applyToDescendants
* Whether all descendants should also be expanded/collapsed
*/
setNodeExpanded: function (node, expanded, applyToDescendants) {
setNodeExpanded: function(node, expanded, applyToDescendants) {
if (expanded) {
if (applyToDescendants) {
this.expandAll(node);
@ -1490,7 +1490,7 @@ MarkupView.prototype = {
* @return {Boolean} False if the node is already marked as selected, true
* otherwise.
*/
markNodeAsSelected: function (node, reason) {
markNodeAsSelected: function(node, reason) {
let container = this.getContainer(node);
if (this._selectedContainer === container) {
@ -1521,7 +1521,7 @@ MarkupView.prototype = {
* Make sure that every ancestor of the selection are updated
* and included in the list of visible children.
*/
_ensureVisible: function (node) {
_ensureVisible: function(node) {
while (node) {
let container = this.getContainer(node);
let parent = node.parentNode();
@ -1541,7 +1541,7 @@ MarkupView.prototype = {
/**
* Unmark selected node (no node selected).
*/
unmarkSelectedNode: function () {
unmarkSelectedNode: function() {
if (this._selectedContainer) {
this._selectedContainer.selected = false;
this._selectedContainer = null;
@ -1555,7 +1555,7 @@ MarkupView.prototype = {
*
* @return The node that should be made visible, if any.
*/
_checkSelectionVisible: function (container) {
_checkSelectionVisible: function(container) {
let centered = null;
let node = this.inspector.selection.nodeFront;
while (node) {
@ -1590,7 +1590,7 @@ MarkupView.prototype = {
* @return {Promise} that will be resolved when the children are ready
* (which may be immediately).
*/
_updateChildren: function (container, options) {
_updateChildren: function(container, options) {
let expand = options && options.expand;
let flash = options && options.flash;
@ -1702,7 +1702,7 @@ MarkupView.prototype = {
return updatePromise;
},
buildMoreNodesButtonMarkup: function (container) {
buildMoreNodesButtonMarkup: function(container) {
let elt = this.doc.createElement("li");
elt.classList.add("more-nodes", "devtools-class-comment");
@ -1726,7 +1726,7 @@ MarkupView.prototype = {
return elt;
},
_waitForChildren: function () {
_waitForChildren: function() {
if (!this._queuedChildUpdates) {
return promise.resolve(undefined);
}
@ -1737,7 +1737,7 @@ MarkupView.prototype = {
/**
* Return a list of the children to display for this container.
*/
_getVisibleChildren: function (container, centered) {
_getVisibleChildren: function(container, centered) {
let maxChildren = container.maxChildren || this.maxChildren;
if (maxChildren == -1) {
maxChildren = undefined;
@ -1752,7 +1752,7 @@ MarkupView.prototype = {
/**
* Tear down the markup panel.
*/
destroy: function () {
destroy: function() {
if (this._destroyer) {
return this._destroyer;
}
@ -1822,7 +1822,7 @@ MarkupView.prototype = {
* @param {DOMNode} el
* @return {DOMNode}
*/
findClosestDragDropTarget: function (el) {
findClosestDragDropTarget: function(el) {
return el.classList.contains("tag-line")
? el
: el.querySelector(".tag-line") || el.closest(".tag-line");
@ -1832,7 +1832,7 @@ MarkupView.prototype = {
* Takes an element as it's only argument and marks the element
* as the drop target
*/
indicateDropTarget: function (el) {
indicateDropTarget: function(el) {
if (this._lastDropTarget) {
this._lastDropTarget.classList.remove("drop-target");
}
@ -1851,7 +1851,7 @@ MarkupView.prototype = {
/**
* Takes an element to mark it as indicator of dragging target's initial place
*/
indicateDragTarget: function (el) {
indicateDragTarget: function(el) {
if (this._lastDragTarget) {
this._lastDragTarget.classList.remove("drag-target");
}

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

@ -29,19 +29,19 @@ var eventsSpec = generateActorSpec({
});
var EventsFormActor = ActorClassWithSpec(eventsSpec, {
initialize: function () {
initialize: function() {
Actor.prototype.initialize.apply(this, arguments);
},
attach: function () {
attach: function() {
EventEmitter.on(NodeActor, "form", this.onNodeActorForm);
},
detach: function () {
detach: function() {
EventEmitter.off(NodeActor, "form", this.onNodeActorForm);
},
onNodeActorForm: function (event) {
onNodeActorForm: function(event) {
let nodeActor = event.target;
if (nodeActor.rawNode.id == "container") {
let form = event.data;
@ -51,7 +51,7 @@ var EventsFormActor = ActorClassWithSpec(eventsSpec, {
});
var EventsFormFront = FrontClassWithSpec(eventsSpec, {
initialize: function (client, form) {
initialize: function(client, form) {
Front.prototype.initialize.apply(this, arguments);
this.actorID = form[EventsFormActor.prototype.typeName];

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

@ -14,7 +14,7 @@ const server = createTestHTTPServer();
// Register a slow image handler so we can simulate a long time between
// a reload and the load event firing.
server.registerContentType("gif", "image/gif");
server.registerPathHandler("/slow.gif", function (metadata, response) {
server.registerPathHandler("/slow.gif", function(metadata, response) {
info("Image has been requested");
response.processAsync();
setTimeout(() => {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше