Bug 1305777 - Fix ESLint issues for moved files. r=jdescottes
MozReview-Commit-ID: 6PVoLP4MFir
--- a/devtools/client/responsive.html/browser/content.js
+++ b/devtools/client/responsive.html/browser/content.js
@@ -10,51 +10,52 @@
var global = this;
// Guard against loading this frame script mutiple times
(function () {
if (global.responsiveFrameScriptLoaded) {
return;
}
- var Ci = Components.interfaces;
+ const Ci = Components.interfaces;
const gDeviceSizeWasPageSize = docShell.deviceSizeIsPageSize;
const gFloatingScrollbarsStylesheet = Services.io.newURI("chrome://devtools/skin/floating-scrollbars-responsive-design.css");
- var gRequiresFloatingScrollbars;
- var active = false;
- var resizeNotifications = false;
+ let requiresFloatingScrollbars;
+ let active = false;
+ let resizeNotifications = false;
addMessageListener("ResponsiveMode:Start", startResponsiveMode);
addMessageListener("ResponsiveMode:Stop", stopResponsiveMode);
addMessageListener("ResponsiveMode:IsActive", isActive);
function debug(msg) {
// dump(`RDM CHILD: ${msg}\n`);
}
/**
* Used by tests to verify the state of responsive mode.
*/
function isActive() {
sendAsyncMessage("ResponsiveMode:IsActive:Done", { active });
}
- function startResponsiveMode({data:data}) {
+ function startResponsiveMode({ data }) {
debug("START");
if (active) {
debug("ALREADY STARTED");
sendAsyncMessage("ResponsiveMode:Start:Done");
return;
}
addMessageListener("ResponsiveMode:RequestScreenshot", screenshot);
- let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
+ let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebProgress);
webProgress.addProgressListener(WebProgressListener, Ci.nsIWebProgress.NOTIFY_ALL);
docShell.deviceSizeIsPageSize = true;
- gRequiresFloatingScrollbars = data.requiresFloatingScrollbars;
+ requiresFloatingScrollbars = data.requiresFloatingScrollbars;
if (data.notifyOnResize) {
startOnResize();
}
// At this point, a content viewer might not be loaded for this
// docshell. makeScrollbarsFloating will be triggered by onLocationChange.
if (docShell.contentViewer) {
makeScrollbarsFloating();
@@ -99,55 +100,58 @@ var global = this;
function stopResponsiveMode() {
debug("STOP");
if (!active) {
debug("ALREADY STOPPED, ABORT");
return;
}
active = false;
removeMessageListener("ResponsiveMode:RequestScreenshot", screenshot);
- let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
+ let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebProgress);
webProgress.removeProgressListener(WebProgressListener);
docShell.deviceSizeIsPageSize = gDeviceSizeWasPageSize;
restoreScrollbars();
stopOnResize();
sendAsyncMessage("ResponsiveMode:Stop:Done");
}
function makeScrollbarsFloating() {
- if (!gRequiresFloatingScrollbars) {
+ if (!requiresFloatingScrollbars) {
return;
}
let allDocShells = [docShell];
for (let i = 0; i < docShell.childCount; i++) {
let child = docShell.getChildAt(i).QueryInterface(Ci.nsIDocShell);
allDocShells.push(child);
}
for (let d of allDocShells) {
let win = d.contentViewer.DOMDocument.defaultView;
- let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
+ let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
try {
winUtils.loadSheet(gFloatingScrollbarsStylesheet, win.AGENT_SHEET);
} catch (e) { }
}
flushStyle();
}
function restoreScrollbars() {
let allDocShells = [docShell];
for (let i = 0; i < docShell.childCount; i++) {
allDocShells.push(docShell.getChildAt(i).QueryInterface(Ci.nsIDocShell));
}
for (let d of allDocShells) {
let win = d.contentViewer.DOMDocument.defaultView;
- let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
+ let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
try {
winUtils.removeSheet(gFloatingScrollbarsStylesheet, win.AGENT_SHEET);
} catch (e) { }
}
flushStyle();
}
function flushStyle() {
@@ -168,27 +172,27 @@ var global = this;
canvas.width = width;
canvas.height = height;
let ctx = canvas.getContext("2d");
ctx.scale(ratio, ratio);
ctx.drawWindow(content, content.scrollX, content.scrollY, width, height, "#fff");
sendAsyncMessage("ResponsiveMode:RequestScreenshot:Done", canvas.toDataURL());
}
- var WebProgressListener = {
+ let WebProgressListener = {
onLocationChange(webProgress, request, URI, flags) {
if (flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) {
return;
}
makeScrollbarsFloating();
},
- QueryInterface: function QueryInterface(aIID) {
- if (aIID.equals(Ci.nsIWebProgressListener) ||
- aIID.equals(Ci.nsISupportsWeakReference) ||
- aIID.equals(Ci.nsISupports)) {
+ QueryInterface: function QueryInterface(iid) {
+ if (iid.equals(Ci.nsIWebProgressListener) ||
+ iid.equals(Ci.nsISupportsWeakReference) ||
+ iid.equals(Ci.nsISupports)) {
return this;
}
throw Components.results.NS_ERROR_NO_INTERFACE;
}
};
})();
global.responsiveFrameScriptLoaded = true;
--- a/devtools/client/responsive.html/commands.js
+++ b/devtools/client/responsive.html/commands.js
@@ -1,78 +1,80 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const { Cc, Ci, Cu } = require("chrome");
+const { Cc, Ci } = require("chrome");
loader.lazyRequireGetter(this, "ResponsiveUIManager", "devtools/client/responsive.html/manager", true);
-const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"].
- getService(Ci.nsIStringBundleService).
- createBundle("chrome://branding/locale/brand.properties").
- GetStringFromName("brandShortName");
+const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://branding/locale/brand.properties")
+ .GetStringFromName("brandShortName");
const Services = require("Services");
const osString = Services.appinfo.OS;
const l10n = require("gcli/l10n");
exports.items = [
{
name: "resize",
description: l10n.lookup("resizeModeDesc")
},
{
item: "command",
runAt: "client",
name: "resize on",
description: l10n.lookup("resizeModeOnDesc"),
manual: l10n.lookupFormat("resizeModeManual2", [BRAND_SHORT_NAME]),
- exec: gcli_cmd_resize
+ exec: resize
},
{
item: "command",
runAt: "client",
name: "resize off",
description: l10n.lookup("resizeModeOffDesc"),
manual: l10n.lookupFormat("resizeModeManual2", [BRAND_SHORT_NAME]),
- exec: gcli_cmd_resize
+ exec: resize
},
{
item: "command",
runAt: "client",
name: "resize toggle",
buttonId: "command-button-responsive",
buttonClass: "command-button command-button-invertable",
- tooltipText: l10n.lookupFormat("resizeModeToggleTooltip2",
- [(osString == "Darwin" ? "Cmd+Opt+M" : "Ctrl+Shift+M")]),
+ tooltipText: l10n.lookupFormat(
+ "resizeModeToggleTooltip2",
+ [(osString == "Darwin" ? "Cmd+Opt+M" : "Ctrl+Shift+M")]
+ ),
description: l10n.lookup("resizeModeToggleDesc"),
manual: l10n.lookupFormat("resizeModeManual2", [BRAND_SHORT_NAME]),
state: {
- isChecked: function (aTarget) {
- if (!aTarget.tab) {
+ isChecked: function (target) {
+ if (!target.tab) {
return false;
}
- return ResponsiveUIManager.isActiveForTab(aTarget.tab);
+ return ResponsiveUIManager.isActiveForTab(target.tab);
},
- onChange: function (aTarget, aChangeHandler) {
- if (aTarget.tab) {
- ResponsiveUIManager.on("on", aChangeHandler);
- ResponsiveUIManager.on("off", aChangeHandler);
+ onChange: function (target, changeHandler) {
+ if (target.tab) {
+ ResponsiveUIManager.on("on", changeHandler);
+ ResponsiveUIManager.on("off", changeHandler);
}
},
- offChange: function (aTarget, aChangeHandler) {
+ offChange: function (target, changeHandler) {
// Do not check for target.tab as it may already be null during destroy
- ResponsiveUIManager.off("on", aChangeHandler);
- ResponsiveUIManager.off("off", aChangeHandler);
+ ResponsiveUIManager.off("on", changeHandler);
+ ResponsiveUIManager.off("off", changeHandler);
},
},
- exec: gcli_cmd_resize
+ exec: resize
},
{
item: "command",
runAt: "client",
name: "resize to",
description: l10n.lookup("resizeModeToDesc"),
params: [
{
@@ -81,19 +83,19 @@ exports.items = [
description: l10n.lookup("resizePageArgWidthDesc"),
},
{
name: "height",
type: "number",
description: l10n.lookup("resizePageArgHeightDesc"),
},
],
- exec: gcli_cmd_resize
+ exec: resize
}
];
-function* gcli_cmd_resize(args, context) {
+function* resize(args, context) {
let browserWindow = context.environment.chromeWindow;
yield ResponsiveUIManager.handleGcliCommand(browserWindow,
browserWindow.gBrowser.selectedTab,
this.name,
args);
}
--- a/devtools/server/actors/emulation/touch-simulator.js
+++ b/devtools/server/actors/emulation/touch-simulator.js
@@ -222,17 +222,17 @@ TouchSimulator.prototype = {
let content = this.getContent(evt.target);
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
utils.sendMouseEvent(type, evt.clientX, evt.clientY, 0, 1, 0, true, 0,
Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH);
},
sendContextMenu({ target, clientX, clientY, screenX, screenY }) {
- let view = target.ownerDocument.defaultView;
+ let view = target.ownerGlobal;
let { MouseEvent } = view;
let evt = new MouseEvent("contextmenu", {
bubbles: true,
cancelable: true,
view,
screenX,
screenY,
clientX,
@@ -297,17 +297,17 @@ TouchSimulator.prototype = {
touchEvent.initTouchEvent(name, true, true, content, 0,
false, false, false, false,
touches, targetTouches, changedTouches);
target.dispatchEvent(touchEvent);
},
getContent(target) {
let win = (target && target.ownerDocument)
- ? target.ownerDocument.defaultView
+ ? target.ownerGlobal
: null;
return win;
},
getDelayBeforeMouseEvent(evt) {
// On mobile platforms, Firefox inserts a 300ms delay between
// touch events and accompanying mouse events, except if the
// content window is not zoomable and the content window is