Bug 1396967 - Fix undeclared assignments in MozMill. r?tcsc
MozReview-Commit-ID: 7C5zFAHmRQQ
--- a/services/sync/tps/extensions/mozmill/resource/driver/controller.js
+++ b/services/sync/tps/extensions/mozmill/resource/driver/controller.js
@@ -61,17 +61,17 @@ waitForEvents.prototype = {
/**
* Wait until all assigned events have been fired
*/
wait: function waitForEvents_wait(timeout, interval) {
for (var e in this.registry) {
assert.waitFor(function () {
return this.node.firedEvents[e] == true;
- }, "waitForEvents.wait(): Event '" + ex + "' has been fired.", timeout, interval);
+ }, "waitForEvents.wait(): Event '" + e + "' has been fired.", timeout, interval);
this.node.removeEventListener(e, this.registry[e], true);
}
}
}
/**
* Class to handle menus and context menus
@@ -788,17 +788,17 @@ MozMillController.prototype.assertImageL
}
var comp = img.complete;
var ret = null; // Return value
// Workaround for Safari -- it only supports the
// complete attrib on script-created images
if (typeof comp == 'undefined') {
- test = new Image();
+ let test = new Image();
// If the original image was successfully loaded,
// src for new one should be pulled from cache
test.src = img.src;
comp = test.complete;
}
// Check the complete attrib. Note the strict
// equality check -- we don't want undefined, null, etc.
@@ -977,19 +977,19 @@ function browserAdditions (controller) {
}
catch (ex) {
if (!(ex instanceof errors.TimeoutError)) {
throw ex;
}
timed_out = true;
}
finally {
- state = 'URI=' + win.document.location.href +
+ let state = 'URI=' + win.document.location.href +
', readyState=' + win.document.readyState;
- message = "controller.waitForPageLoad(" + state + ")";
+ let message = "controller.waitForPageLoad(" + state + ")";
if (timed_out) {
throw new errors.AssertionError(message);
}
broker.pass({'function': message});
}
}
--- a/services/sync/tps/extensions/mozmill/resource/driver/elementslib.js
+++ b/services/sync/tps/extensions/mozmill/resource/driver/elementslib.js
@@ -339,18 +339,18 @@ var _byName = function (_document, paren
}
var _byAttrib = function (parent, attributes) {
var results = [];
var nodes = parent.childNodes;
for (var i in nodes) {
var n = nodes[i];
- requirementPass = 0;
- requirementLength = 0;
+ let requirementPass = 0;
+ let requirementLength = 0;
for (var a in attributes) {
requirementLength++;
try {
if (n.getAttribute(a) == attributes[a]) {
requirementPass++;
}
} catch (e) {
--- a/services/sync/tps/extensions/mozmill/resource/driver/mozmill.js
+++ b/services/sync/tps/extensions/mozmill/resource/driver/mozmill.js
@@ -235,17 +235,17 @@ function getAddrbkController () {
if (addrbkWindow == null) {
return newAddrbkController();
} else {
return new controller.MozMillController(addrbkWindow);
}
}
function firePythonCallback (filename, method, args, kwargs) {
- obj = {'filename': filename, 'method': method};
+ let obj = {'filename': filename, 'method': method};
obj['args'] = args || [];
obj['kwargs'] = kwargs || {};
broker.sendMessage("firePythonCallback", obj);
}
function timer (name) {
this.name = name;
--- a/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
+++ b/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
@@ -92,17 +92,17 @@ Assert.prototype = {
//~~~I've managed to break Object.keys through screwy arguments passing.
// Converting to array solves the problem.
if (isArguments(a)) {
if (!isArguments(b)) {
return false;
}
a = pSlice.call(a);
b = pSlice.call(b);
- return _deepEqual(a, b);
+ return this._deepEqual(a, b);
}
try {
var ka = Object.keys(a),
kb = Object.keys(b),
key, i;
} catch (e) {//happens when one is a string literal and the other isn't
return false;
}
@@ -391,17 +391,18 @@ Assert.prototype = {
* @throws {errors.AssertionError}
*
* @returns {boolean} Result of the test.
*/
match: function Assert_match(aString, aRegex, aMessage) {
// XXX Bug 634948
// Regex objects are transformed to strings when evaluated in a sandbox
// For now lets re-create the regex from its string representation
- let pattern = flags = "";
+ let pattern = "";
+ let flags = "";
try {
let matches = aRegex.toString().match(/\/(.*)\/(.*)/);
pattern = matches[1];
flags = matches[2];
} catch (e) {
}
--- a/services/sync/tps/extensions/mozmill/resource/modules/frame.js
+++ b/services/sync/tps/extensions/mozmill/resource/modules/frame.js
@@ -280,17 +280,17 @@ events.fail = function (obj) {
};
}
// a low level event, such as a keystroke, fails
if (events.currentTest) {
events.currentTest.__fails__.push(obj);
}
- for (var time of timers) {
+ for (var timer of timers) {
timer.actions.push(
{"currentTest": events.currentModule.__file__ + "::" + events.currentTest.__name__,
"obj": obj,
"result": "fail"}
);
}
events.fireEvent('fail', obj);
--- a/services/sync/tps/extensions/mozmill/resource/modules/l10n.js
+++ b/services/sync/tps/extensions/mozmill/resource/modules/l10n.js
@@ -19,17 +19,17 @@ Cu.import("resource://gre/modules/Servic
* @returns {String} Localized content
*/
function getEntity(aDTDs, aEntityId) {
// Add xhtml11.dtd to prevent missing entity errors with XHTML files
aDTDs.push("resource:///res/dtd/xhtml11.dtd");
// Build a string of external entities
var references = "";
- for (i = 0; i < aDTDs.length; i++) {
+ for (let i = 0; i < aDTDs.length; i++) {
var id = 'dtd' + i;
references += '<!ENTITY % ' + id + ' SYSTEM "' + aDTDs[i] + '">%' + id + ';';
}
var header = '<?xml version="1.0"?><!DOCTYPE elem [' + references + ']>';
var element = '<elem id="entity">&' + aEntityId + ';</elem>';
var content = header + element;
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/objects.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/objects.js
@@ -1,17 +1,17 @@
/* 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/. */
var EXPORTED_SYMBOLS = ['getLength', ];//'compare'];
var getLength = function (obj) {
var len = 0;
- for (i in obj) {
+ for (let i in obj) {
len++;
}
return len;
}
// var logging = {}; Components.utils.import('resource://mozmill/stdlib/logging.js', logging);
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/securable-module.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/securable-module.js
@@ -86,17 +86,17 @@
function maybeParentifyFilename(filename) {
var doParentifyFilename = true;
try {
// TODO: Ideally we should just make
// nsIChromeRegistry.wrappersEnabled() available from script
// and use it here. Until that's in the platform, though,
// we'll play it safe and parentify the filename unless
// we're absolutely certain things will be ok if we don't.
- var filenameURI = ios.newURI(options.filename,
+ var filenameURI = ios.newURI(filename,
null,
baseURI);
if (filenameURI.scheme == 'chrome' &&
filenameURI.pathQueryRef.indexOf('/content/') == 0)
// Content packages will always have wrappers made for them;
// if automatic wrappers have been disabled for the
// chrome package via a chrome manifest flag, then
// this still works too, to the extent that the