Bug 1436184 - Remove definitions of Ci, Cr, Cc, and Cu from httpd.js and .sjs files. r=florian draft
authorAndrew McCreight <continuation@gmail.com>
Tue, 06 Feb 2018 15:03:13 -0800
changeset 752665 c2300d5a69a1c97d96f3655ad19dc090ef0551a6
parent 752511 0ac953fcddf10132eaecdb753d72b2ba5a43c32a
push id98339
push userbmo:continuation@gmail.com
push dateThu, 08 Feb 2018 19:09:03 +0000
reviewersflorian
bugs1436184
milestone60.0a1
Bug 1436184 - Remove definitions of Ci, Cr, Cc, and Cu from httpd.js and .sjs files. r=florian MozReview-Commit-ID: IKKb9zr2OSf
browser/base/content/test/urlbar/searchSuggestionEngine.sjs
browser/base/content/test/urlbar/slow-page.sjs
browser/components/extensions/test/browser/file_slowed_document.sjs
browser/components/sessionstore/test/browser_637020_slow.sjs
browser/components/sessionstore/test/browser_sessionHistory_slow.sjs
browser/components/translation/test/bing.sjs
browser/components/translation/test/yandex.sjs
devtools/client/netmonitor/test/sjs_content-type-test-server.sjs
devtools/client/netmonitor/test/sjs_sorting-test-server.sjs
devtools/client/netmonitor/test/sjs_status-codes-test-server.sjs
devtools/client/webconsole/new-console-output/test/mochitest/sjs_slow-response-test-server.sjs
dom/base/test/send_gzip_content.sjs
dom/media/test/cancellable_request.sjs
dom/media/test/gzipped_mp4.sjs
dom/security/test/contentverifier/file_contentserver.sjs
dom/serviceworkers/test/download_canceled/server-stream-download.sjs
layout/generic/test/file_IconTestServer.sjs
layout/generic/test/file_SlowImage.sjs
layout/generic/test/file_SlowPage.sjs
layout/reftests/fonts/Chunkfive.sjs
mobile/android/components/extensions/test/mochitest/file_slowed_document.sjs
netwerk/test/httpserver/httpd.js
netwerk/test/httpserver/test/data/sjs/qi.sjs
netwerk/test/mochitests/redirect.sjs
netwerk/test/mochitests/signed_web_packaged_app.sjs
netwerk/test/mochitests/web_packaged_app.sjs
toolkit/components/alerts/test/image_server.sjs
toolkit/components/extensions/test/mochitest/slow_response.sjs
toolkit/components/search/tests/xpcshell/data/engineMaker.sjs
toolkit/components/search/tests/xpcshell/data/searchSuggestions.sjs
toolkit/crashreporter/test/browser/crashreport.sjs
toolkit/mozapps/extensions/test/xpinstall/slowinstall.sjs
toolkit/mozapps/update/tests/chrome/update.sjs
--- a/browser/base/content/test/urlbar/searchSuggestionEngine.sjs
+++ b/browser/base/content/test/urlbar/searchSuggestionEngine.sjs
@@ -1,13 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const { classes: Cc, interfaces: Ci } = Components;
-
 let gTimer;
 
 function handleRequest(req, resp) {
   // Parse the query params.  If the params aren't in the form "foo=bar", then
   // treat the entire query string as a search string.
   let params = req.queryString.split("&").reduce((memo, pair) => {
     let [key, val] = pair.split("=");
     if (!val) {
--- a/browser/base/content/test/urlbar/slow-page.sjs
+++ b/browser/base/content/test/urlbar/slow-page.sjs
@@ -1,13 +1,10 @@
 "use strict";
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
 let timer;
 
 const DELAY_MS = 5000;
 function handleRequest(request, response) {
   if (request.queryString.endsWith("faster")) {
     response.setHeader("Content-Type", "text/html", false);
     response.write("<body>Not so slow!</body>");
     return;
--- a/browser/components/extensions/test/browser/file_slowed_document.sjs
+++ b/browser/components/extensions/test/browser/file_slowed_document.sjs
@@ -6,18 +6,16 @@
 // all phases of the load cycle supported by the extension API.
 
 /* eslint-disable no-unused-vars */
 
 const URL = "file_slowed_document.sjs";
 
 const DELAY = 2 * 1000; // Delay two seconds before completing the request.
 
-const Ci = Components.interfaces;
-
 let nsTimer = Components.Constructor("@mozilla.org/timer;1", "nsITimer", "initWithCallback");
 
 let timer;
 
 function handleRequest(request, response) {
   response.processAsync();
 
   response.setHeader("Content-Type", "text/html", false);
--- a/browser/components/sessionstore/test/browser_637020_slow.sjs
+++ b/browser/components/sessionstore/test/browser_637020_slow.sjs
@@ -1,14 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
 const DELAY_MS = "2000";
 
 let timer;
 
 function handleRequest(req, resp) {
   resp.processAsync();
   resp.setHeader("Cache-Control", "no-cache", false);
   resp.setHeader("Content-Type", "text/html;charset=utf-8", false);
--- a/browser/components/sessionstore/test/browser_sessionHistory_slow.sjs
+++ b/browser/components/sessionstore/test/browser_sessionHistory_slow.sjs
@@ -1,14 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
 const DELAY_MS = "2000";
 
 let timer;
 
 function handleRequest(req, resp) {
   resp.processAsync();
   resp.setHeader("Cache-Control", "no-cache", false);
   resp.setHeader("Content-Type", "text/html;charset=utf-8", false);
--- a/browser/components/translation/test/bing.sjs
+++ b/browser/components/translation/test/bing.sjs
@@ -1,15 +1,15 @@
 /* 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 {classes: Cc, interfaces: Ci, Constructor: CC} = Components;
+const CC = Components.Constructor;
 const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
                              "nsIBinaryInputStream",
                              "setInputStream");
 
 function handleRequest(req, res) {
   try {
     reallyHandleRequest(req, res);
   } catch (ex) {
--- a/browser/components/translation/test/yandex.sjs
+++ b/browser/components/translation/test/yandex.sjs
@@ -1,15 +1,15 @@
 /* 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 {classes: Cc, interfaces: Ci, Constructor: CC} = Components;
+const CC = Components.Constructor;
 const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
                              "nsIBinaryInputStream",
                              "setInputStream");
 
 function handleRequest(req, res) {
   try {
     reallyHandleRequest(req, res);
   } catch (ex) {
--- a/devtools/client/netmonitor/test/sjs_content-type-test-server.sjs
+++ b/devtools/client/netmonitor/test/sjs_content-type-test-server.sjs
@@ -1,13 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const { classes: Cc, interfaces: Ci } = Components;
-
 function gzipCompressString(string, obs) {
 
   let scs = Cc["@mozilla.org/streamConverters;1"]
            .getService(Ci.nsIStreamConverterService);
   let listener = Cc["@mozilla.org/network/stream-loader;1"]
                 .createInstance(Ci.nsIStreamLoader);
   listener.init(obs);
   let converter = scs.asyncConvertData("uncompressed", "gzip",
--- a/devtools/client/netmonitor/test/sjs_sorting-test-server.sjs
+++ b/devtools/client/netmonitor/test/sjs_sorting-test-server.sjs
@@ -1,13 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const { classes: Cc, interfaces: Ci } = Components;
-
 function handleRequest(request, response) {
   response.processAsync();
 
   let params = request.queryString.split("&");
   let index = params.filter((s) => s.includes("index="))[0].split("=")[1];
 
   let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   timer.initWithCallback(() => {
--- a/devtools/client/netmonitor/test/sjs_status-codes-test-server.sjs
+++ b/devtools/client/netmonitor/test/sjs_status-codes-test-server.sjs
@@ -1,13 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const { classes: Cc, interfaces: Ci } = Components;
-
 function handleRequest(request, response) {
   response.processAsync();
 
   let params = request.queryString.split("&");
   let status = params.filter(s => s.includes("sts="))[0].split("=")[1];
   let cached = params.filter(s => s === 'cached').length !== 0;
 
   let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
--- a/devtools/client/webconsole/new-console-output/test/mochitest/sjs_slow-response-test-server.sjs
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/sjs_slow-response-test-server.sjs
@@ -1,13 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const { classes: Cc, interfaces: Ci } = Components;
-
 function handleRequest(request, response) {
   response.processAsync();
 
   let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   timer.initWithCallback(() => {
     // to avoid garbage collection
     timer = null;
     response.setStatusLine(request.httpVersion, 200, "OK");
--- a/dom/base/test/send_gzip_content.sjs
+++ b/dom/base/test/send_gzip_content.sjs
@@ -1,11 +1,8 @@
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
 function gzipCompressString(string, obs) {
 
   let scs = Cc["@mozilla.org/streamConverters;1"]
            .getService(Ci.nsIStreamConverterService);
   let listener = Cc["@mozilla.org/network/stream-loader;1"]
                 .createInstance(Ci.nsIStreamLoader);
   listener.init(obs);
   let converter = scs.asyncConvertData("uncompressed", "gzip",
--- a/dom/media/test/cancellable_request.sjs
+++ b/dom/media/test/cancellable_request.sjs
@@ -53,17 +53,16 @@ function buildWave(samples, sample_rate)
   push32BE(header, DATA_MAGIC);
   push32LE(header, samples.length * 2);
   for (var i = 0; i < samples.length; ++i) {
     push16LE(header, samples[i], 2);
   }
   return header;
 }
 
-const Ci = Components.interfaces;
 const CC = Components.Constructor;
 const Timer = CC("@mozilla.org/timer;1", "nsITimer", "initWithCallback");
 const BinaryOutputStream = CC("@mozilla.org/binaryoutputstream;1",
                              "nsIBinaryOutputStream",
                              "setOutputStream");
 
 function poll(f) {
   if (f()) {
--- a/dom/media/test/gzipped_mp4.sjs
+++ b/dom/media/test/gzipped_mp4.sjs
@@ -1,10 +1,8 @@
-const { classes: Cc, interfaces: Ci } = Components;
-
 function getGzippedFileBytes()
 {
   var file;
   getObjectState("SERVER_ROOT", function(serverRoot) {
     file = serverRoot.getFile("tests/dom/media/test/short.mp4.gz");
   });
   var fileInputStream =
     Components.classes['@mozilla.org/network/file-input-stream;1']
--- a/dom/security/test/contentverifier/file_contentserver.sjs
+++ b/dom/security/test/contentverifier/file_contentserver.sjs
@@ -1,16 +1,15 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* 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/. */
 // sjs for remote about:newtab (bug 1226928)
 "use strict";
 
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.importGlobalProperties(["URLSearchParams"]);
 
 const path = "browser/dom/security/test/contentverifier/";
 
 const goodFileName = "file_about_newtab.html";
 const goodFileBase = path + goodFileName;
--- a/dom/serviceworkers/test/download_canceled/server-stream-download.sjs
+++ b/dom/serviceworkers/test/download_canceled/server-stream-download.sjs
@@ -1,13 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-
 Cu.import("resource://gre/modules/Timer.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 
 // stolen from file_blocked_script.sjs
 function setGlobalState(data, key)
 {
   x = { data: data, QueryInterface: function(iid) { return this } };
   x.wrappedJSObject = x;
--- a/layout/generic/test/file_IconTestServer.sjs
+++ b/layout/generic/test/file_IconTestServer.sjs
@@ -1,10 +1,8 @@
-const Cc = Components.classes;
-const Ci = Components.interfaces;
 const TIMEOUT_INTERVAL_MS = 100;
 
 function handleRequest(request, response) {
 
   // Allow us to asynchronously construct the response with timeouts
   // rather than forcing us to make the whole thing in one call. See
   // bug 396226.
   response.processAsync();
--- a/layout/generic/test/file_SlowImage.sjs
+++ b/layout/generic/test/file_SlowImage.sjs
@@ -1,11 +1,9 @@
 "use strict";
-const Cc = Components.classes;
-const Ci = Components.interfaces;
 
 const IMG_BYTES = atob(
   "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAA" +
   "DUlEQVQImWNgY2P7DwABOgESJhRQtgAAAABJRU5ErkJggg==");
 
 function handleRequest(request, response) {
   response.processAsync();
   getObjectState("context", function(obj) {
--- a/layout/generic/test/file_SlowPage.sjs
+++ b/layout/generic/test/file_SlowPage.sjs
@@ -1,13 +1,10 @@
 "use strict";
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
 let timer;
 
 const DELAY_MS = 5000;
 
 function handleRequest(request, response) {
   response.processAsync();
 
   response.setHeader("Content-Type", "text/html", false);
--- a/layout/reftests/fonts/Chunkfive.sjs
+++ b/layout/reftests/fonts/Chunkfive.sjs
@@ -1,14 +1,11 @@
 // This returns the content of Chunkfive.otf from a .sjs file, for testing.
 // Accepts query parameters statusCode and statusReason to specify the HTTP response status.
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
 const BinaryOutputStream =
   Components.Constructor("@mozilla.org/binaryoutputstream;1",
                          "nsIBinaryOutputStream",
                          "setOutputStream");
 
 function handleRequest(request, response)
 {
   var params = {};
--- a/mobile/android/components/extensions/test/mochitest/file_slowed_document.sjs
+++ b/mobile/android/components/extensions/test/mochitest/file_slowed_document.sjs
@@ -6,18 +6,16 @@
 // all phases of the load cycle supported by the extension API.
 
 /* eslint-disable no-unused-vars */
 
 const URL = "file_slowed_document.sjs";
 
 const DELAY = 2 * 1000; // Delay one second before completing the request.
 
-const Ci = Components.interfaces;
-
 let nsTimer = Components.Constructor("@mozilla.org/timer;1", "nsITimer", "initWithCallback");
 
 let timer;
 
 function handleRequest(request, response) {
   response.processAsync();
 
   response.setHeader("Content-Type", "text/html", false);
--- a/netwerk/test/httpserver/httpd.js
+++ b/netwerk/test/httpserver/httpd.js
@@ -35,20 +35,16 @@ this.EXPORTED_SYMBOLS = [
   "HTTP_504",
   "HTTP_505",
   "HttpError",
   "HttpServer",
 ];
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cu = Components.utils;
 const CC = Components.Constructor;
 
 const PR_UINT32_MAX = Math.pow(2, 32) - 1;
 
 /** True if debugging output is enabled, false otherwise. */
 var DEBUG = false; // non-const *only* so tweakable in server tests
 
 /** True if debugging output should be timestamped. */
--- a/netwerk/test/httpserver/test/data/sjs/qi.sjs
+++ b/netwerk/test/httpserver/test/data/sjs/qi.sjs
@@ -1,10 +1,8 @@
-const Ci = Components.interfaces;
-
 function handleRequest(request, response)
 {
   var exstr, qid;
 
   response.setStatusLine(request.httpVersion, 500, "FAIL");
 
   var passed = false;
   try
--- a/netwerk/test/mochitests/redirect.sjs
+++ b/netwerk/test/mochitests/redirect.sjs
@@ -1,8 +1,4 @@
-var Cc = Components.classes;
-var Ci = Components.interfaces;
-var Cu = Components.utils;
-
 function handleRequest(request, response) {
   response.setStatusLine(request.httpVersion, 301, "Moved Permanently");
   response.setHeader("Location", "empty.html#");
 }
--- a/netwerk/test/mochitests/signed_web_packaged_app.sjs
+++ b/netwerk/test/mochitests/signed_web_packaged_app.sjs
@@ -1,12 +1,8 @@
-var Cc = Components.classes;
-var Ci = Components.interfaces;
-var Cu = Components.utils;
-
 function handleRequest(request, response)
 {
   response.setHeader("Content-Type", "application/package", false);
   response.write(signedPackage);
 }
 
 // The package content
 // getData formats it as described at http://www.w3.org/TR/web-packaging/#streamable-package-format
--- a/netwerk/test/mochitests/web_packaged_app.sjs
+++ b/netwerk/test/mochitests/web_packaged_app.sjs
@@ -1,12 +1,8 @@
-var Cc = Components.classes;
-var Ci = Components.interfaces;
-var Cu = Components.utils;
-
 function handleRequest(request, response)
 {
   response.setHeader("Content-Type", "application/package", false);
   response.write(octetStreamData.getData());
   return;
 }
 
 // The package content
--- a/toolkit/components/alerts/test/image_server.sjs
+++ b/toolkit/components/alerts/test/image_server.sjs
@@ -1,9 +1,9 @@
-const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr, Constructor: CC } = Components;
+const CC = Components.Constructor;
 
 Cu.import("resource://gre/modules/Timer.jsm");
 
 const LocalFile = CC("@mozilla.org/file/local;1", "nsIFile",
                      "initWithPath");
 
 const FileInputStream = CC("@mozilla.org/network/file-input-stream;1",
                            "nsIFileInputStream", "init");
--- a/toolkit/components/extensions/test/mochitest/slow_response.sjs
+++ b/toolkit/components/extensions/test/mochitest/slow_response.sjs
@@ -1,17 +1,14 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80 ft=javascript: */
 "use strict";
 
 /* eslint-disable no-unused-vars */
 
-const Cu = Components.utils;
-const Ci = Components.interfaces;
-
 Cu.import("resource://gre/modules/AppConstants.jsm");
 
 const DELAY = AppConstants.DEBUG ? 4000 : 800;
 
 let nsTimer = Components.Constructor("@mozilla.org/timer;1", "nsITimer", "initWithCallback");
 
 let timer;
 function delay() {
--- a/toolkit/components/search/tests/xpcshell/data/engineMaker.sjs
+++ b/toolkit/components/search/tests/xpcshell/data/engineMaker.sjs
@@ -1,13 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-
 /**
  * Dynamically create a search engine offering search suggestions via searchSuggestions.sjs.
  *
  * The engine is constructed by passing a JSON object with engine datails as the query string.
  */
 
 function handleRequest(request, response) {
   let engineData = JSON.parse(unescape(request.queryString).replace("+", " "));
--- a/toolkit/components/search/tests/xpcshell/data/searchSuggestions.sjs
+++ b/toolkit/components/search/tests/xpcshell/data/searchSuggestions.sjs
@@ -1,13 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-
 Cu.import("resource://gre/modules/Timer.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 
 /**
  * Provide search suggestions in the OpenSearch JSON format.
  */
 
 function handleRequest(request, response) {
--- a/toolkit/crashreporter/test/browser/crashreport.sjs
+++ b/toolkit/crashreporter/test/browser/crashreport.sjs
@@ -1,10 +1,8 @@
-const Cc = Components.classes;
-const Ci = Components.interfaces;
 const CC = Components.Constructor;
 
 const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
                               "nsIBinaryInputStream",
                               "setInputStream");
 
 function parseHeaders(data, start)
 {
--- a/toolkit/mozapps/extensions/test/xpinstall/slowinstall.sjs
+++ b/toolkit/mozapps/extensions/test/xpinstall/slowinstall.sjs
@@ -1,10 +1,8 @@
-const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 
 const RELATIVE_PATH = "browser/toolkit/mozapps/extensions/test/xpinstall"
 const NOTIFICATION_TOPIC = "slowinstall-complete";
 
 /**
--- a/toolkit/mozapps/update/tests/chrome/update.sjs
+++ b/toolkit/mozapps/update/tests/chrome/update.sjs
@@ -1,18 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Server side http server script for application update tests.
  */
 
-const { classes: Cc, interfaces: Ci } = Components;
-
 function getTestDataFile(aFilename) {
   let file = Cc["@mozilla.org/file/directory_service;1"].
             getService(Ci.nsIProperties).get("CurWorkD", Ci.nsIFile);
   let pathParts = REL_PATH_DATA.split("/");
   for (let i = 0; i < pathParts.length; ++i) {
     file.append(pathParts[i]);
   }
   if (aFilename) {