Bug 1340205 - cleanup and unignore from eslintdevtools/client/webconsole/utils.js;r=nchevobbe
MozReview-Commit-ID: 2goPtQVSsLF
--- a/.eslintignore
+++ b/.eslintignore
@@ -93,17 +93,16 @@ devtools/client/shared/*.jsm
devtools/client/shared/components/reps/reps.js
devtools/client/shared/webgl-utils.js
devtools/client/shared/widgets/*.jsm
devtools/client/webaudioeditor/**
devtools/client/webconsole/net/**
devtools/client/webconsole/test/**
devtools/client/webconsole/console-output.js
devtools/client/webconsole/hudservice.js
-devtools/client/webconsole/utils.js
devtools/client/webconsole/webconsole-connection-proxy.js
devtools/client/webconsole/webconsole.js
devtools/client/webide/**
!devtools/client/webide/components/webideCli.js
devtools/server/actors/webconsole.js
devtools/server/actors/object.js
devtools/server/actors/script.js
devtools/server/actors/styleeditor.js
--- a/devtools/client/webconsole/utils.js
+++ b/devtools/client/webconsole/utils.js
@@ -1,32 +1,32 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft= javascript ts=2 et sw=2 tw=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, components} = require("chrome");
+const {Cc, Ci} = require("chrome");
const Services = require("Services");
const {LocalizationHelper} = require("devtools/shared/l10n");
// Match the function name from the result of toString() or toSource().
//
// Examples:
// (function foobar(a, b) { ...
// function foobar2(a) { ...
// function() { ...
const REGEX_MATCH_FUNCTION_NAME = /^\(?function\s+([^(\s]+)\s*\(/;
// Number of terminal entries for the self-xss prevention to go away
const CONSOLE_ENTRY_THRESHOLD = 5;
-const CONSOLE_WORKER_IDS = exports.CONSOLE_WORKER_IDS = [
+exports.CONSOLE_WORKER_IDS = [
"SharedWorker",
"ServiceWorker",
"Worker"
];
var WebConsoleUtils = {
/**
@@ -99,62 +99,16 @@ var WebConsoleUtils = {
let style = win.getComputedStyle(from);
to.style.fontFamily = style.getPropertyCSSValue("font-family").cssText;
to.style.fontSize = style.getPropertyCSSValue("font-size").cssText;
to.style.fontWeight = style.getPropertyCSSValue("font-weight").cssText;
to.style.fontStyle = style.getPropertyCSSValue("font-style").cssText;
},
/**
- * Create a grip for the given value. If the value is an object,
- * an object wrapper will be created.
- *
- * @param mixed value
- * The value you want to create a grip for, before sending it to the
- * client.
- * @param function objectWrapper
- * If the value is an object then the objectWrapper function is
- * invoked to give us an object grip. See this.getObjectGrip().
- * @return mixed
- * The value grip.
- */
- createValueGrip: function (value, objectWrapper) {
- switch (typeof value) {
- case "boolean":
- return value;
- case "string":
- return objectWrapper(value);
- case "number":
- if (value === Infinity) {
- return { type: "Infinity" };
- } else if (value === -Infinity) {
- return { type: "-Infinity" };
- } else if (Number.isNaN(value)) {
- return { type: "NaN" };
- } else if (!value && 1 / value === -Infinity) {
- return { type: "-0" };
- }
- return value;
- case "undefined":
- return { type: "undefined" };
- case "object":
- if (value === null) {
- return { type: "null" };
- }
- // Fall through.
- case "function":
- return objectWrapper(value);
- default:
- console.error("Failed to provide a grip for value of " + typeof value
- + ": " + value);
- return null;
- }
- },
-
- /**
* Determine if the given request mixes HTTP with HTTPS content.
*
* @param string request
* Location of the requested content.
* @param string location
* Location of the current page.
* @return boolean
* True if the content is mixed, false if not.