Bug 1206683 - Enable eslint rule for no unused variables for Loop. r=Mardak

This commit is contained in:
Mark Banner 2015-12-08 08:08:06 -05:00
parent 88268a8dbd
commit 3918e226e0
25 changed files with 36 additions and 75 deletions

View File

@ -209,7 +209,6 @@ loop.store = loop.store || {};
/**
* Executed when the user switches accounts.
*
*/
_onRoomsRefresh: function() {
this.dispatchAction(new sharedActions.UpdateRoomList({
@ -340,7 +339,7 @@ loop.store = loop.store || {};
emailRoomUrl: function(actionData) {
var from = actionData.from;
loop.shared.utils.composeCallUrlEmail(actionData.roomUrl, null,
actionData.roomDescription, from);
actionData.roomDescription);
var bucket = this._constants.SHARING_ROOM_URL["EMAIL_FROM_" + (from || "").toUpperCase()];
if (typeof bucket === "undefined") {
@ -386,10 +385,8 @@ loop.store = loop.store || {};
/**
* Open the share panel to add a Social share provider.
*
* @param {sharedActions.AddSocialShareProvider} actionData The action data.
*/
addSocialShareProvider: function(actionData) {
addSocialShareProvider: function() {
loop.request("AddSocialShareProvider");
},

View File

@ -5,7 +5,7 @@
var loop = loop || {};
loop.shared = loop.shared || {};
loop.shared.views = loop.shared.views || {};
loop.shared.views.LinkifiedTextView = (function(mozL10n) {
loop.shared.views.LinkifiedTextView = (function() {
"use strict";
/**
@ -113,4 +113,4 @@ loop.shared.views.LinkifiedTextView = (function(mozL10n) {
return LinkifiedTextView;
})(navigator.mozL10n || document.mozL10n);
})();

View File

@ -5,7 +5,7 @@
var loop = loop || {};
loop.shared = loop.shared || {};
loop.shared.views = loop.shared.views || {};
loop.shared.views.LinkifiedTextView = (function(mozL10n) {
loop.shared.views.LinkifiedTextView = (function() {
"use strict";
/**
@ -113,4 +113,4 @@ loop.shared.views.LinkifiedTextView = (function(mozL10n) {
return LinkifiedTextView;
})(navigator.mozL10n || document.mozL10n);
})();

View File

@ -694,7 +694,7 @@ loop.OTSdkDriver = (function() {
}
}.bind(this),
close: function(e) {
close: function() {
// XXX We probably want to dispatch and handle this somehow.
console.log("Subscribed data channel closed!");
}
@ -713,10 +713,8 @@ loop.OTSdkDriver = (function() {
* that the remote client is setup for data
* channels. Getting the data channel for the subscriber is handled
* separately when the subscription completes.
*
* @param {OT.SignalEvent} event Details of the signal received.
*/
_onReadyForDataChannel: function(event) {
_onReadyForDataChannel: function() {
// If we don't want data channels, just ignore the message. We haven't
// send the other side a message, so it won't display anything.
if (!this._useDataChannels) {
@ -734,7 +732,7 @@ loop.OTSdkDriver = (function() {
this._publisherChannel = channel;
channel.on({
close: function(e) {
close: function() {
// XXX We probably want to dispatch and handle this somehow.
console.log("Published data channel closed!");
}
@ -991,12 +989,10 @@ loop.OTSdkDriver = (function() {
* which to copy the stream when attaching it to visible video element
* that the views control directly.
*
* @param event {OT.VideoEnabledChangedEvent} from the SDK
*
* @see https://tokbox.com/opentok/libraries/client/js/reference/VideoEnabledChangedEvent.html
* @private
*/
_onVideoEnabled: function(event) {
_onVideoEnabled: function() {
var sdkSubscriberVideo = this._mockSubscribeEl.querySelector("video");
if (!sdkSubscriberVideo) {
console.error("sdkSubscriberVideo unexpectedly falsy!");
@ -1011,12 +1007,10 @@ loop.OTSdkDriver = (function() {
* Handle the SDK disabling of remote video by dispatching the
* appropriate event.
*
* @param event {OT.VideoEnabledChangedEvent) from the SDK
*
* @see https://tokbox.com/opentok/libraries/client/js/reference/VideoEnabledChangedEvent.html
* @private
*/
_onVideoDisabled: function(event) {
_onVideoDisabled: function() {
this.dispatcher.dispatch(new sharedActions.RemoteVideoStatus({
videoEnabled: false
}));

View File

@ -8,8 +8,6 @@ loop.store = loop.store || {};
loop.store.TextChatStore = (function() {
"use strict";
var sharedActions = loop.shared.actions;
var CHAT_MESSAGE_TYPES = loop.store.CHAT_MESSAGE_TYPES = {
RECEIVED: "recv",
SENT: "sent",

View File

@ -397,9 +397,8 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
* @param {String} callUrl The call URL.
* @param {String} [recipient] The recipient email address (optional).
* @param {String} [contextDescription] The context description (optional).
* @param {String} [from] The area from which this function is called.
*/
function composeCallUrlEmail(callUrl, recipient, contextDescription, from) {
function composeCallUrlEmail(callUrl, recipient, contextDescription) {
if (!isDesktop()) {
console.warn("composeCallUrlEmail isn't available for Loop standalone.");
return;

View File

@ -12,7 +12,6 @@ loop.store = loop.store || {};
loop.store.StandaloneAppStore = (function() {
"use strict";
var sharedActions = loop.shared.actions;
var sharedUtils = loop.shared.utils;
var CALL_REGEXP = /\/c\/([\w\-]+)$/;

View File

@ -11,10 +11,7 @@ loop.webapp = (function(_, OT, mozL10n) {
var sharedActions = loop.shared.actions;
var sharedMixins = loop.shared.mixins;
var sharedModels = loop.shared.models;
var sharedViews = loop.shared.views;
var sharedUtils = loop.shared.utils;
var WEBSOCKET_REASONS = loop.shared.utils.WEBSOCKET_REASONS;
/**
* Homepage view.
@ -175,11 +172,10 @@ loop.webapp = (function(_, OT, mozL10n) {
* App initialization.
*/
function init() {
var standaloneMozLoop = new loop.StandaloneMozLoop({
loop.StandaloneMozLoop({
baseServerUrl: loop.config.serverUrl
});
// New flux items.
var dispatcher = new loop.Dispatcher();
var sdkDriver = new loop.OTSdkDriver({
// For the standalone, always request data channels. If they aren't

View File

@ -11,10 +11,7 @@ loop.webapp = (function(_, OT, mozL10n) {
var sharedActions = loop.shared.actions;
var sharedMixins = loop.shared.mixins;
var sharedModels = loop.shared.models;
var sharedViews = loop.shared.views;
var sharedUtils = loop.shared.utils;
var WEBSOCKET_REASONS = loop.shared.utils.WEBSOCKET_REASONS;
/**
* Homepage view.
@ -175,11 +172,10 @@ loop.webapp = (function(_, OT, mozL10n) {
* App initialization.
*/
function init() {
var standaloneMozLoop = new loop.StandaloneMozLoop({
loop.StandaloneMozLoop({
baseServerUrl: loop.config.serverUrl
});
// New flux items.
var dispatcher = new loop.Dispatcher();
var sdkDriver = new loop.OTSdkDriver({
// For the standalone, always request data channels. If they aren't

View File

@ -23,7 +23,7 @@ describe("loop.feedbackViews", function() {
describe("FeedbackView", function() {
var openURLStub, getLoopPrefStub, feedbackReceivedStub;
var fakeURL = "fake.form", mozLoop, view;
var fakeURL = "fake.form", view;
function mountTestComponent(props) {
props = _.extend({

View File

@ -493,7 +493,7 @@ describe("loop.store.RoomStore", function() {
sinon.assert.calledOnce(sharedUtils.composeCallUrlEmail);
sinon.assert.calledWith(sharedUtils.composeCallUrlEmail,
"http://invalid", null, undefined, "conversation");
"http://invalid", null, undefined);
});
it("should call composeUrlEmail differently with context", function() {
@ -509,7 +509,7 @@ describe("loop.store.RoomStore", function() {
sinon.assert.calledOnce(sharedUtils.composeCallUrlEmail);
sinon.assert.calledWithExactly(sharedUtils.composeCallUrlEmail,
url, null, description, "conversation");
url, null, description);
});
});

View File

@ -6,7 +6,7 @@ describe("loop.crypto", function() {
"use strict";
var expect = chai.expect;
var sandbox, oldCrypto;
var sandbox;
beforeEach(function() {
sandbox = sinon.sandbox.create();

View File

@ -118,7 +118,6 @@ describe("loop.shared.views.LinkifiedTextView", function() {
it("should cause sendReferrer and suppressTarget props to be ignored",
function() {
var fakeUrl = "http://example.com";
var linkClickHandler = function() {};
var markup = renderToMarkup("http://example.com", {

View File

@ -144,7 +144,7 @@ describe("loop.shared.mixins", function() {
});
describe("loop.shared.mixins.DocumentVisibilityMixin", function() {
var comp, TestComp, onDocumentVisibleStub, onDocumentHiddenStub;
var TestComp, onDocumentVisibleStub, onDocumentHiddenStub;
beforeEach(function() {
onDocumentVisibleStub = sandbox.stub();
@ -175,7 +175,7 @@ describe("loop.shared.mixins", function() {
function() {
setupFakeVisibilityEventDispatcher({ target: { hidden: false } });
comp = TestUtils.renderIntoDocument(React.createElement(TestComp));
TestUtils.renderIntoDocument(React.createElement(TestComp));
// Twice, because it's also called when the component was mounted.
sinon.assert.calledTwice(onDocumentVisibleStub);
@ -185,7 +185,7 @@ describe("loop.shared.mixins", function() {
function() {
setupFakeVisibilityEventDispatcher({ target: { hidden: true } });
comp = TestUtils.renderIntoDocument(React.createElement(TestComp));
TestUtils.renderIntoDocument(React.createElement(TestComp));
sinon.assert.calledOnce(onDocumentHiddenStub);
});
@ -221,7 +221,7 @@ describe("loop.shared.mixins", function() {
});
describe("loop.shared.mixins.AudioMixin", function() {
var view, fakeAudio, getAudioBlobStub, TestComp;
var TestComp, getAudioBlobStub, fakeAudio;
beforeEach(function() {
getAudioBlobStub = sinon.stub().returns(
@ -256,7 +256,7 @@ describe("loop.shared.mixins", function() {
});
it("should not play a failure sound when doNotDisturb true", function() {
view = TestUtils.renderIntoDocument(React.createElement(TestComp));
TestUtils.renderIntoDocument(React.createElement(TestComp));
sinon.assert.notCalled(getAudioBlobStub);
sinon.assert.notCalled(fakeAudio.play);
});
@ -265,7 +265,7 @@ describe("loop.shared.mixins", function() {
LoopMochaUtils.stubLoopRequest({
GetDoNotDisturb: function() { return false; }
});
view = TestUtils.renderIntoDocument(React.createElement(TestComp));
TestUtils.renderIntoDocument(React.createElement(TestComp));
sinon.assert.calledOnce(getAudioBlobStub);
sinon.assert.calledWithExactly(getAudioBlobStub, "failure");
sinon.assert.calledOnce(fakeAudio.play);
@ -274,7 +274,7 @@ describe("loop.shared.mixins", function() {
});
describe("loop.shared.mixins.RoomsAudioMixin", function() {
var view, fakeAudioMixin, comp;
var comp;
function createTestComponent(initialState) {
var TestComp = React.createClass({

View File

@ -19,15 +19,13 @@ describe("loop.shared.models", function() {
});
describe("NotificationCollection", function() {
var collection, notifData, testNotif;
var collection;
beforeEach(function() {
collection = new sharedModels.NotificationCollection();
sandbox.stub(l10n, "get", function(x, y) {
return "translated:" + x + (y ? ":" + y : "");
});
notifData = { level: "error", message: "plop" };
testNotif = new sharedModels.NotificationModel(notifData);
});
describe("#warn", function() {

View File

@ -751,8 +751,7 @@ describe("loop.OTSdkDriver", function() {
});
describe("Events: general media", function() {
var fakeConnection, fakeStream, fakeSubscriberObject,
fakeSdkContainerWithVideo, videoElement;
var fakeConnection, fakeStream, fakeSubscriberObject, videoElement;
beforeEach(function() {
fakeConnection = "fakeConnection";
@ -770,10 +769,6 @@ describe("loop.OTSdkDriver", function() {
stream: fakeStream
}, Backbone.Events);
fakeSdkContainerWithVideo = {
querySelector: sinon.stub().returns(videoElement)
};
// use a real video element so that these tests correctly reflect
// test behavior when run in firefox or chrome
videoElement = document.createElement("video");
@ -1826,18 +1821,12 @@ describe("loop.OTSdkDriver", function() {
});
describe("Events: screenshare:", function() {
var videoElement;
beforeEach(function() {
driver.connectSession(sessionData);
driver.startScreenShare({
videoSource: "window"
});
// use a real video element so that these tests correctly reflect
// code behavior when run in whatever browser
videoElement = document.createElement("video");
});
describe("accessAllowed", function() {

View File

@ -6,7 +6,6 @@ describe("loop.store.StandaloneAppStore", function() {
var expect = chai.expect;
var sharedActions = loop.shared.actions;
var sharedUtils = loop.shared.utils;
var sandbox, dispatcher;
beforeEach(function() {

View File

@ -5,7 +5,6 @@
describe("loop.store.StandaloneMetricsStore", function() {
"use strict";
var expect = chai.expect;
var sandbox, dispatcher, store, fakeActiveRoomStore;
var sharedActions = loop.shared.actions;

View File

@ -73,7 +73,7 @@ describe("loop.webapp", function() {
});
describe("WebappRootView", function() {
var sdk, conversationModel, client, props, standaloneAppStore;
var sdk, standaloneAppStore;
var activeRoomStore;
function mountTestComponent() {
@ -160,7 +160,7 @@ describe("loop.webapp", function() {
});
it("should render when not using Firefox", function() {
var comp = TestUtils.renderIntoDocument(
TestUtils.renderIntoDocument(
React.createElement(loop.webapp.PromoteFirefoxView, {
isFirefox: false
}));

View File

@ -121,7 +121,7 @@ add_test(function test_reconnect_no_registration() {
add_test(function test_ping_websocket() {
let pingReceived = false,
socketClosed = false;
mockWebSocket.defaultMsgHandler = (msg) => {
mockWebSocket.defaultMsgHandler = () => {
pingReceived = true;
// Do not send a ping response.
};
@ -133,7 +133,7 @@ add_test(function test_ping_websocket() {
MozLoopPushHandler.initialize({ mockWebSocket: mockWebSocket });
MozLoopPushHandler.register(
"test-chan",
function(err, url) {
function(err) {
Assert.equal(err, null, "err should be null to indicate success");
waitForCondition(() => pingReceived).then(() => {
waitForCondition(() => socketClosed).then(() => {

View File

@ -57,7 +57,7 @@ add_test(function test_register_success() {
});
MozLoopService.promiseRegisteredWithServers().then(() => {
run_next_test();
}, err => {
}, () => {
do_throw("shouldn't error on a successful request");
});
});

View File

@ -35,7 +35,7 @@ add_test(function test_retry_after_failed_push_reg() {
yield deferredRegistrations.get(LOOP_SESSION_TYPE.GUEST).then(() => {
Assert.ok(true, "The retry of registration succeeded");
},
(error) => {
() => {
Assert.ok(false, "The retry of registration should have succeeded");
});

View File

@ -23,8 +23,6 @@ const LOOP_INITIAL_DELAY_PREF = "loop.initialDelay";
*/
add_task(function* test_initialize_with_no_guest_rooms_and_no_auth_token() {
// Set time to be 2 seconds in the past.
var nowSeconds = Date.now() / 1000;
Services.prefs.setBoolPref(LOOP_CREATED_ROOM_PREF, false);
Services.prefs.clearUserPref(LOOP_FXA_TOKEN_PREF);
@ -73,7 +71,7 @@ add_task(function* test_initialize_with_invalid_fxa_token() {
yield MozLoopService.initialize().then(() => {
Assert.ok(false, "Initializing with an invalid token should reject the promise");
},
(error) => {
() => {
Assert.equal(MozLoopServiceInternal.pushHandler.registrationPushURL, kEndPointUrl, "Push URL should match");
Assert.equal(Services.prefs.getCharPref(LOOP_FXA_TOKEN_PREF), "",
"FXA pref should be cleared if token was invalid");

View File

@ -29,7 +29,7 @@ add_test(function test_registration_returns_hawk_session_token() {
" Hawk-Session-Token header contents in loop.hawk-session-token pref");
run_next_test();
}, err => {
}, () => {
do_throw("shouldn't error on a successful request");
});
});

View File

@ -28,7 +28,7 @@ add_test(function test_registration_uses_hawk_session_token() {
MozLoopService.promiseRegisteredWithServers().then(() => {
run_next_test();
}, err => {
}, () => {
do_throw("shouldn't error on a succesful request");
});
});