Merge fx-team to central, a=merge

This commit is contained in:
Wes Kocher 2015-10-22 16:45:45 -07:00
commit 872e4742b4
125 changed files with 2625 additions and 809 deletions

View File

@ -367,6 +367,12 @@ Site.prototype = {
else if (button == 0) {
aEvent.preventDefault();
if (target.classList.contains("newtab-control-block")) {
// Notify DirectoryLinksProvider of suggested tile block, this may
// affect if and how suggested tiles are recommended and needs to
// be reported before pages are updated inside block() call
if (this.link.targetedSite) {
DirectoryLinksProvider.handleSuggestedTileBlock();
}
this.block();
action = "block";
}

View File

@ -2,7 +2,14 @@ XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
"@mozilla.org/browser/aboutnewtab-service;1",
"nsIAboutNewTabService");
XPCOMUtils.defineLazyModuleGetter(this, "MatchPattern",
"resource://gre/modules/MatchPattern.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ExtensionUtils.jsm");
var {
EventManager,
ignoreEvent,
@ -381,8 +388,13 @@ extensions.registerAPI((extension, context) => {
queryInfo = {};
}
let pattern = null;
if (queryInfo.url) {
pattern = new MatchPattern(queryInfo.url);
}
function matches(window, tab) {
let props = ["active", "pinned", "highlighted", "status", "title", "url", "index"];
let props = ["active", "pinned", "highlighted", "status", "title", "index"];
for (let prop of props) {
if (prop in queryInfo && queryInfo[prop] != tab[prop]) {
return false;
@ -418,6 +430,10 @@ extensions.registerAPI((extension, context) => {
}
}
if (pattern && !pattern.matches(Services.io.newURI(tab.url, null, null))) {
return false;
}
return true;
}

View File

@ -45,4 +45,88 @@ add_task(function* () {
yield BrowserTestUtils.removeTab(tab1);
yield BrowserTestUtils.removeTab(tab2);
tab1 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
tab2 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.net/");
let tab3 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://test1.example.org/MochiKit/");
// test simple queries
extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
},
background: function() {
browser.tabs.query({
url: "<all_urls>"
}, function(tabs) {
browser.test.assertEq(tabs.length, 3, "should have three tabs");
tabs.sort(function (tab1, tab2) { return tab1.index - tab2.index; });
browser.test.assertEq(tabs[0].url, "http://example.com/", "tab 0 url correct");
browser.test.assertEq(tabs[1].url, "http://example.net/", "tab 1 url correct");
browser.test.assertEq(tabs[2].url, "http://test1.example.org/MochiKit/", "tab 2 url correct");
browser.test.notifyPass("tabs.query");
});
},
});
yield extension.startup();
yield extension.awaitFinish("tabs.query");
yield extension.unload();
// match pattern
extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
},
background: function() {
browser.tabs.query({
url: "http://*/MochiKit*"
}, function(tabs) {
browser.test.assertEq(tabs.length, 1, "should have one tab");
browser.test.assertEq(tabs[0].url, "http://test1.example.org/MochiKit/", "tab 0 url correct");
browser.test.notifyPass("tabs.query");
});
},
});
yield extension.startup();
yield extension.awaitFinish("tabs.query");
yield extension.unload();
// match array of patterns
extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"]
},
background: function() {
browser.tabs.query({
url: ["http://*/MochiKit*", "http://*.com/*"]
}, function(tabs) {
browser.test.assertEq(tabs.length, 2, "should have two tabs");
tabs.sort(function (tab1, tab2) { return tab1.index - tab2.index; });
browser.test.assertEq(tabs[0].url, "http://example.com/", "tab 0 url correct");
browser.test.assertEq(tabs[1].url, "http://test1.example.org/MochiKit/", "tab 1 url correct");
browser.test.notifyPass("tabs.query");
});
},
});
yield extension.startup();
yield extension.awaitFinish("tabs.query");
yield extension.unload();
yield BrowserTestUtils.removeTab(tab1);
yield BrowserTestUtils.removeTab(tab2);
yield BrowserTestUtils.removeTab(tab3);
});

View File

@ -34,12 +34,14 @@
// problems they find, one at a time.
// Eslint built-in rules are documented at <http://eslint.org/docs/rules/>
"array-bracket-spacing": [2, "never"],
"block-spacing": [2, "always"],
"callback-return": 0, // TBD
"camelcase": 0, // TODO: set to 2
"comma-spacing": 2,
"comma-style": 2,
"computed-property-spacing": [2, "never"],
"consistent-return": 0, // TODO: set to 2
"consistent-return": 2,
"curly": [2, "all"],
"dot-location": [2, "property"],
"eol-last": 2,
@ -52,7 +54,7 @@
"no-alert": 2,
"no-array-constructor": 2,
"no-caller": 2,
"no-catch-shadow": 0, // TODO: set to 2
"no-catch-shadow": 2,
"no-class-assign": 2,
"no-const-assign": 2,
"no-console": 0, // Leave as 0. We use console logging in content code.
@ -62,6 +64,7 @@
"no-extend-native": 2, // XXX
"no-extra-bind": 0, // Leave as 0
"no-extra-parens": 0, // TODO: (bug?) [2, "functions"],
"no-extra-semi": 2,
"no-implied-eval": 2,
"no-invalid-this": 0, // TBD
"no-iterator": 2,
@ -69,8 +72,10 @@
"no-labels": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-multi-spaces": 0, // TBD.
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": 2,
"no-native-reassign": 2,
"no-new": 2,
"no-new-func": 2,
@ -95,11 +100,17 @@
"no-use-before-define": 0, // TODO: Set to 2
"no-useless-call": 2,
"no-with": 2,
"object-curly-spacing": 0, // [2, "always"],
"object-curly-spacing": [2, "always"],
"operator-assignment": [2, "always"],
"quotes": [2, "double", "avoid-escape"],
"semi": 2,
"semi-spacing": [2, {"before": false, "after": true}],
"space-after-keywords": 2,
"space-before-blocks": 2,
"space-before-function-paren": [2, "never"],
"space-before-keywords": 2,
"space-infix-ops": 2,
"space-in-parens": [2, "never"],
"space-return-throw-case": 2,
"space-unary-ops": [2, {"words": true, "nonwords": false}],
"spaced-comment": [2, "always"],
@ -112,16 +123,13 @@
"react/jsx-sort-prop-types": 2,
"react/jsx-uses-vars": 2,
"react/jsx-no-duplicate-props": 2,
// Need to fix the couple of instances which don't
// currently pass this rule.
"react/no-did-mount-set-state": 0,
"react/no-did-mount-set-state": 2,
"react/no-did-update-set-state": 2,
"react/no-unknown-property": 2,
"react/prop-types": 2,
"react/self-closing-comp": 2,
"react/wrap-multilines": 2,
// We would probably want to go with a variant of never.
"react/jsx-curly-spacing": 0,
"react/jsx-curly-spacing": [2, "never"],
// Not worth it: React is defined globally
"react/jsx-uses-react": 0,
"react/react-in-jsx-scope": 0,

View File

@ -67,7 +67,7 @@ loop.conversation = (function(mozL10n) {
return this._renderFeedbackForm();
}
switch(this.state.windowType) {
switch (this.state.windowType) {
case "room": {
return (React.createElement(DesktopRoomConversationView, {
chatWindowDetached: this.state.chatWindowDetached,

View File

@ -67,7 +67,7 @@ loop.conversation = (function(mozL10n) {
return this._renderFeedbackForm();
}
switch(this.state.windowType) {
switch (this.state.windowType) {
case "room": {
return (<DesktopRoomConversationView
chatWindowDetached={this.state.chatWindowDetached}

View File

@ -107,14 +107,14 @@ loop.store.ConversationAppStore = (function() {
if (!windowData) {
console.error("Failed to get the window data");
this.setStoreState({windowType: "failed"});
this.setStoreState({ windowType: "failed" });
return;
}
this.setStoreState({windowType: windowData.type});
this.setStoreState({ windowType: windowData.type });
this._dispatcher.dispatch(new loop.shared.actions.SetupWindowData(_.extend({
windowId: actionData.windowId}, windowData)));
windowId: actionData.windowId }, windowData)));
},
/**

View File

@ -142,7 +142,7 @@ loop.panel = (function(_, mozL10n) {
mozL10n.get("powered_by_afterLogo")
),
React.createElement("p", {className: "terms-service",
dangerouslySetInnerHTML: {__html: tosHTML},
dangerouslySetInnerHTML: { __html: tosHTML},
onClick: this.handleLinkClick})
)
);
@ -161,7 +161,7 @@ loop.panel = (function(_, mozL10n) {
},
getDefaultProps: function() {
return {displayed: true};
return { displayed: true };
},
render: function() {
@ -257,7 +257,7 @@ loop.panel = (function(_, mozL10n) {
onClick: this.toggleDropdownMenu,
ref: "menu-button",
title: mozL10n.get("settings_menu_button_tooltip")}),
React.createElement("ul", {className: cx({"dropdown-menu": true, hide: !this.state.showMenu})},
React.createElement("ul", {className: cx({ "dropdown-menu": true, hide: !this.state.showMenu })},
React.createElement(SettingsDropdownEntry, {
extraCSSClass: "entry-settings-notifications entries-divider",
label: mozL10n.get(notificationsLabel),
@ -859,9 +859,9 @@ loop.panel = (function(_, mozL10n) {
var newUid = profile ? profile.uid : null;
if (currUid === newUid) {
// Update the state of hasEncryptionKey as this might have changed now.
this.setState({hasEncryptionKey: this.props.mozLoop.hasEncryptionKey});
this.setState({ hasEncryptionKey: this.props.mozLoop.hasEncryptionKey });
} else {
this.setState({userProfile: profile});
this.setState({ userProfile: profile });
}
this.updateServiceErrors();
},

View File

@ -142,7 +142,7 @@ loop.panel = (function(_, mozL10n) {
{mozL10n.get("powered_by_afterLogo")}
</p>
<p className="terms-service"
dangerouslySetInnerHTML={{__html: tosHTML}}
dangerouslySetInnerHTML={{ __html: tosHTML }}
onClick={this.handleLinkClick}></p>
</div>
);
@ -161,7 +161,7 @@ loop.panel = (function(_, mozL10n) {
},
getDefaultProps: function() {
return {displayed: true};
return { displayed: true };
},
render: function() {
@ -257,7 +257,7 @@ loop.panel = (function(_, mozL10n) {
onClick={this.toggleDropdownMenu}
ref="menu-button"
title={mozL10n.get("settings_menu_button_tooltip")} />
<ul className={cx({"dropdown-menu": true, hide: !this.state.showMenu})}>
<ul className={cx({ "dropdown-menu": true, hide: !this.state.showMenu })}>
<SettingsDropdownEntry
extraCSSClass="entry-settings-notifications entries-divider"
label={mozL10n.get(notificationsLabel)}
@ -859,9 +859,9 @@ loop.panel = (function(_, mozL10n) {
var newUid = profile ? profile.uid : null;
if (currUid === newUid) {
// Update the state of hasEncryptionKey as this might have changed now.
this.setState({hasEncryptionKey: this.props.mozLoop.hasEncryptionKey});
this.setState({ hasEncryptionKey: this.props.mozLoop.hasEncryptionKey });
} else {
this.setState({userProfile: profile});
this.setState({ userProfile: profile });
}
this.updateServiceErrors();
},

View File

@ -135,7 +135,7 @@ loop.store = loop.store || {};
* Updates active room store state.
*/
_onActiveRoomStoreChange: function() {
this.setStoreState({activeRoom: this.activeRoomStore.getStoreState()});
this.setStoreState({ activeRoom: this.activeRoomStore.getStoreState() });
},
/**
@ -277,7 +277,7 @@ loop.store = loop.store || {};
var buckets = this._mozLoop.ROOM_CREATE;
if (err) {
this._mozLoop.telemetryAddValue("LOOP_ROOM_CREATE", buckets.CREATE_FAIL);
this.dispatchAction(new sharedActions.CreateRoomError({error: err}));
this.dispatchAction(new sharedActions.CreateRoomError({ error: err }));
return;
}
@ -301,7 +301,7 @@ loop.store = loop.store || {};
* Executed when a room has been created
*/
createdRoom: function(actionData) {
this.setStoreState({pendingCreation: false});
this.setStoreState({ pendingCreation: false });
// Opens the newly created room
this.dispatchAction(new sharedActions.OpenRoom({
@ -406,7 +406,7 @@ loop.store = loop.store || {};
this._mozLoop.rooms.delete(actionData.roomToken, function(err) {
var buckets = this._mozLoop.ROOM_DELETE;
if (err) {
this.dispatchAction(new sharedActions.DeleteRoomError({error: err}));
this.dispatchAction(new sharedActions.DeleteRoomError({ error: err }));
}
this._mozLoop.telemetryAddValue("LOOP_ROOM_DELETE", buckets[err ?
"DELETE_FAIL" : "DELETE_SUCCESS"]);
@ -419,7 +419,7 @@ loop.store = loop.store || {};
* @param {sharedActions.DeleteRoomError} actionData The action data.
*/
deleteRoomError: function(actionData) {
this.setStoreState({error: actionData.error});
this.setStoreState({ error: actionData.error });
},
/**
@ -429,12 +429,12 @@ loop.store = loop.store || {};
this._mozLoop.rooms.getAll(null, function(err, rawRoomList) {
var action;
this.setStoreState({pendingInitialRetrieval: false});
this.setStoreState({ pendingInitialRetrieval: false });
if (err) {
action = new sharedActions.GetAllRoomsError({error: err});
action = new sharedActions.GetAllRoomsError({ error: err });
} else {
action = new sharedActions.UpdateRoomList({roomList: rawRoomList});
action = new sharedActions.UpdateRoomList({ roomList: rawRoomList });
}
this.dispatchAction(action);
@ -451,7 +451,7 @@ loop.store = loop.store || {};
* @param {sharedActions.GetAllRoomsError} actionData The action data.
*/
getAllRoomsError: function(actionData) {
this.setStoreState({error: actionData.error});
this.setStoreState({ error: actionData.error });
},
/**
@ -517,7 +517,7 @@ loop.store = loop.store || {};
var isValidURL = false;
try {
isValidURL = new URL(newRoomURL.location);
} catch(ex) {
} catch (ex) {
// URL may throw, default to false;
}
if (isValidURL) {
@ -541,7 +541,7 @@ loop.store = loop.store || {};
var hadContextBefore = !!oldRoomURL;
this.setStoreState({error: null});
this.setStoreState({ error: null });
this._mozLoop.rooms.update(actionData.roomToken, roomData,
function(error, data) {
var action = error ?

View File

@ -52,7 +52,7 @@ loop.roomViews = (function(mozL10n) {
// stopListening doesn't nuke the active listeners during a event
// processing.
if (this.isMounted()) {
this.setState({error: this.props.roomStore.getStoreState("error")});
this.setState({ error: this.props.roomStore.getStoreState("error") });
}
},
@ -61,7 +61,7 @@ loop.roomViews = (function(mozL10n) {
// stopListening doesn't nuke the active listeners during a event
// processing.
if (this.isMounted()) {
this.setState({savingContext: this.props.roomStore.getStoreState("savingContext")});
this.setState({ savingContext: this.props.roomStore.getStoreState("savingContext") });
}
},
@ -117,7 +117,7 @@ loop.roomViews = (function(mozL10n) {
* Something went wrong view. Displayed when there's a big problem.
*/
var RoomFailureView = React.createClass({displayName: "RoomFailureView",
mixins: [ sharedMixins.AudioMixin ],
mixins: [sharedMixins.AudioMixin],
propTypes: {
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
@ -284,7 +284,7 @@ loop.roomViews = (function(mozL10n) {
from: "conversation"
}));
this.setState({copiedUrl: true});
this.setState({ copiedUrl: true });
setTimeout(this.resetTriggeredButtons, this.constructor.TRIGGERED_RESET_DELAY);
},
@ -293,7 +293,7 @@ loop.roomViews = (function(mozL10n) {
*/
resetTriggeredButtons: function() {
if (this.state.copiedUrl) {
this.setState({copiedUrl: false});
this.setState({ copiedUrl: false });
}
},
@ -326,7 +326,7 @@ loop.roomViews = (function(mozL10n) {
return (
React.createElement("div", {className: "room-invitation-overlay"},
React.createElement("div", {className: "room-invitation-content"},
React.createElement("p", {className: cx({hide: this.props.showEditContext})},
React.createElement("p", {className: cx({ hide: this.props.showEditContext })},
mozL10n.get("invite_header_text2")
)
),
@ -542,8 +542,8 @@ loop.roomViews = (function(mozL10n) {
var availableContext = this.state.availableContext;
return (
React.createElement("div", {className: "room-context"},
React.createElement("p", {className: cx({"error": !!this.props.error,
"error-display-area": true})},
React.createElement("p", {className: cx({ "error": !!this.props.error,
"error-display-area": true })},
mozL10n.get("rooms_change_failed_label")
),
React.createElement("h2", {className: "room-context-header"}, mozL10n.get("context_inroom_header")),
@ -674,7 +674,7 @@ loop.roomViews = (function(mozL10n) {
* that returns an enum
*/
shouldRenderRemoteVideo: function() {
switch(this.state.roomState) {
switch (this.state.roomState) {
case ROOM_STATES.HAS_PARTICIPANTS:
if (this.state.remoteVideoEnabled) {
return true;
@ -716,7 +716,7 @@ loop.roomViews = (function(mozL10n) {
* @returns {boolean}
* @private
*/
_isLocalLoading: function () {
_isLocalLoading: function() {
return this.state.roomState === ROOM_STATES.MEDIA_WAIT &&
!this.state.localSrcMediaElement;
},
@ -768,7 +768,7 @@ loop.roomViews = (function(mozL10n) {
var shouldRenderEditContextView = this.state.showEditContext;
var roomData = this.props.roomStore.getStoreState("activeRoom");
switch(this.state.roomState) {
switch (this.state.roomState) {
case ROOM_STATES.FAILED:
case ROOM_STATES.FULL: {
// Note: While rooms are set to hold a maximum of 2 participants, the
@ -815,7 +815,7 @@ loop.roomViews = (function(mozL10n) {
showContextRoomName: false,
useDesktopPaths: true},
React.createElement(sharedViews.ConversationToolbar, {
audio: {enabled: !this.state.audioMuted, visible: true},
audio: { enabled: !this.state.audioMuted, visible: true},
dispatcher: this.props.dispatcher,
hangup: this.leaveRoom,
mozLoop: this.props.mozLoop,
@ -824,7 +824,7 @@ loop.roomViews = (function(mozL10n) {
settingsMenuItems: settingsMenuItems,
show: !shouldRenderEditContextView,
showHangup: this.props.chatWindowDetached,
video: {enabled: !this.state.videoMuted, visible: true}}),
video: { enabled: !this.state.videoMuted, visible: true}}),
React.createElement(DesktopRoomInvitationView, {
dispatcher: this.props.dispatcher,
error: this.state.error,

View File

@ -52,7 +52,7 @@ loop.roomViews = (function(mozL10n) {
// stopListening doesn't nuke the active listeners during a event
// processing.
if (this.isMounted()) {
this.setState({error: this.props.roomStore.getStoreState("error")});
this.setState({ error: this.props.roomStore.getStoreState("error") });
}
},
@ -61,7 +61,7 @@ loop.roomViews = (function(mozL10n) {
// stopListening doesn't nuke the active listeners during a event
// processing.
if (this.isMounted()) {
this.setState({savingContext: this.props.roomStore.getStoreState("savingContext")});
this.setState({ savingContext: this.props.roomStore.getStoreState("savingContext") });
}
},
@ -117,7 +117,7 @@ loop.roomViews = (function(mozL10n) {
* Something went wrong view. Displayed when there's a big problem.
*/
var RoomFailureView = React.createClass({
mixins: [ sharedMixins.AudioMixin ],
mixins: [sharedMixins.AudioMixin],
propTypes: {
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
@ -284,7 +284,7 @@ loop.roomViews = (function(mozL10n) {
from: "conversation"
}));
this.setState({copiedUrl: true});
this.setState({ copiedUrl: true });
setTimeout(this.resetTriggeredButtons, this.constructor.TRIGGERED_RESET_DELAY);
},
@ -293,7 +293,7 @@ loop.roomViews = (function(mozL10n) {
*/
resetTriggeredButtons: function() {
if (this.state.copiedUrl) {
this.setState({copiedUrl: false});
this.setState({ copiedUrl: false });
}
},
@ -326,7 +326,7 @@ loop.roomViews = (function(mozL10n) {
return (
<div className="room-invitation-overlay">
<div className="room-invitation-content">
<p className={cx({hide: this.props.showEditContext})}>
<p className={cx({ hide: this.props.showEditContext })}>
{mozL10n.get("invite_header_text2")}
</p>
</div>
@ -542,8 +542,8 @@ loop.roomViews = (function(mozL10n) {
var availableContext = this.state.availableContext;
return (
<div className="room-context">
<p className={cx({"error": !!this.props.error,
"error-display-area": true})}>
<p className={cx({ "error": !!this.props.error,
"error-display-area": true })}>
{mozL10n.get("rooms_change_failed_label")}
</p>
<h2 className="room-context-header">{mozL10n.get("context_inroom_header")}</h2>
@ -674,7 +674,7 @@ loop.roomViews = (function(mozL10n) {
* that returns an enum
*/
shouldRenderRemoteVideo: function() {
switch(this.state.roomState) {
switch (this.state.roomState) {
case ROOM_STATES.HAS_PARTICIPANTS:
if (this.state.remoteVideoEnabled) {
return true;
@ -716,7 +716,7 @@ loop.roomViews = (function(mozL10n) {
* @returns {boolean}
* @private
*/
_isLocalLoading: function () {
_isLocalLoading: function() {
return this.state.roomState === ROOM_STATES.MEDIA_WAIT &&
!this.state.localSrcMediaElement;
},
@ -768,7 +768,7 @@ loop.roomViews = (function(mozL10n) {
var shouldRenderEditContextView = this.state.showEditContext;
var roomData = this.props.roomStore.getStoreState("activeRoom");
switch(this.state.roomState) {
switch (this.state.roomState) {
case ROOM_STATES.FAILED:
case ROOM_STATES.FULL: {
// Note: While rooms are set to hold a maximum of 2 participants, the
@ -815,7 +815,7 @@ loop.roomViews = (function(mozL10n) {
showContextRoomName={false}
useDesktopPaths={true}>
<sharedViews.ConversationToolbar
audio={{enabled: !this.state.audioMuted, visible: true}}
audio={{ enabled: !this.state.audioMuted, visible: true }}
dispatcher={this.props.dispatcher}
hangup={this.leaveRoom}
mozLoop={this.props.mozLoop}
@ -824,7 +824,7 @@ loop.roomViews = (function(mozL10n) {
settingsMenuItems={settingsMenuItems}
show={!shouldRenderEditContextView}
showHangup={this.props.chatWindowDetached}
video={{enabled: !this.state.videoMuted, visible: true}} />
video={{ enabled: !this.state.videoMuted, visible: true }} />
<DesktopRoomInvitationView
dispatcher={this.props.dispatcher}
error={this.state.error}

View File

@ -350,7 +350,7 @@ loop.store.ActiveRoomStore = (function() {
fetchServerData: function(actionData) {
if (actionData.windowType !== "room") {
// Nothing for us to do here, leave it to other stores.
return;
return Promise.resolve();
}
this.setStoreState({
@ -596,7 +596,7 @@ loop.store.ActiveRoomStore = (function() {
if (hasDevices) {
// MEDIA_WAIT causes the views to dispatch sharedActions.SetupStreamElements,
// which in turn starts the sdk obtaining the device permission.
this.setStoreState({roomState: ROOM_STATES.MEDIA_WAIT});
this.setStoreState({ roomState: ROOM_STATES.MEDIA_WAIT });
} else {
this.dispatchAction(new sharedActions.ConnectionFailure({
reason: FAILURE_DETAILS.NO_MEDIA
@ -687,7 +687,7 @@ loop.store.ActiveRoomStore = (function() {
* granted and starts joining the room.
*/
gotMediaPermission: function() {
this.setStoreState({roomState: ROOM_STATES.JOINING});
this.setStoreState({ roomState: ROOM_STATES.JOINING });
this._mozLoop.rooms.join(this._storeState.roomToken,
function(error, responseData) {
@ -841,14 +841,14 @@ loop.store.ActiveRoomStore = (function() {
* Records when the remote media has been connected.
*/
mediaConnected: function() {
this.setStoreState({mediaConnected: true});
this.setStoreState({ mediaConnected: true });
},
/**
* Used to note the current screensharing state.
*/
screenSharingState: function(actionData) {
this.setStoreState({screenSharingState: actionData.state});
this.setStoreState({ screenSharingState: actionData.state });
this._mozLoop.setScreenShareState(
this.getStoreState().windowId,
@ -1119,7 +1119,7 @@ loop.store.ActiveRoomStore = (function() {
this._storeState.sessionToken);
}
this.setStoreState({roomState: nextState});
this.setStoreState({ roomState: nextState });
},
/**

View File

@ -68,7 +68,7 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
return new Promise(function(resolve, reject) {
// First get a crypto key.
rootObject.crypto.subtle.generateKey({name: ALGORITHM, length: KEY_LENGTH },
rootObject.crypto.subtle.generateKey({ name: ALGORITHM, length: KEY_LENGTH },
// `true` means that the key can be extracted from the CryptoKey object.
true,
// Usages for the key.
@ -105,7 +105,7 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
return new Promise(function(resolve, reject) {
// First import the key to a format we can use.
rootObject.crypto.subtle.importKey(KEY_FORMAT,
{k: key, kty: KEY_TYPE},
{ k: key, kty: KEY_TYPE },
ALGORITHM,
// If the key is extractable.
true,
@ -158,7 +158,7 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
return new Promise(function(resolve, reject) {
// First import the key to a format we can use.
rootObject.crypto.subtle.importKey(KEY_FORMAT,
{k: key, kty: KEY_TYPE},
{ k: key, kty: KEY_TYPE },
ALGORITHM,
// If the key is extractable.
true,

View File

@ -104,8 +104,10 @@ loop.shared.views.LinkifiedTextView = (function(mozL10n) {
return elements;
},
render: function () {
return ( React.createElement("p", null, this.parseStringToElements(this.props.rawText) ) );
render: function() {
return (
React.createElement("p", null, this.parseStringToElements(this.props.rawText))
);
}
});

View File

@ -104,8 +104,10 @@ loop.shared.views.LinkifiedTextView = (function(mozL10n) {
return elements;
},
render: function () {
return ( <p>{ this.parseStringToElements(this.props.rawText) }</p> );
render: function() {
return (
<p>{this.parseStringToElements(this.props.rawText)}</p>
);
}
});

View File

@ -227,7 +227,7 @@ loop.shared.mixins = (function() {
// amount.
y += menuNodeRect.height - (boundingRect.height + y);
}
menu.style.marginTop = y + "px";
menu.style.marginTop = y + "px";
} else if (!menu.style.marginLeft) {
menu.style.marginTop = "auto";
}
@ -251,11 +251,11 @@ loop.shared.mixins = (function() {
},
showDropdownMenu: function() {
this.setState({showMenu: true}, this._correctMenuPosition);
this.setState({ showMenu: true }, this._correctMenuPosition);
},
hideDropdownMenu: function() {
this.setState({showMenu: false}, function() {
this.setState({ showMenu: false }, function() {
var menu = this.refs.menu && this.refs.menu.getDOMNode();
if (menu) {
menu.style.visibility = "hidden";
@ -399,7 +399,7 @@ loop.shared.mixins = (function() {
}
var type = request.getResponseHeader("Content-Type");
var blob = new Blob([request.response], {type: type});
var blob = new Blob([request.response], { type: type });
callback(null, blob);
}.bind(this);

View File

@ -32,7 +32,7 @@ loop.shared.models = (function(l10n) {
* @return {String} message
*/
warn: function(message) {
this.add({level: "warning", message: message});
this.add({ level: "warning", message: message });
},
/**
@ -50,7 +50,7 @@ loop.shared.models = (function(l10n) {
* @return {String} message
*/
error: function(message) {
this.add({level: "error", message: message});
this.add({ level: "error", message: message });
},
/**
@ -71,7 +71,7 @@ loop.shared.models = (function(l10n) {
* @return {String} message
*/
success: function(message) {
this.add({level: "success", message: message});
this.add({ level: "success", message: message });
},
/**

View File

@ -69,10 +69,10 @@ loop.OTSdkDriver = (function() {
var result = [];
devices.forEach(function(device) {
if (device.kind === "audioinput") {
result.push({kind: "audio"});
result.push({ kind: "audio" });
}
if (device.kind === "videoinput") {
result.push({kind: "video"});
result.push({ kind: "video" });
}
});
callback(result);

View File

@ -41,8 +41,8 @@ loop.shared.views.chat = (function(mozL10n) {
return (
React.createElement("span", {className: "text-chat-entry-timestamp"},
date.toLocaleTimeString(language,
{hour: "numeric", minute: "numeric",
hour12: false})
{ hour: "numeric", minute: "numeric",
hour12: false })
)
);
},
@ -82,7 +82,7 @@ loop.shared.views.chat = (function(mozL10n) {
render: function() {
return (
React.createElement("div", {className: "text-chat-header special room-name"},
React.createElement("p", null, mozL10n.get("rooms_welcome_title", {conversationName: this.props.message}))
React.createElement("p", null, mozL10n.get("rooms_welcome_title", { conversationName: this.props.message }))
)
);
}
@ -140,7 +140,7 @@ loop.shared.views.chat = (function(mozL10n) {
// If the number of received messages has increased, we play a sound.
if (receivedMessageCount > this.state.receivedMessageCount) {
this.play("message");
this.setState({receivedMessageCount: receivedMessageCount});
this.setState({ receivedMessageCount: receivedMessageCount });
}
},

View File

@ -41,8 +41,8 @@ loop.shared.views.chat = (function(mozL10n) {
return (
<span className="text-chat-entry-timestamp">
{date.toLocaleTimeString(language,
{hour: "numeric", minute: "numeric",
hour12: false})}
{ hour: "numeric", minute: "numeric",
hour12: false })}
</span>
);
},
@ -82,7 +82,7 @@ loop.shared.views.chat = (function(mozL10n) {
render: function() {
return (
<div className="text-chat-header special room-name">
<p>{mozL10n.get("rooms_welcome_title", {conversationName: this.props.message})}</p>
<p>{mozL10n.get("rooms_welcome_title", { conversationName: this.props.message })}</p>
</div>
);
}
@ -140,7 +140,7 @@ loop.shared.views.chat = (function(mozL10n) {
// If the number of received messages has increased, we play a sound.
if (receivedMessageCount > this.state.receivedMessageCount) {
this.play("message");
this.setState({receivedMessageCount: receivedMessageCount});
this.setState({ receivedMessageCount: receivedMessageCount });
}
},

View File

@ -42,7 +42,7 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
this.EXPORTED_SYMBOLS = ["utils"];
mozL10n = { get: function() {
throw new Error("mozL10n.get not availabled from chrome!");
}};
} };
} else {
mozL10n = document.mozL10n || navigator.mozL10n;
}
@ -116,7 +116,7 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
*/
function formatDate(timestamp) {
var date = (new Date(timestamp * 1000));
var options = {year: "numeric", month: "long", day: "numeric"};
var options = { year: "numeric", month: "long", day: "numeric" };
return date.toLocaleDateString(navigator.language, options);
}
@ -405,7 +405,7 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
callUrl: callUrl
});
}
var bodyFooter = body + footer;
var bodyFooter = body + footer;
bodyFooter = bodyFooter.replace(/\r\n/g, "\n").replace(/\n/g, "\r\n");
mozLoop.composeEmail(
subject,
@ -506,12 +506,12 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
* @param {Number} chr The character code to decode.
* @return {Number} The decoded value.
*/
function _b64ToUint6 (chr) {
return chr > 64 && chr < 91 ? chr - 65 :
function _b64ToUint6(chr) {
return chr > 64 && chr < 91 ? chr - 65 :
chr > 96 && chr < 123 ? chr - 71 :
chr > 47 && chr < 58 ? chr + 4 :
chr === 43 ? 62 :
chr === 47 ? 63 : 0;
chr > 47 && chr < 58 ? chr + 4 :
chr === 43 ? 62 :
chr === 47 ? 63 : 0;
}
/**
@ -522,12 +522,12 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
* @param {Number} uint6 The number to encode.
* @return {Number} The encoded value.
*/
function _uint6ToB64 (uint6) {
return uint6 < 26 ? uint6 + 65 :
uint6 < 52 ? uint6 + 71 :
uint6 < 62 ? uint6 - 4 :
uint6 === 62 ? 43 :
uint6 === 63 ? 47 : 65;
function _uint6ToB64(uint6) {
return uint6 < 26 ? uint6 + 65 :
uint6 < 52 ? uint6 + 71 :
uint6 < 62 ? uint6 - 4 :
uint6 === 62 ? 43 :
uint6 === 63 ? 47 : 65;
}
/**
@ -546,10 +546,10 @@ var inChrome = typeof Components != "undefined" && "utils" in Components;
// Mapping.
for (var mapIndex = 0; mapIndex < inLength; mapIndex++) {
chr = inString.charCodeAt(mapIndex);
arrayLength += chr < 0x80 ? 1 :
chr < 0x800 ? 2 :
chr < 0x10000 ? 3 :
chr < 0x200000 ? 4 :
arrayLength += chr < 0x80 ? 1 :
chr < 0x800 ? 2 :
chr < 0x10000 ? 3 :
chr < 0x200000 ? 4 :
chr < 0x4000000 ? 5 : 6;
}

View File

@ -113,9 +113,9 @@ loop.validate = (function() {
_dependencyMatchTypes: function(value, types) {
return types.some(function(Type) {
try {
return typeof Type === "undefined" || // skip checking
Type === null && value === null || // null type
value.constructor === Type || // native type
return typeof Type === "undefined" || // skip checking
Type === null && value === null || // null type
value.constructor === Type || // native type
Type.prototype.isPrototypeOf(value) || // custom type
typeName(value) === typeName(Type); // type string eq.
} catch (e) {

View File

@ -62,7 +62,7 @@ loop.shared.views = (function(_, mozL10n) {
},
getDefaultProps: function() {
return {enabled: true, visible: true};
return { enabled: true, visible: true };
},
handleClick: function() {
@ -389,9 +389,9 @@ loop.shared.views = (function(_, mozL10n) {
var ConversationToolbar = React.createClass({displayName: "ConversationToolbar",
getDefaultProps: function() {
return {
video: {enabled: true, visible: true},
audio: {enabled: true, visible: true},
screenShare: {state: SCREEN_SHARE_STATES.INACTIVE, visible: false},
video: { enabled: true, visible: true },
audio: { enabled: true, visible: true },
screenShare: { state: SCREEN_SHARE_STATES.INACTIVE, visible: false },
settingsMenuItems: null,
showHangup: true
};
@ -446,7 +446,7 @@ loop.shared.views = (function(_, mozL10n) {
*/
_onBodyMouseMove: function() {
if (this.state.idle) {
this.setState({idle: false});
this.setState({ idle: false });
this.startIdleCountDown();
} else {
this.userActivity = true;
@ -484,7 +484,7 @@ loop.shared.views = (function(_, mozL10n) {
startIdleCountDown: function() {
this.checkUserActivity();
this.inactivityTimeout = setTimeout(function() {
this.setState({idle: true});
this.setState({ idle: true });
clearInterval(this.inactivityPollInterval);
}.bind(this), 6000);
},
@ -583,7 +583,7 @@ loop.shared.views = (function(_, mozL10n) {
},
getDefaultProps: function() {
return {clearOnDocumentHidden: false};
return { clearOnDocumentHidden: false };
},
componentDidMount: function() {
@ -607,7 +607,7 @@ loop.shared.views = (function(_, mozL10n) {
// Note: The `silent` option prevents the `reset` event to be triggered
// here, preventing the UI to "jump" a little because of the event
// callback being processed in another tick (I think).
this.props.notifications.reset([], {silent: true});
this.props.notifications.reset([], { silent: true });
this.forceUpdate();
}
},
@ -1121,9 +1121,9 @@ loop.shared.views = (function(_, mozL10n) {
mediaType: "remote",
posterUrl: this.props.remotePosterUrl,
srcMediaElement: this.props.remoteSrcMediaElement}),
this.state.localMediaAboslutelyPositioned ?
this.state.localMediaAboslutelyPositioned ?
this.renderLocalVideo() : null,
this.props.displayScreenShare ? null : this.props.children
this.props.displayScreenShare ? null : this.props.children
),
React.createElement("div", {className: screenShareStreamClasses},
React.createElement(MediaView, {displayAvatar: false,
@ -1131,13 +1131,13 @@ loop.shared.views = (function(_, mozL10n) {
mediaType: "screen-share",
posterUrl: this.props.screenSharePosterUrl,
srcMediaElement: this.props.screenShareMediaElement}),
this.props.displayScreenShare ? this.props.children : null
this.props.displayScreenShare ? this.props.children : null
),
React.createElement(loop.shared.views.chat.TextChatView, {
dispatcher: this.props.dispatcher,
showRoomName: this.props.showContextRoomName,
useDesktopPaths: this.props.useDesktopPaths}),
this.state.localMediaAboslutelyPositioned ?
this.state.localMediaAboslutelyPositioned ?
null : this.renderLocalVideo()
)
)

View File

@ -62,7 +62,7 @@ loop.shared.views = (function(_, mozL10n) {
},
getDefaultProps: function() {
return {enabled: true, visible: true};
return { enabled: true, visible: true };
},
handleClick: function() {
@ -389,9 +389,9 @@ loop.shared.views = (function(_, mozL10n) {
var ConversationToolbar = React.createClass({
getDefaultProps: function() {
return {
video: {enabled: true, visible: true},
audio: {enabled: true, visible: true},
screenShare: {state: SCREEN_SHARE_STATES.INACTIVE, visible: false},
video: { enabled: true, visible: true },
audio: { enabled: true, visible: true },
screenShare: { state: SCREEN_SHARE_STATES.INACTIVE, visible: false },
settingsMenuItems: null,
showHangup: true
};
@ -446,7 +446,7 @@ loop.shared.views = (function(_, mozL10n) {
*/
_onBodyMouseMove: function() {
if (this.state.idle) {
this.setState({idle: false});
this.setState({ idle: false });
this.startIdleCountDown();
} else {
this.userActivity = true;
@ -484,7 +484,7 @@ loop.shared.views = (function(_, mozL10n) {
startIdleCountDown: function() {
this.checkUserActivity();
this.inactivityTimeout = setTimeout(function() {
this.setState({idle: true});
this.setState({ idle: true });
clearInterval(this.inactivityPollInterval);
}.bind(this), 6000);
},
@ -583,7 +583,7 @@ loop.shared.views = (function(_, mozL10n) {
},
getDefaultProps: function() {
return {clearOnDocumentHidden: false};
return { clearOnDocumentHidden: false };
},
componentDidMount: function() {
@ -607,7 +607,7 @@ loop.shared.views = (function(_, mozL10n) {
// Note: The `silent` option prevents the `reset` event to be triggered
// here, preventing the UI to "jump" a little because of the event
// callback being processed in another tick (I think).
this.props.notifications.reset([], {silent: true});
this.props.notifications.reset([], { silent: true });
this.forceUpdate();
}
},
@ -1121,9 +1121,9 @@ loop.shared.views = (function(_, mozL10n) {
mediaType="remote"
posterUrl={this.props.remotePosterUrl}
srcMediaElement={this.props.remoteSrcMediaElement} />
{ this.state.localMediaAboslutelyPositioned ?
this.renderLocalVideo() : null }
{ this.props.displayScreenShare ? null : this.props.children }
{this.state.localMediaAboslutelyPositioned ?
this.renderLocalVideo() : null}
{this.props.displayScreenShare ? null : this.props.children}
</div>
<div className={screenShareStreamClasses}>
<MediaView displayAvatar={false}
@ -1131,14 +1131,14 @@ loop.shared.views = (function(_, mozL10n) {
mediaType="screen-share"
posterUrl={this.props.screenSharePosterUrl}
srcMediaElement={this.props.screenShareMediaElement} />
{ this.props.displayScreenShare ? this.props.children : null }
{this.props.displayScreenShare ? this.props.children : null}
</div>
<loop.shared.views.chat.TextChatView
dispatcher={this.props.dispatcher}
showRoomName={this.props.showContextRoomName}
useDesktopPaths={this.props.useDesktopPaths} />
{ this.state.localMediaAboslutelyPositioned ?
null : this.renderLocalVideo() }
{this.state.localMediaAboslutelyPositioned ?
null : this.renderLocalVideo()}
</div>
</div>
);

View File

@ -90,7 +90,7 @@ this.CardDavImporter.prototype = {
return;
}
if (!("host" in options)){
if (!("host" in options)) {
callback(new Error("Missing host for CardDav import"));
return;
}
@ -220,7 +220,7 @@ this.CardDavImporter.prototype = {
let contact = {};
let nickname;
vcard.split(/[\r\n]+(?! )/).forEach(
function (contentline) {
function(contentline) {
contentline = contentline.replace(/[\r\n]+ /g, "");
let match = /^(.*?[^\\]):(.*)$/.exec(contentline);
if (match) {

View File

@ -170,7 +170,7 @@ this.GoogleImporter.prototype = {
let code = yield this._promiseAuthCode(windowRef);
let tokenSet = yield this._promiseTokenSet(code);
let contactEntries = yield this._getContactEntries(tokenSet);
let {total, success, ids} = yield this._processContacts(contactEntries, db, tokenSet);
let { total, success, ids } = yield this._processContacts(contactEntries, db, tokenSet);
yield this._purgeContacts(ids, db);
return {

View File

@ -3,7 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "console",
@ -17,7 +17,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "CardDavImporter",
XPCOMUtils.defineLazyModuleGetter(this, "GoogleImporter",
"resource:///modules/loop/GoogleImporter.jsm");
XPCOMUtils.defineLazyGetter(this, "eventEmitter", function() {
const {EventEmitter} = Cu.import("resource://devtools/shared/event-emitter.js", {});
const { EventEmitter } = Cu.import("resource://devtools/shared/event-emitter.js", {});
return new EventEmitter();
});
@ -313,7 +313,7 @@ LoopStorage.on("upgrade", function(e, db) {
keyPath: kKeyPath,
autoIncrement: true
});
store.createIndex(kServiceIdIndex, kServiceIdIndex, {unique: false});
store.createIndex(kServiceIdIndex, kServiceIdIndex, { unique: false });
});
/**

View File

@ -3,14 +3,14 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Timer.jsm");
const {MozLoopService, LOOP_SESSION_TYPE} = Cu.import("resource:///modules/loop/MozLoopService.jsm", {});
const { MozLoopService, LOOP_SESSION_TYPE } = Cu.import("resource:///modules/loop/MozLoopService.jsm", {});
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
@ -19,7 +19,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebChannel",
"resource://gre/modules/WebChannel.jsm");
XPCOMUtils.defineLazyGetter(this, "eventEmitter", function() {
const {EventEmitter} = Cu.import("resource://devtools/shared/event-emitter.js", {});
const { EventEmitter } = Cu.import("resource://devtools/shared/event-emitter.js", {});
return new EventEmitter();
});
XPCOMUtils.defineLazyGetter(this, "gLoopBundle", function() {
@ -656,7 +656,7 @@ var LoopRoomsInternal = {
}
Task.spawn(function* () {
let {all, encrypted} = yield this.promiseEncryptRoomData(room);
let { all, encrypted } = yield this.promiseEncryptRoomData(room);
// Save both sets of data...
room = all;
@ -885,7 +885,7 @@ var LoopRoomsInternal = {
}
Task.spawn(function* () {
let {all, encrypted} = yield this.promiseEncryptRoomData(room);
let { all, encrypted } = yield this.promiseEncryptRoomData(room);
// For patch, we only send the context data.
let sendData = {
@ -917,7 +917,7 @@ var LoopRoomsInternal = {
// See if we received a notification for the channel that's currently active:
let channelIDs = MozLoopService.channelIDs;
if ((this.sessionType == LOOP_SESSION_TYPE.GUEST && channelID != channelIDs.roomsGuest) ||
(this.sessionType == LOOP_SESSION_TYPE.FXA && channelID != channelIDs.roomsFxA)) {
(this.sessionType == LOOP_SESSION_TYPE.FXA && channelID != channelIDs.roomsFxA)) {
return;
}

View File

@ -3,12 +3,12 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
const {MozLoopService, LOOP_SESSION_TYPE} =
const { MozLoopService, LOOP_SESSION_TYPE } =
Cu.import("resource:///modules/loop/MozLoopService.jsm", {});
XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
"resource://services-common/utils.js");
@ -63,7 +63,7 @@ LoopRoomsCache.prototype = {
_setCache: function(contents) {
this._cache = contents;
return OS.File.makeDir(this.baseDir, {ignoreExisting: true}).then(() => {
return OS.File.makeDir(this.baseDir, { ignoreExisting: true }).then(() => {
return CommonUtils.writeJSON(contents, this.path);
});
},
@ -81,7 +81,7 @@ LoopRoomsCache.prototype = {
try {
return (this._cache = yield CommonUtils.readJSON(this.path));
} catch(error) {
} catch (error) {
if (!error.becauseNoSuchFile) {
MozLoopService.log.debug("Error reading the cache:", error);
}
@ -131,7 +131,7 @@ LoopRoomsCache.prototype = {
*/
setKey: Task.async(function* (sessionType, roomToken, roomKey) {
if (sessionType != LOOP_SESSION_TYPE.FXA) {
return;
return Promise.resolve();
}
let cache = yield this._getCache();

View File

@ -3,7 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
// Make it possible to load LoopStorage.jsm in xpcshell tests
try {
@ -19,7 +19,7 @@ try {
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "eventEmitter", function() {
const {EventEmitter} = Cu.import("resource://devtools/shared/event-emitter.js", {});
const { EventEmitter } = Cu.import("resource://devtools/shared/event-emitter.js", {});
return new EventEmitter();
});
@ -162,7 +162,7 @@ const getTransaction = function(store, callback, mode) {
let trans;
try {
trans = db.transaction(store, mode);
} catch(ex) {
} catch (ex) {
callback(ex);
return;
}

View File

@ -222,7 +222,7 @@ PushSocket.prototype = {
* @param {Integer} startDelay The initial delay interval in milliseconds.
* @param {Integer} maxDelay Maximum time delay value in milliseconds.
*/
function RetryManager (startDelay, maxDelay) {
function RetryManager(startDelay, maxDelay) {
if (!startDelay || !maxDelay) {
throw new Error("RetryManager: missing required parameters(s)" +
(startDelay ? "" : " startDelay") +
@ -295,7 +295,7 @@ PingMonitor.prototype = {
/**
* Function to restart the ping timeout and cancel any current timeout operation.
*/
restart: function () {
restart: function() {
consoleLog.info("PushHandler: ping timeout restart");
this.stop();
this._pingTimerID = setTimeout(() => { this._pingSend(); }, this._pingInterval);
@ -305,13 +305,13 @@ PingMonitor.prototype = {
* Function to stop the PingMonitor.
*/
stop: function() {
if (this._pingTimerID){
if (this._pingTimerID) {
clearTimeout(this._pingTimerID);
this._pingTimerID = undefined;
}
},
_pingSend: function () {
_pingSend: function() {
consoleLog.info("PushHandler: ping sent");
this._pingTimerID = setTimeout(this._onTimeout, this._pingTimeout);
this._pingFunc();
@ -426,8 +426,8 @@ var MozLoopPushHandler = {
// Un-register each active notification channel
if (this.connectionState === CONNECTION_STATE_OPEN) {
Object.keys(this.registeredChannels).forEach((id) => {
let unRegMsg = {messageType: "unregister",
channelID: id};
let unRegMsg = { messageType: "unregister",
channelID: id };
this._pushSocket.send(unRegMsg);
});
this.registeredChannels = {};
@ -490,13 +490,13 @@ var MozLoopPushHandler = {
onRegistered(null, this.registeredChannels[channelID], channelID);
}
// Update the channel record.
this.channels.set(channelID, {onRegistered: onRegistered,
onNotification: onNotification});
this.channels.set(channelID, { onRegistered: onRegistered,
onNotification: onNotification });
return;
}
this.channels.set(channelID, {onRegistered: onRegistered,
onNotification: onNotification});
this.channels.set(channelID, { onRegistered: onRegistered,
onNotification: onNotification });
this._channelsToRegister.push(channelID);
this._registerChannels();
},
@ -517,8 +517,8 @@ var MozLoopPushHandler = {
if (this.registeredChannels[channelID]) {
delete this.registeredChannels[channelID];
if (this.connectionState === CONNECTION_STATE_OPEN) {
this._pushSocket.send({messageType: "unregister",
channelID: channelID});
this._pushSocket.send({ messageType: "unregister",
channelID: channelID });
}
}
},
@ -597,7 +597,7 @@ var MozLoopPushHandler = {
return;
}
switch(aMsg.messageType) {
switch (aMsg.messageType) {
case "hello":
this._onHello(aMsg);
break;
@ -690,8 +690,8 @@ var MozLoopPushHandler = {
});
consoleLog.log("PushHandler: PusherServer 'ack': ", ackChannels);
this._pushSocket.send({messageType: "ack",
updates: ackChannels});
this._pushSocket.send({ messageType: "ack",
updates: ackChannels });
}
},
@ -866,8 +866,8 @@ var MozLoopPushHandler = {
*/
_sendRegistration: function(channelID) {
if (channelID) {
this._pushSocket.send({messageType: "register",
channelID: channelID});
this._pushSocket.send({ messageType: "register",
channelID: channelID });
}
}
};

View File

@ -506,7 +506,7 @@ var MozLoopServiceInternal = {
return Promise.resolve(pushURL);
}
let newURLs = {rooms: pushURLs.rooms};
let newURLs = { rooms: pushURLs.rooms };
newURLs[serviceType] = pushURL;
return this.hawkRequestInternal(sessionType, "/registration", "POST",
@ -993,7 +993,7 @@ var MozLoopServiceInternal = {
}
if (type == "iceconnectionstatechange") {
switch(pc.iceConnectionState) {
switch (pc.iceConnectionState) {
case "failed":
case "disconnected":
if (Services.telemetry.canRecordExtended) {
@ -1753,7 +1753,7 @@ this.MozLoopService = {
}
// Find the most recent pageID that has the Loop prefix.
let mostRecentLoopPageID = {id: null, lastSeen: null};
let mostRecentLoopPageID = { id: null, lastSeen: null };
for (let pageID of UITour.pageIDsForSession) {
if (pageID[0] && pageID[0].startsWith("hello-tour_OpenPanel_") &&
pageID[1] && pageID[1].lastSeen > mostRecentLoopPageID.lastSeen) {

View File

@ -125,7 +125,7 @@ loop.store.StandaloneMetricsStore = (function() {
* @param {sharedActions.ConnectionFailure} actionData
*/
connectionFailure: function(actionData) {
switch(actionData.reason) {
switch (actionData.reason) {
case FAILURE_DETAILS.MEDIA_DENIED:
this._storeEvent(METRICS_GA_CATEGORY.general, METRICS_GA_ACTIONS.failed,
"Media denied");

View File

@ -52,7 +52,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
return (
React.createElement("p", {
className: "terms-service",
dangerouslySetInnerHTML: {__html: this._getContent()},
dangerouslySetInnerHTML: { __html: this._getContent()},
onClick: this.recordClick})
);
}
@ -97,7 +97,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
_renderFailureText: function() {
return (
React.createElement("p", {className: "failure"}, mozL10n.get("rooms_already_joined") )
React.createElement("p", {className: "failure"}, mozL10n.get("rooms_already_joined"))
);
},
@ -109,8 +109,8 @@ loop.standaloneRoomViews = (function(mozL10n) {
React.createElement("div", {className: "handle-user-agent-view-scroller"},
React.createElement("div", {className: "handle-user-agent-view"},
React.createElement("div", {className: "info-panel"},
React.createElement("p", {className: "loop-logo-text", title: mozL10n.get("clientShortname2") }),
React.createElement("p", {className: "roomName"}, this.state.roomName),
React.createElement("p", {className: "loop-logo-text", title: mozL10n.get("clientShortname2")}),
React.createElement("p", {className: "roomName"}, this.state.roomName),
React.createElement("p", {className: "loop-logo"}),
this.state.failureReason ?
@ -148,7 +148,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
* @return String An appropriate string according to the failureReason.
*/
getFailureString: function() {
switch(this.props.failureReason) {
switch (this.props.failureReason) {
case FAILURE_DETAILS.MEDIA_DENIED:
// XXX Bug 1166824 should provide a better string for this.
case FAILURE_DETAILS.NO_MEDIA:
@ -302,7 +302,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
},
render: function() {
switch(this.props.roomState) {
switch (this.props.roomState) {
case ROOM_STATES.ENDED:
case ROOM_STATES.READY: {
return (
@ -317,7 +317,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
}
case ROOM_STATES.MEDIA_WAIT: {
var msg = mozL10n.get("call_progress_getting_media_description",
{clientShortname: mozL10n.get("clientShortname2")});
{ clientShortname: mozL10n.get("clientShortname2") });
var utils = loop.shared.utils;
var isChrome = utils.isChrome(navigator.userAgent);
var isFirefox = utils.isFirefox(navigator.userAgent);
@ -459,7 +459,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
if (this.state.roomState !== ROOM_STATES.MEDIA_WAIT &&
nextState.roomState === ROOM_STATES.MEDIA_WAIT) {
this.props.dispatcher.dispatch(new sharedActions.SetupStreamElements({
publisherConfig: this.getDefaultPublisherConfig({publishVideo: true})
publisherConfig: this.getDefaultPublisherConfig({ publishVideo: true })
}));
}
@ -503,7 +503,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
* @return {Boolean}
*/
_roomIsActive: function() {
return this.state.roomState === ROOM_STATES.JOINED ||
return this.state.roomState === ROOM_STATES.JOINED ||
this.state.roomState === ROOM_STATES.SESSION_CONNECTED ||
this.state.roomState === ROOM_STATES.HAS_PARTICIPANTS;
},
@ -518,7 +518,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
* overlapping cases.
*/
shouldRenderRemoteVideo: function() {
switch(this.state.roomState) {
switch (this.state.roomState) {
case ROOM_STATES.HAS_PARTICIPANTS:
if (this.state.remoteVideoEnabled) {
return true;
@ -565,7 +565,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
* @returns {boolean}
* @private
*/
_isLocalLoading: function () {
_isLocalLoading: function() {
return this.state.roomState === ROOM_STATES.MEDIA_WAIT &&
!this.state.localSrcMediaElement;
},
@ -628,13 +628,13 @@ loop.standaloneRoomViews = (function(mozL10n) {
roomState: this.state.roomState,
roomUsed: this.state.used}),
React.createElement(sharedViews.ConversationToolbar, {
audio: {enabled: !this.state.audioMuted,
audio: { enabled: !this.state.audioMuted,
visible: this._roomIsActive()},
dispatcher: this.props.dispatcher,
hangup: this.leaveRoom,
publishStream: this.publishStream,
show: true,
video: {enabled: !this.state.videoMuted,
video: { enabled: !this.state.videoMuted,
visible: this._roomIsActive()}})
)
)

View File

@ -52,7 +52,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
return (
<p
className="terms-service"
dangerouslySetInnerHTML={{__html: this._getContent()}}
dangerouslySetInnerHTML={{ __html: this._getContent() }}
onClick={this.recordClick}></p>
);
}
@ -97,7 +97,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
_renderFailureText: function() {
return (
<p className="failure">{ mozL10n.get("rooms_already_joined") }</p>
<p className="failure">{mozL10n.get("rooms_already_joined")}</p>
);
},
@ -109,8 +109,8 @@ loop.standaloneRoomViews = (function(mozL10n) {
<div className="handle-user-agent-view-scroller">
<div className="handle-user-agent-view">
<div className="info-panel">
<p className="loop-logo-text" title={ mozL10n.get("clientShortname2") }></p>
<p className="roomName">{ this.state.roomName }</p>
<p className="loop-logo-text" title={mozL10n.get("clientShortname2")}></p>
<p className="roomName">{this.state.roomName}</p>
<p className="loop-logo" />
{
this.state.failureReason ?
@ -148,7 +148,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
* @return String An appropriate string according to the failureReason.
*/
getFailureString: function() {
switch(this.props.failureReason) {
switch (this.props.failureReason) {
case FAILURE_DETAILS.MEDIA_DENIED:
// XXX Bug 1166824 should provide a better string for this.
case FAILURE_DETAILS.NO_MEDIA:
@ -302,7 +302,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
},
render: function() {
switch(this.props.roomState) {
switch (this.props.roomState) {
case ROOM_STATES.ENDED:
case ROOM_STATES.READY: {
return (
@ -317,7 +317,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
}
case ROOM_STATES.MEDIA_WAIT: {
var msg = mozL10n.get("call_progress_getting_media_description",
{clientShortname: mozL10n.get("clientShortname2")});
{ clientShortname: mozL10n.get("clientShortname2") });
var utils = loop.shared.utils;
var isChrome = utils.isChrome(navigator.userAgent);
var isFirefox = utils.isFirefox(navigator.userAgent);
@ -459,7 +459,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
if (this.state.roomState !== ROOM_STATES.MEDIA_WAIT &&
nextState.roomState === ROOM_STATES.MEDIA_WAIT) {
this.props.dispatcher.dispatch(new sharedActions.SetupStreamElements({
publisherConfig: this.getDefaultPublisherConfig({publishVideo: true})
publisherConfig: this.getDefaultPublisherConfig({ publishVideo: true })
}));
}
@ -503,7 +503,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
* @return {Boolean}
*/
_roomIsActive: function() {
return this.state.roomState === ROOM_STATES.JOINED ||
return this.state.roomState === ROOM_STATES.JOINED ||
this.state.roomState === ROOM_STATES.SESSION_CONNECTED ||
this.state.roomState === ROOM_STATES.HAS_PARTICIPANTS;
},
@ -518,7 +518,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
* overlapping cases.
*/
shouldRenderRemoteVideo: function() {
switch(this.state.roomState) {
switch (this.state.roomState) {
case ROOM_STATES.HAS_PARTICIPANTS:
if (this.state.remoteVideoEnabled) {
return true;
@ -565,7 +565,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
* @returns {boolean}
* @private
*/
_isLocalLoading: function () {
_isLocalLoading: function() {
return this.state.roomState === ROOM_STATES.MEDIA_WAIT &&
!this.state.localSrcMediaElement;
},
@ -628,14 +628,14 @@ loop.standaloneRoomViews = (function(mozL10n) {
roomState={this.state.roomState}
roomUsed={this.state.used} />
<sharedViews.ConversationToolbar
audio={{enabled: !this.state.audioMuted,
visible: this._roomIsActive()}}
audio={{ enabled: !this.state.audioMuted,
visible: this._roomIsActive() }}
dispatcher={this.props.dispatcher}
hangup={this.leaveRoom}
publishStream={this.publishStream}
show={true}
video={{enabled: !this.state.videoMuted,
visible: this._roomIsActive()}} />
video={{ enabled: !this.state.videoMuted,
visible: this._roomIsActive() }} />
</sharedViews.MediaLayoutView>
</div>
);

View File

@ -22,7 +22,7 @@ loop.webapp = (function(_, OT, mozL10n) {
var HomeView = React.createClass({displayName: "HomeView",
render: function() {
return (
React.createElement("p", null, mozL10n.get("welcome", {clientShortname: mozL10n.get("clientShortname2")}))
React.createElement("p", null, mozL10n.get("welcome", { clientShortname: mozL10n.get("clientShortname2") }))
);
}
});
@ -63,7 +63,7 @@ loop.webapp = (function(_, OT, mozL10n) {
platform: mozL10n.get("unsupported_platform_" + this.props.platform)
};
var unsupportedLearnMoreText = mozL10n.get("unsupported_platform_learn_more_link",
{clientShortname: mozL10n.get("clientShortname2")});
{ clientShortname: mozL10n.get("clientShortname2") });
return (
React.createElement("div", {className: "highlight-issue-box"},
@ -94,7 +94,7 @@ loop.webapp = (function(_, OT, mozL10n) {
}
return (
React.createElement("div", {className: "promote-firefox"},
React.createElement("h3", null, mozL10n.get("promote_firefox_hello_heading", {brandShortname: mozL10n.get("brandShortname")})),
React.createElement("h3", null, mozL10n.get("promote_firefox_hello_heading", { brandShortname: mozL10n.get("brandShortname") })),
React.createElement("p", null,
React.createElement("a", {className: "btn btn-large btn-accept",
href: loop.config.downloadFirefoxUrl},

View File

@ -22,7 +22,7 @@ loop.webapp = (function(_, OT, mozL10n) {
var HomeView = React.createClass({
render: function() {
return (
<p>{mozL10n.get("welcome", {clientShortname: mozL10n.get("clientShortname2")})}</p>
<p>{mozL10n.get("welcome", { clientShortname: mozL10n.get("clientShortname2") })}</p>
);
}
});
@ -63,7 +63,7 @@ loop.webapp = (function(_, OT, mozL10n) {
platform: mozL10n.get("unsupported_platform_" + this.props.platform)
};
var unsupportedLearnMoreText = mozL10n.get("unsupported_platform_learn_more_link",
{clientShortname: mozL10n.get("clientShortname2")});
{ clientShortname: mozL10n.get("clientShortname2") });
return (
<div className="highlight-issue-box">
@ -94,7 +94,7 @@ loop.webapp = (function(_, OT, mozL10n) {
}
return (
<div className="promote-firefox">
<h3>{mozL10n.get("promote_firefox_hello_heading", {brandShortname: mozL10n.get("brandShortname")})}</h3>
<h3>{mozL10n.get("promote_firefox_hello_heading", { brandShortname: mozL10n.get("brandShortname") })}</h3>
<p>
<a className="btn btn-large btn-accept"
href={loop.config.downloadFirefoxUrl}>

View File

@ -114,7 +114,7 @@ function shutdown(cb) {
"use strict";
try {
server.close(function () {
server.close(function() {
process.exit(0);
if (cb !== undefined) {
cb();

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.store.ConversationAppStore", function () {
describe("loop.store.ConversationAppStore", function() {
"use strict";
var expect = chai.expect;

View File

@ -20,7 +20,7 @@ describe("loop.conversation", function() {
navigator.mozLoop = {
doNotDisturb: true,
getStrings: function() {
return JSON.stringify({textContent: "fakeText"});
return JSON.stringify({ textContent: "fakeText" });
},
get locale() {
return "en-US";
@ -49,7 +49,7 @@ describe("loop.conversation", function() {
};
},
getAudioBlob: sinon.spy(function(name, callback) {
callback(null, new Blob([new ArrayBuffer(10)], {type: "audio/ogg"}));
callback(null, new Blob([new ArrayBuffer(10)], { type: "audio/ogg" }));
}),
getSelectedTabMetadata: function(callback) {
callback({});
@ -174,8 +174,8 @@ describe("loop.conversation", function() {
});
it("should display the RoomView for rooms", function() {
conversationAppStore.setStoreState({windowType: "room"});
activeRoomStore.setStoreState({roomState: ROOM_STATES.READY});
conversationAppStore.setStoreState({ windowType: "room" });
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
ccView = mountTestComponent();
@ -196,7 +196,7 @@ describe("loop.conversation", function() {
});
it("should set the correct title when rendering feedback view", function() {
conversationAppStore.setStoreState({showFeedbackForm: true});
conversationAppStore.setStoreState({ showFeedbackForm: true });
ccView = mountTestComponent();
@ -205,7 +205,7 @@ describe("loop.conversation", function() {
it("should render FeedbackView if showFeedbackForm state is true",
function() {
conversationAppStore.setStoreState({showFeedbackForm: true});
conversationAppStore.setStoreState({ showFeedbackForm: true });
ccView = mountTestComponent();
@ -214,7 +214,7 @@ describe("loop.conversation", function() {
it("should dispatch a ShowFeedbackForm action if timestamp is 0",
function() {
conversationAppStore.setStoreState({feedbackTimestamp: 0});
conversationAppStore.setStoreState({ feedbackTimestamp: 0 });
sandbox.stub(dispatcher, "dispatch");
ccView = mountTestComponent();

View File

@ -32,10 +32,10 @@ describe("document.mozL10n", function() {
});
it("should get a plural form", function() {
expect(document.mozL10n.get("plural", {num: 10})).eql("10 plural forms");
expect(document.mozL10n.get("plural", { num: 10 })).eql("10 plural forms");
});
it("should correctly get a plural form for num = 0", function() {
expect(document.mozL10n.get("plural", {num: 0})).eql("0 plural form");
expect(document.mozL10n.get("plural", { num: 0 })).eql("0 plural form");
});
});

View File

@ -20,7 +20,7 @@ describe("loop.panel", function() {
fakeXHR = sandbox.useFakeXMLHttpRequest();
requests = [];
// https://github.com/cjohansen/Sinon.JS/issues/393
fakeXHR.xhr.onCreate = function (xhr) {
fakeXHR.xhr.onCreate = function(xhr) {
requests.push(xhr);
};
@ -33,7 +33,7 @@ describe("loop.panel", function() {
fakeWindow = {
close: sandbox.stub(),
addEventListener: function() {},
document: { addEventListener: function(){} },
document: { addEventListener: function() {} },
setTimeout: function(callback) { callback(); }
};
loop.shared.mixins.setRootObject(fakeWindow);
@ -44,13 +44,13 @@ describe("loop.panel", function() {
doNotDisturb: true,
fxAEnabled: true,
getStrings: function() {
return JSON.stringify({textContent: "fakeText"});
return JSON.stringify({ textContent: "fakeText" });
},
get locale() {
return "en-US";
},
setLoopPref: sandbox.stub(),
getLoopPref: function (prefName) {
getLoopPref: function(prefName) {
return "unseen";
},
getPluralForm: function() {
@ -154,7 +154,7 @@ describe("loop.panel", function() {
}
it("should hide the account entry when FxA is not enabled", function() {
navigator.mozLoop.userProfile = {email: "test@example.com"};
navigator.mozLoop.userProfile = { email: "test@example.com" };
navigator.mozLoop.fxAEnabled = false;
var view = TestUtils.renderIntoDocument(
@ -305,7 +305,7 @@ describe("loop.panel", function() {
});
it("should show a signout entry when user is authenticated", function() {
navigator.mozLoop.userProfile = {email: "test@example.com"};
navigator.mozLoop.userProfile = { email: "test@example.com" };
var view = mountTestComponent();
@ -316,7 +316,7 @@ describe("loop.panel", function() {
});
it("should show an account entry when user is authenticated", function() {
navigator.mozLoop.userProfile = {email: "test@example.com"};
navigator.mozLoop.userProfile = { email: "test@example.com" };
var view = mountTestComponent();
@ -326,7 +326,7 @@ describe("loop.panel", function() {
it("should open the FxA settings when the account entry is clicked",
function() {
navigator.mozLoop.userProfile = {email: "test@example.com"};
navigator.mozLoop.userProfile = { email: "test@example.com" };
var view = mountTestComponent();
@ -337,7 +337,7 @@ describe("loop.panel", function() {
});
it("should sign out the user on click when authenticated", function() {
navigator.mozLoop.userProfile = {email: "test@example.com"};
navigator.mozLoop.userProfile = { email: "test@example.com" };
var view = mountTestComponent();
TestUtils.Simulate.click(view.getDOMNode()
@ -575,7 +575,7 @@ describe("loop.panel", function() {
// the actions we are triggering.
sandbox.stub(dispatcher, "dispatch");
view = mountRoomEntry({room: new loop.store.Room(roomData)});
view = mountRoomEntry({ room: new loop.store.Room(roomData) });
});
// XXX Current version of React cannot use TestUtils.Simulate, please
@ -631,7 +631,7 @@ describe("loop.panel", function() {
sinon.assert.calledOnce(dispatcher.dispatch);
sinon.assert.calledWithExactly(dispatcher.dispatch,
new sharedActions.OpenRoom({roomToken: roomData.roomToken}));
new sharedActions.OpenRoom({ roomToken: roomData.roomToken }));
});
it("should dispatch an OpenRoom action when callback is called", function() {
@ -639,7 +639,7 @@ describe("loop.panel", function() {
sinon.assert.calledOnce(dispatcher.dispatch);
sinon.assert.calledWithExactly(dispatcher.dispatch,
new sharedActions.OpenRoom({roomToken: roomData.roomToken}));
new sharedActions.OpenRoom({ roomToken: roomData.roomToken }));
});
it("should call window.close", function() {
@ -735,7 +735,7 @@ describe("loop.panel", function() {
ctime: new Date().getTime()
}));
roomEntry.setProps({room: updatedRoom});
roomEntry.setProps({ room: updatedRoom });
expect(
roomEntry.getDOMNode().textContent)
@ -802,11 +802,11 @@ describe("loop.panel", function() {
it("should close the panel once a room is created and there is no error", function() {
var view = createTestComponent();
roomStore.setStoreState({pendingCreation: true});
roomStore.setStoreState({ pendingCreation: true });
sinon.assert.notCalled(fakeWindow.close);
roomStore.setStoreState({pendingCreation: false});
roomStore.setStoreState({ pendingCreation: false });
sinon.assert.calledOnce(fakeWindow.close);
});
@ -829,7 +829,7 @@ describe("loop.panel", function() {
it("should display a loading animation when rooms are pending", function() {
var view = createTestComponent();
roomStore.setStoreState({pendingInitialRetrieval: true});
roomStore.setStoreState({ pendingInitialRetrieval: true });
expect(view.getDOMNode().querySelectorAll(".room-list-loading").length).to.eql(1);
});
@ -865,9 +865,9 @@ describe("loop.panel", function() {
it("should dispatch a CreateRoom action with context when clicking on the " +
"Start a conversation button", function() {
fakeMozLoop.userProfile = {email: fakeEmail};
fakeMozLoop.userProfile = { email: fakeEmail };
var favicon = "data:image/x-icon;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
fakeMozLoop.getSelectedTabMetadata = function (callback) {
fakeMozLoop.getSelectedTabMetadata = function(callback) {
callback({
url: "http://invalid.com",
description: "fakeSite",
@ -1014,13 +1014,13 @@ describe("loop.panel", function() {
});
it("should render ConversationDropdown if state.showMenu=true", function() {
view = createTestComponent({showMenu: true});
view = createTestComponent({ showMenu: true });
expect(view.refs.menu).to.not.eql(undefined);
});
it("should not render ConversationDropdown by default", function() {
view = createTestComponent({showMenu: false});
view = createTestComponent({ showMenu: false });
expect(view.refs.menu).to.eql(undefined);
});
@ -1057,7 +1057,7 @@ describe("loop.panel", function() {
view.handleDeleteButtonClick(fakeEvent);
sinon.assert.calledWithExactly(dispatcher.dispatch,
new sharedActions.DeleteRoom({roomToken: roomData.roomToken}));
new sharedActions.DeleteRoom({ roomToken: roomData.roomToken }));
});
it("should trigger handleClickEntry when button is clicked", function() {

View File

@ -3,7 +3,7 @@
var expect = chai.expect;
describe("loop.store.Room", function () {
describe("loop.store.Room", function() {
"use strict";
describe("#constructor", function() {
@ -15,7 +15,7 @@ describe("loop.store.Room", function () {
});
});
describe("loop.store.RoomStore", function () {
describe("loop.store.RoomStore", function() {
"use strict";
var sharedActions = loop.shared.actions;
@ -202,7 +202,7 @@ describe("loop.store.RoomStore", function () {
it("should find next available room number from an empty room list",
function() {
store.setStoreState({rooms: []});
store.setStoreState({ rooms: [] });
expect(store.findNextAvailableRoomNumber(fakeNameTemplate)).eql(1);
});
@ -210,7 +210,7 @@ describe("loop.store.RoomStore", function () {
it("should find next available room number from a non empty room list",
function() {
store.setStoreState({
rooms: [{decryptedContext: {roomName: "RoomWord 1"}}]
rooms: [{ decryptedContext: { roomName: "RoomWord 1" } }]
});
expect(store.findNextAvailableRoomNumber(fakeNameTemplate)).eql(2);
@ -241,7 +241,7 @@ describe("loop.store.RoomStore", function () {
beforeEach(function() {
sandbox.stub(dispatcher, "dispatch");
store.setStoreState({pendingCreation: false, rooms: []});
store.setStoreState({ pendingCreation: false, rooms: [] });
fakeRoomCreationData = {
nameTemplate: fakeNameTemplate
};
@ -259,7 +259,7 @@ describe("loop.store.RoomStore", function () {
it("should log a telemetry event when the operation with context is successful", function() {
sandbox.stub(fakeMozLoop.rooms, "create", function(data, cb) {
cb(null, {roomToken: "fakeToken"});
cb(null, { roomToken: "fakeToken" });
});
fakeRoomCreationData.urls = [{
@ -323,7 +323,7 @@ describe("loop.store.RoomStore", function () {
it("should dispatch a CreatedRoom action once the operation is done",
function() {
sandbox.stub(fakeMozLoop.rooms, "create", function(data, cb) {
cb(null, {roomToken: "fakeToken"});
cb(null, { roomToken: "fakeToken" });
});
store.createRoom(new sharedActions.CreateRoom(fakeRoomCreationData));
@ -353,7 +353,7 @@ describe("loop.store.RoomStore", function () {
it("should log a telemetry event when the operation is successful", function() {
sandbox.stub(fakeMozLoop.rooms, "create", function(data, cb) {
cb(null, {roomToken: "fakeToken"});
cb(null, { roomToken: "fakeToken" });
});
store.createRoom(new sharedActions.CreateRoom(fakeRoomCreationData));
@ -383,7 +383,7 @@ describe("loop.store.RoomStore", function () {
});
it("should switch the pendingCreation state flag to false", function() {
store.setStoreState({pendingCreation: true});
store.setStoreState({ pendingCreation: true });
store.createdRoom(new sharedActions.CreatedRoom({
roomToken: "fakeToken"
@ -408,7 +408,7 @@ describe("loop.store.RoomStore", function () {
describe("#createRoomError", function() {
it("should switch the pendingCreation state flag to false", function() {
store.setStoreState({pendingCreation: true});
store.setStoreState({ pendingCreation: true });
store.createRoomError({
error: new Error("fake")
@ -609,7 +609,7 @@ describe("loop.store.RoomStore", function () {
describe("#setStoreState", function() {
it("should update store state data", function() {
store.setStoreState({pendingCreation: true});
store.setStoreState({ pendingCreation: true });
expect(store.getStoreState().pendingCreation).eql(true);
});
@ -619,7 +619,7 @@ describe("loop.store.RoomStore", function () {
done();
});
store.setStoreState({pendingCreation: true});
store.setStoreState({ pendingCreation: true });
});
it("should trigger a `change:<prop>` event", function(done) {
@ -627,7 +627,7 @@ describe("loop.store.RoomStore", function () {
done();
});
store.setStoreState({pendingCreation: true});
store.setStoreState({ pendingCreation: true });
});
});
@ -713,9 +713,9 @@ describe("loop.store.RoomStore", function () {
});
it("should subscribe to substore changes", function() {
var fakeServerData = {fake: true};
var fakeServerData = { fake: true };
activeRoomStore.setStoreState({serverData: fakeServerData});
activeRoomStore.setStoreState({ serverData: fakeServerData });
expect(fakeStore.getStoreState().activeRoom.serverData)
.eql(fakeServerData);
@ -727,7 +727,7 @@ describe("loop.store.RoomStore", function () {
done();
});
activeRoomStore.setStoreState({serverData: {}});
activeRoomStore.setStoreState({ serverData: {} });
});
});
});
@ -741,11 +741,11 @@ describe("loop.store.RoomStore", function () {
open: sinon.spy()
}
};
store = new loop.store.RoomStore(dispatcher, {mozLoop: fakeMozLoop});
store = new loop.store.RoomStore(dispatcher, { mozLoop: fakeMozLoop });
});
it("should open the room via mozLoop", function() {
dispatcher.dispatch(new sharedActions.OpenRoom({roomToken: "42abc"}));
dispatcher.dispatch(new sharedActions.OpenRoom({ roomToken: "42abc" }));
sinon.assert.calledOnce(fakeMozLoop.rooms.open);
sinon.assert.calledWithExactly(fakeMozLoop.rooms.open, "42abc");
@ -768,7 +768,7 @@ describe("loop.store.RoomStore", function () {
update: null
}
};
store = new loop.store.RoomStore(dispatcher, {mozLoop: fakeMozLoop});
store = new loop.store.RoomStore(dispatcher, { mozLoop: fakeMozLoop });
});
afterEach(function() {

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.roomViews", function () {
describe("loop.roomViews", function() {
"use strict";
var expect = chai.expect;
@ -24,7 +24,7 @@ describe("loop.roomViews", function () {
fakeMozLoop = {
getAudioBlob: sinon.spy(function(name, callback) {
callback(null, new Blob([new ArrayBuffer(10)], {type: "audio/ogg"}));
callback(null, new Blob([new ArrayBuffer(10)], { type: "audio/ogg" }));
}),
getLoopPref: sinon.stub(),
getSelectedTabMetadata: sinon.stub().callsArgWith(0, {
@ -104,7 +104,7 @@ describe("loop.roomViews", function () {
var TestView = React.createClass({
mixins: [loop.roomViews.ActiveRoomStoreMixin],
getInitialState: function() {
return {foo: "bar"};
return { foo: "bar" };
},
render: function() { return React.DOM.div(); }
});
@ -114,7 +114,7 @@ describe("loop.roomViews", function () {
roomStore: roomStore
}));
var expectedState = _.extend({foo: "bar", savingContext: false},
var expectedState = _.extend({ foo: "bar", savingContext: false },
activeRoomStore.getInitialStoreState());
expect(testView.state).eql(expectedState);
@ -130,7 +130,7 @@ describe("loop.roomViews", function () {
roomStore: roomStore
}));
activeRoomStore.setStoreState({roomState: ROOM_STATES.READY});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
expect(testView.state.roomState).eql(ROOM_STATES.READY);
});
@ -346,7 +346,7 @@ describe("loop.roomViews", function () {
function() {
view = mountTestComponent();
view.setState({audioMuted: true});
view.setState({ audioMuted: true });
var muteBtn = view.getDOMNode().querySelector(".btn-mute-audio");
@ -364,7 +364,7 @@ describe("loop.roomViews", function () {
function() {
view = mountTestComponent();
view.setState({videoMuted: false});
view.setState({ videoMuted: false });
var muteBtn = view.getDOMNode().querySelector(".btn-mute-video");
@ -381,7 +381,7 @@ describe("loop.roomViews", function () {
it("should set the mute button as mute off", function() {
view = mountTestComponent();
view.setState({videoMuted: false});
view.setState({ videoMuted: false });
var muteBtn = view.getDOMNode().querySelector(".btn-mute-video");
@ -391,7 +391,7 @@ describe("loop.roomViews", function () {
it("should set the mute button as mute on", function() {
view = mountTestComponent();
view.setState({audioMuted: true});
view.setState({ audioMuted: true });
var muteBtn = view.getDOMNode().querySelector(".btn-mute-audio");
@ -401,7 +401,7 @@ describe("loop.roomViews", function () {
it("should dispatch a `StartScreenShare` action when sharing is not active and the screen share button is pressed", function() {
view = mountTestComponent();
view.setState({screenSharingState: SCREEN_SHARE_STATES.INACTIVE});
view.setState({ screenSharingState: SCREEN_SHARE_STATES.INACTIVE });
var muteBtn = view.getDOMNode().querySelector(".btn-mute-video");
@ -419,19 +419,19 @@ describe("loop.roomViews", function () {
}
it("should dispatch a `SetupStreamElements` action when the MEDIA_WAIT state is entered", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.READY});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
var component = mountTestComponent();
activeRoomStore.setStoreState({roomState: ROOM_STATES.MEDIA_WAIT});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.MEDIA_WAIT });
expectActionDispatched(component);
});
it("should dispatch a `SetupStreamElements` action on MEDIA_WAIT state is re-entered", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.ENDED });
var component = mountTestComponent();
activeRoomStore.setStoreState({roomState: ROOM_STATES.MEDIA_WAIT});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.MEDIA_WAIT });
expectActionDispatched(component);
});
@ -441,7 +441,7 @@ describe("loop.roomViews", function () {
it("should set document.title to store.serverData.roomName", function() {
mountTestComponent();
activeRoomStore.setStoreState({roomName: "fakeName"});
activeRoomStore.setStoreState({ roomName: "fakeName" });
expect(fakeWindow.document.title).to.equal("fakeName");
});
@ -474,7 +474,7 @@ describe("loop.roomViews", function () {
it("should render the DesktopRoomInvitationView if roomState is `JOINED`",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINED });
view = mountTestComponent();
@ -485,7 +485,7 @@ describe("loop.roomViews", function () {
it("should render the DesktopRoomInvitationView if roomState is `JOINED` with just owner",
function() {
activeRoomStore.setStoreState({
participants: [{owner: true}],
participants: [{ owner: true }],
roomState: ROOM_STATES.JOINED
});
@ -513,7 +513,7 @@ describe("loop.roomViews", function () {
it("should render the DesktopRoomConversationView if roomState is `JOINED` with participants",
function() {
activeRoomStore.setStoreState({
participants: [{owner: true}, {}],
participants: [{ owner: true }, {}],
roomState: ROOM_STATES.JOINED
});
@ -527,7 +527,7 @@ describe("loop.roomViews", function () {
it("should render the DesktopRoomConversationView if roomState is `HAS_PARTICIPANTS`",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.HAS_PARTICIPANTS });
view = mountTestComponent();
@ -841,7 +841,7 @@ describe("loop.roomViews", function () {
function() {
React.addons.TestUtils.Simulate.change(roomNameBox, { target: {
value: "reallyFake"
}});
} });
React.addons.TestUtils.Simulate.click(view.getDOMNode().querySelector(".button-accept"));
@ -860,9 +860,9 @@ describe("loop.roomViews", function () {
function() {
React.addons.TestUtils.Simulate.change(roomNameBox, { target: {
value: "reallyFake"
}});
} });
TestUtils.Simulate.keyDown(roomNameBox, {key: "Enter", which: 13});
TestUtils.Simulate.keyDown(roomNameBox, { key: "Enter", which: 13 });
sinon.assert.calledOnce(dispatcher.dispatch);
sinon.assert.calledWithExactly(dispatcher.dispatch,

View File

@ -3,7 +3,7 @@
"use strict";
const {CardDavImporter} = Cu.import("resource:///modules/loop/CardDavImporter.jsm", {});
const { CardDavImporter } = Cu.import("resource:///modules/loop/CardDavImporter.jsm", {});
const kAuth = {
"method": "basic",
@ -162,7 +162,7 @@ const monkeyPatchImporter = function(importer) {
reject(new Error("404 Not Found"));
return;
}
resolve({"responseXML": responseXML});
resolve({ "responseXML": responseXML });
});
}.bind(importer);
return importer;

View File

@ -3,7 +3,7 @@
"use strict";
const {GoogleImporter} = Cu.import("resource:///modules/loop/GoogleImporter.jsm", {});
const { GoogleImporter } = Cu.import("resource:///modules/loop/GoogleImporter.jsm", {});
var importer = new GoogleImporter();

View File

@ -3,8 +3,8 @@
"use strict";
const {LoopContacts} = Cu.import("resource:///modules/loop/LoopContacts.jsm", {});
const {LoopStorage} = Cu.import("resource:///modules/loop/LoopStorage.jsm", {});
const { LoopContacts } = Cu.import("resource:///modules/loop/LoopContacts.jsm", {});
const { LoopStorage } = Cu.import("resource:///modules/loop/LoopStorage.jsm", {});
XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
"@mozilla.org/uuid-generator;1",
@ -147,7 +147,7 @@ LoopContacts.on("add", onContactAdded);
LoopContacts.on("remove", onContactRemoved);
LoopContacts.on("update", onContactUpdated);
registerCleanupFunction(function () {
registerCleanupFunction(function() {
LoopContacts.removeAll(() => {});
LoopContacts.off("add", onContactAdded);
LoopContacts.off("remove", onContactRemoved);

View File

@ -8,8 +8,8 @@
*/
"use strict";
var {WebChannel} = Cu.import("resource://gre/modules/WebChannel.jsm", {});
var {Chat} = Cu.import("resource:///modules/Chat.jsm", {});
var { WebChannel } = Cu.import("resource://gre/modules/WebChannel.jsm", {});
var { Chat } = Cu.import("resource:///modules/Chat.jsm", {});
const TEST_URI =
"example.com/browser/browser/components/loop/test/mochitest/test_loopLinkClicker_channel.html";
@ -21,7 +21,7 @@ const LINKCLICKER_URL_PREFNAME = "loop.linkClicker.url";
var openChatOrig = Chat.open;
var fakeRoomList = new Map([[ ROOM_TOKEN, { roomToken: ROOM_TOKEN } ]]);
var fakeRoomList = new Map([[ROOM_TOKEN, { roomToken: ROOM_TOKEN }]]);
function BackChannel(uri) {
this.channel = new WebChannel("test-loop-link-clicker-backchannel", uri);

View File

@ -286,7 +286,7 @@ add_task(function* basicAuthorizationAndRegistration() {
yield MozLoopService.promiseRegisteredWithServers();
let statusChangedPromise = promiseObserverNotified("loop-status-changed");
yield loadLoopPanel({stayOnline: true});
yield loadLoopPanel({ stayOnline: true });
yield statusChangedPromise;
let loopDoc = document.getElementById("loop-panel-iframe").contentDocument;
let accountLogin = loopDoc.getElementsByClassName("signin-link")[0];
@ -319,7 +319,7 @@ add_task(function* basicAuthorizationAndRegistration() {
let loopPanel = document.getElementById("loop-notification-panel");
loopPanel.hidePopup();
statusChangedPromise = promiseObserverNotified("loop-status-changed");
yield loadLoopPanel({stayOnline: true});
yield loadLoopPanel({ stayOnline: true });
yield statusChangedPromise;
is(loopButton.getAttribute("state"), "", "state of loop button should return to empty after panel is opened");
loopPanel.hidePopup();

View File

@ -13,7 +13,7 @@ Components.utils.import("resource://gre/modules/Promise.jsm", this);
add_task(loadLoopPanel);
add_task(function* test_mozLoop_doNotDisturb() {
registerCleanupFunction(function () {
registerCleanupFunction(function() {
Services.prefs.clearUserPref("loop.do_not_disturb");
});

View File

@ -13,7 +13,7 @@ Components.utils.import("resource://gre/modules/Promise.jsm", this);
add_task(loadLoopPanel);
add_task(function* test_mozLoop_charPref() {
registerCleanupFunction(function () {
registerCleanupFunction(function() {
Services.prefs.clearUserPref("loop.test");
});
@ -30,7 +30,7 @@ add_task(function* test_mozLoop_charPref() {
});
add_task(function* test_mozLoop_boolPref() {
registerCleanupFunction(function () {
registerCleanupFunction(function() {
Services.prefs.clearUserPref("loop.testBool");
});

View File

@ -6,7 +6,7 @@
*/
"use strict";
const {injectLoopAPI} = Cu.import("resource:///modules/loop/MozLoopAPI.jsm", {});
const { injectLoopAPI } = Cu.import("resource:///modules/loop/MozLoopAPI.jsm", {});
gMozLoopAPI = injectLoopAPI({});
var handlers = [

View File

@ -9,7 +9,7 @@
"use strict";
Cu.import("resource://gre/modules/Promise.jsm");
const {SocialService} = Cu.import("resource://gre/modules/SocialService.jsm", {});
const { SocialService } = Cu.import("resource://gre/modules/SocialService.jsm", {});
add_task(loadLoopPanel);

View File

@ -17,7 +17,7 @@ add_task(loadLoopPanel);
add_task(function* test_initialize() {
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
registerCleanupFunction(function () {
registerCleanupFunction(function() {
Services.telemetry.canRecordExtended = oldCanRecord;
});
});

View File

@ -8,7 +8,7 @@
"use strict";
Components.utils.import("resource://gre/modules/Promise.jsm", this);
const {LoopRoomsInternal} = Components.utils.import("resource:///modules/loop/LoopRooms.jsm", {});
const { LoopRoomsInternal } = Components.utils.import("resource:///modules/loop/LoopRooms.jsm", {});
Services.prefs.setBoolPref("loop.gettingStarted.seen", true);
const fxASampleToken = {
@ -127,7 +127,7 @@ add_task(function* test_active() {
add_task(function* test_room_participants() {
Assert.strictEqual(LoopUI.toolbarButton.node.getAttribute("state"), "", "Check button is in default state");
Assert.strictEqual(LoopUI.toolbarButton.node.getAttribute("tooltiptext"), "Start a conversation", "Check button has default tooltiptext");
let roomsCache = new Map([[ "test_room", {participants: [{displayName: "hugh", id: "008", owner: true}]} ]]);
let roomsCache = new Map([["test_room", { participants: [{ displayName: "hugh", id: "008", owner: true }] }]]);
LoopRooms._setRoomsCache(roomsCache);
MozLoopServiceInternal.notifyStatusChanged();
// Since we're changing the rooms map directly, we're expecting it to be a synchronous operation.
@ -137,13 +137,13 @@ add_task(function* test_room_participants() {
yield new Promise(resolve => executeSoon(resolve));
Assert.strictEqual(LoopUI.toolbarButton.node.getAttribute("state"), "active", "Check button is in active state");
Assert.strictEqual(LoopUI.toolbarButton.node.getAttribute("tooltiptext"), "Active conversation", "Check button has active tooltiptext");
roomsCache.set("test_room", {participants: [{displayName: "hugh", id: "008", owner: false}]});
roomsCache.set("test_room", { participants: [{ displayName: "hugh", id: "008", owner: false }] });
LoopRooms._setRoomsCache(roomsCache);
MozLoopServiceInternal.notifyStatusChanged();
yield new Promise(resolve => executeSoon(resolve));
Assert.strictEqual(LoopUI.toolbarButton.node.getAttribute("state"), "active", "Check button is in active state");
Assert.strictEqual(LoopUI.toolbarButton.node.getAttribute("tooltiptext"), "Someone is waiting for you in a conversation", "Check button has participantswaiting tooltiptext");
roomsCache.set("test_room", {participants: []});
roomsCache.set("test_room", { participants: [] });
LoopRooms._setRoomsCache(roomsCache);
MozLoopServiceInternal.notifyStatusChanged();
Assert.strictEqual(LoopUI.toolbarButton.node.getAttribute("state"), "", "Check button is in default state");

View File

@ -9,7 +9,7 @@ const {
MozLoopServiceInternal,
MozLoopService
} = Cu.import("resource:///modules/loop/MozLoopService.jsm", {});
const {LoopRooms} = Cu.import("resource:///modules/loop/LoopRooms.jsm", {});
const { LoopRooms } = Cu.import("resource:///modules/loop/LoopRooms.jsm", {});
// Cache this value only once, at the beginning of a
// test run, so that it doesn't pick up the offline=true
@ -186,7 +186,7 @@ function promiseObserverNotified(aTopic, aExpectedData = null) {
Services.obs.addObserver(function onNotification(aSubject, topic, aData) {
Services.obs.removeObserver(onNotification, topic);
is(aData, aExpectedData, "observer data should match expected data");
resolve({subject: aSubject, data: aData});
resolve({ subject: aSubject, data: aData });
}, aTopic, false);
});
}

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.store.ActiveRoomStore", function () {
describe("loop.store.ActiveRoomStore", function() {
"use strict";
var expect = chai.expect;
@ -83,7 +83,7 @@ describe("loop.store.ActiveRoomStore", function () {
it("should throw an error if sdkDriver is missing", function() {
expect(function() {
new loop.store.ActiveRoomStore(dispatcher, {mozLoop: {}});
new loop.store.ActiveRoomStore(dispatcher, { mozLoop: {} });
}).to.Throw(/sdkDriver/);
});
});
@ -171,7 +171,7 @@ describe("loop.store.ActiveRoomStore", function () {
});
it("should set screen sharing inactive", function() {
store.setStoreState({windowId: "1234"});
store.setStoreState({ windowId: "1234" });
store.roomFailure(new sharedActions.RoomFailure({
error: fakeError,
@ -822,11 +822,11 @@ describe("loop.store.ActiveRoomStore", function () {
describe("#joinRoom", function() {
beforeEach(function() {
store.setStoreState({roomState: ROOM_STATES.READY});
store.setStoreState({ roomState: ROOM_STATES.READY });
});
it("should reset failureReason", function() {
store.setStoreState({failureReason: "Test"});
store.setStoreState({ failureReason: "Test" });
store.joinRoom();
@ -993,7 +993,7 @@ describe("loop.store.ActiveRoomStore", function () {
describe("#gotMediaPermission", function() {
beforeEach(function() {
store.setStoreState({roomToken: "tokenFake"});
store.setStoreState({ roomToken: "tokenFake" });
});
it("should set the room state to JOINING", function() {
@ -1160,7 +1160,7 @@ describe("loop.store.ActiveRoomStore", function () {
it("should call mozLoop.rooms.refreshMembership before the next expiresTime",
function() {
fakeMozLoop.rooms.refreshMembership.callsArgWith(2,
null, {expires: 40});
null, { expires: 40 });
store.joinedRoom(new sharedActions.JoinedRoom(fakeJoinedData));
@ -1232,7 +1232,7 @@ describe("loop.store.ActiveRoomStore", function () {
});
it("should set screen sharing inactive", function() {
store.setStoreState({windowId: "1234"});
store.setStoreState({ windowId: "1234" });
store.connectionFailure(connectionFailureAction);
@ -1307,7 +1307,7 @@ describe("loop.store.ActiveRoomStore", function () {
describe("#setMute", function() {
it("should save the mute state for the audio stream", function() {
store.setStoreState({audioMuted: false});
store.setStoreState({ audioMuted: false });
store.setMute(new sharedActions.SetMute({
type: "audio",
@ -1318,7 +1318,7 @@ describe("loop.store.ActiveRoomStore", function () {
});
it("should save the mute state for the video stream", function() {
store.setStoreState({videoMuted: true});
store.setStoreState({ videoMuted: true });
store.setMute(new sharedActions.SetMute({
type: "video",
@ -1333,7 +1333,7 @@ describe("loop.store.ActiveRoomStore", function () {
var fakeStreamElement;
beforeEach(function() {
fakeStreamElement = {name: "fakeStreamElement"};
fakeStreamElement = { name: "fakeStreamElement" };
});
it("should add a local video object to the store", function() {
@ -1399,7 +1399,7 @@ describe("loop.store.ActiveRoomStore", function () {
var fakeStreamElement;
beforeEach(function() {
fakeStreamElement = {name: "fakeStreamElement"};
fakeStreamElement = { name: "fakeStreamElement" };
store.setStoreState({
localSrcMediaElement: fakeStreamElement,
@ -1462,7 +1462,7 @@ describe("loop.store.ActiveRoomStore", function () {
describe("#screenSharingState", function() {
beforeEach(function() {
store.setStoreState({windowId: "1234"});
store.setStoreState({ windowId: "1234" });
});
it("should save the state", function() {
@ -1502,7 +1502,7 @@ describe("loop.store.ActiveRoomStore", function () {
});
it("should add a screenShareMediaElement to the store when sharing is active", function() {
var fakeStreamElement = {name: "fakeStreamElement"};
var fakeStreamElement = { name: "fakeStreamElement" };
expect(store.getStoreState()).to.not.have.property("screenShareMediaElement");
store.receivingScreenShare(new sharedActions.ReceivingScreenShare({
@ -1532,8 +1532,8 @@ describe("loop.store.ActiveRoomStore", function () {
it("should delete the screen remote video dimensions if screen sharing is not active", function() {
store.setStoreState({
remoteVideoDimensions: {
screen: {fake: 10},
camera: {fake: 20}
screen: { fake: 10 },
camera: { fake: 20 }
}
});
@ -1542,7 +1542,7 @@ describe("loop.store.ActiveRoomStore", function () {
}));
expect(store.getStoreState().remoteVideoDimensions).eql({
camera: {fake: 20}
camera: { fake: 20 }
});
});
});
@ -1703,7 +1703,7 @@ describe("loop.store.ActiveRoomStore", function () {
it("should remove non-owner participants", function() {
store.setStoreState({
participants: [{owner: true}, {}]
participants: [{ owner: true }, {}]
});
store.remotePeerDisconnected();
@ -1715,7 +1715,7 @@ describe("loop.store.ActiveRoomStore", function () {
it("should keep the owner participant", function() {
store.setStoreState({
participants: [{owner: true}]
participants: [{ owner: true }]
});
store.remotePeerDisconnected();
@ -1799,7 +1799,7 @@ describe("loop.store.ActiveRoomStore", function () {
it("should call mozLoop.rooms.leave if the room state is JOINING",
function() {
store.setStoreState({roomState: ROOM_STATES.JOINING});
store.setStoreState({ roomState: ROOM_STATES.JOINING });
store.windowUnload();

View File

@ -55,7 +55,7 @@ describe("loop.crypto", function() {
it("should encrypt an object with a specific key", function() {
return expect(loop.crypto.encryptBytes("Wt2-bZKeHO2wnaq00ZM6Nw",
JSON.stringify({test: true}))).to.eventually.be.a("string");
JSON.stringify({ test: true }))).to.eventually.be.a("string");
});
});
@ -72,7 +72,7 @@ describe("loop.crypto", function() {
var key = "Wt2-bZKeHO2wnaq00ZM6Nw";
var encryptedContext = "XvN9FDEm/GtE/5Bx5ezpn7JVDeZrtwOJy2CBjTGgJ4L33HhHOqEW+5k=";
return expect(loop.crypto.decryptBytes(key, encryptedContext)).to.eventually.eql(JSON.stringify({test: true}));
return expect(loop.crypto.decryptBytes(key, encryptedContext)).to.eventually.eql(JSON.stringify({ test: true }));
});
it("should fail if the key didn't work", function() {
@ -90,7 +90,7 @@ describe("loop.crypto", function() {
UTF8String: "对话"
});
return loop.crypto.generateKey().then(function (key) {
return loop.crypto.generateKey().then(function(key) {
loop.crypto.encryptBytes(key, context).then(function(encryptedContext) {
loop.crypto.decryptBytes(key, encryptedContext).then(function(decryptedContext) {
expect(decryptedContext).eql(context);

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.Dispatcher", function () {
describe("loop.Dispatcher", function() {
"use strict";
var expect = chai.expect;

View File

@ -28,26 +28,26 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
describe("loop.shared.views.LinkifiedTextView", function () {
describe("loop.shared.views.LinkifiedTextView", function() {
"use strict";
var expect = chai.expect;
var LinkifiedTextView = loop.shared.views.LinkifiedTextView;
var TestUtils = React.addons.TestUtils;
describe("LinkifiedTextView", function () {
describe("LinkifiedTextView", function() {
function renderToMarkup(string, extraProps) {
return React.renderToStaticMarkup(
React.createElement(
LinkifiedTextView,
_.extend({rawText: string}, extraProps)));
_.extend({ rawText: string }, extraProps)));
}
describe("#render", function() {
function testRender(testData) {
it(testData.desc, function() {
var markup = renderToMarkup(testData.rawText,
{suppressTarget: true, sendReferrer: true});
{ suppressTarget: true, sendReferrer: true });
expect(markup).to.equal(testData.markup);
});
@ -56,7 +56,7 @@ describe("loop.shared.views.LinkifiedTextView", function () {
function testSkip(testData) {
it.skip(testData.desc, function() {
var markup = renderToMarkup(testData.rawText,
{suppressTarget: true, sendReferrer: true});
{ suppressTarget: true, sendReferrer: true });
expect(markup).to.equal(testData.markup);
});
@ -65,7 +65,7 @@ describe("loop.shared.views.LinkifiedTextView", function () {
describe("this.props.suppressTarget", function() {
it("should make links w/o a target attr if suppressTarget is true",
function() {
var markup = renderToMarkup("http://example.com", {suppressTarget: true});
var markup = renderToMarkup("http://example.com", { suppressTarget: true });
expect(markup).to.equal(
'<p><a href="http://example.com" rel="noreferrer">http://example.com</a></p>');
@ -83,7 +83,7 @@ describe("loop.shared.views.LinkifiedTextView", function () {
describe("this.props.sendReferrer", function() {
it("should make links w/o rel=noreferrer if sendReferrer is true",
function() {
var markup = renderToMarkup("http://example.com", {sendReferrer: true});
var markup = renderToMarkup("http://example.com", { sendReferrer: true });
expect(markup).to.equal(
'<p><a href="http://example.com" target="_blank">http://example.com</a></p>');
@ -98,18 +98,18 @@ describe("loop.shared.views.LinkifiedTextView", function () {
});
});
describe("this.props.linkClickHandler", function () {
describe("this.props.linkClickHandler", function() {
function mountTestComponent(string, extraProps) {
return TestUtils.renderIntoDocument(
React.createElement(
LinkifiedTextView,
_.extend({rawText: string}, extraProps)));
_.extend({ rawText: string }, extraProps)));
}
it("should be called when a generated link is clicked", function () {
it("should be called when a generated link is clicked", function() {
var fakeUrl = "http://example.com";
var linkClickHandler = sinon.stub();
var comp = mountTestComponent(fakeUrl, {linkClickHandler: linkClickHandler});
var comp = mountTestComponent(fakeUrl, { linkClickHandler: linkClickHandler });
TestUtils.Simulate.click(comp.getDOMNode().querySelector("a"));
@ -131,7 +131,7 @@ describe("loop.shared.views.LinkifiedTextView", function () {
'<p><a href="http://example.com">http://example.com</a></p>');
});
describe("#_handleClickEvent", function () {
describe("#_handleClickEvent", function() {
var fakeEvent;
var fakeUrl = "http://example.com";
@ -143,10 +143,10 @@ describe("loop.shared.views.LinkifiedTextView", function () {
};
});
it("should call preventDefault on the given event", function () {
it("should call preventDefault on the given event", function() {
function linkClickHandler() {}
var comp = mountTestComponent(
fakeUrl, {linkClickHandler: linkClickHandler});
fakeUrl, { linkClickHandler: linkClickHandler });
comp._handleClickEvent(fakeEvent);
@ -154,10 +154,10 @@ describe("loop.shared.views.LinkifiedTextView", function () {
sinon.assert.calledWithExactly(fakeEvent.stopPropagation);
});
it("should call stopPropagation on the given event", function () {
it("should call stopPropagation on the given event", function() {
function linkClickHandler() {}
var comp = mountTestComponent(
fakeUrl, {linkClickHandler: linkClickHandler});
fakeUrl, { linkClickHandler: linkClickHandler });
comp._handleClickEvent(fakeEvent);
@ -165,10 +165,10 @@ describe("loop.shared.views.LinkifiedTextView", function () {
sinon.assert.calledWithExactly(fakeEvent.stopPropagation);
});
it("should call this.props.linkClickHandler with event.currentTarget.href", function () {
it("should call this.props.linkClickHandler with event.currentTarget.href", function() {
var linkClickHandler = sinon.stub();
var comp = mountTestComponent(
fakeUrl, {linkClickHandler: linkClickHandler});
fakeUrl, { linkClickHandler: linkClickHandler });
comp._handleClickEvent(fakeEvent);

View File

@ -24,7 +24,7 @@ describe("loop.shared.mixins", function() {
function createTestComponent(onUrlHashChange) {
var TestComp = React.createClass({
mixins: [loop.shared.mixins.UrlHashChangeMixin],
onUrlHashChange: onUrlHashChange || function(){},
onUrlHashChange: onUrlHashChange || function() {},
render: function() {
return React.DOM.div();
}
@ -173,7 +173,7 @@ describe("loop.shared.mixins", function() {
it("should call onDocumentVisible when document visibility changes to visible",
function() {
setupFakeVisibilityEventDispatcher({target: {hidden: false}});
setupFakeVisibilityEventDispatcher({ target: { hidden: false } });
comp = TestUtils.renderIntoDocument(React.createElement(TestComp));
@ -183,7 +183,7 @@ describe("loop.shared.mixins", function() {
it("should call onDocumentVisible when document visibility changes to hidden",
function() {
setupFakeVisibilityEventDispatcher({target: {hidden: true}});
setupFakeVisibilityEventDispatcher({ target: { hidden: true } });
comp = TestUtils.renderIntoDocument(React.createElement(TestComp));
@ -227,7 +227,7 @@ describe("loop.shared.mixins", function() {
navigator.mozLoop = {
doNotDisturb: true,
getAudioBlob: sinon.spy(function(name, callback) {
callback(null, new Blob([new ArrayBuffer(10)], {type: "audio/ogg"}));
callback(null, new Blob([new ArrayBuffer(10)], { type: "audio/ogg" }));
}),
getLoopPref: sandbox.stub()
};
@ -279,7 +279,7 @@ describe("loop.shared.mixins", function() {
},
getInitialState: function() {
return { roomState: initialState};
return { roomState: initialState };
}
});
@ -295,7 +295,7 @@ describe("loop.shared.mixins", function() {
it("should play a sound when the local user joins the room", function() {
comp = createTestComponent(ROOM_STATES.INIT);
comp.setState({roomState: ROOM_STATES.SESSION_CONNECTED});
comp.setState({ roomState: ROOM_STATES.SESSION_CONNECTED });
sinon.assert.calledOnce(comp.play);
sinon.assert.calledWithExactly(comp.play, "room-joined");
@ -304,7 +304,7 @@ describe("loop.shared.mixins", function() {
it("should play a sound when another user joins the room", function() {
comp = createTestComponent(ROOM_STATES.SESSION_CONNECTED);
comp.setState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
comp.setState({ roomState: ROOM_STATES.HAS_PARTICIPANTS });
sinon.assert.calledOnce(comp.play);
sinon.assert.calledWithExactly(comp.play, "room-joined-in");
@ -313,7 +313,7 @@ describe("loop.shared.mixins", function() {
it("should play a sound when another user leaves the room", function() {
comp = createTestComponent(ROOM_STATES.HAS_PARTICIPANTS);
comp.setState({roomState: ROOM_STATES.SESSION_CONNECTED});
comp.setState({ roomState: ROOM_STATES.SESSION_CONNECTED });
sinon.assert.calledOnce(comp.play);
sinon.assert.calledWithExactly(comp.play, "room-left");
@ -322,7 +322,7 @@ describe("loop.shared.mixins", function() {
it("should play a sound when the local user leaves the room", function() {
comp = createTestComponent(ROOM_STATES.HAS_PARTICIPANTS);
comp.setState({roomState: ROOM_STATES.READY});
comp.setState({ roomState: ROOM_STATES.READY });
sinon.assert.calledOnce(comp.play);
sinon.assert.calledWithExactly(comp.play, "room-left");
@ -331,7 +331,7 @@ describe("loop.shared.mixins", function() {
it("should play a sound when if there is a failure", function() {
comp = createTestComponent(ROOM_STATES.HAS_PARTICIPANTS);
comp.setState({roomState: ROOM_STATES.FAILED});
comp.setState({ roomState: ROOM_STATES.FAILED });
sinon.assert.calledOnce(comp.play);
sinon.assert.calledWithExactly(comp.play, "failure");
@ -340,7 +340,7 @@ describe("loop.shared.mixins", function() {
it("should play a sound when if the room is full", function() {
comp = createTestComponent(ROOM_STATES.READY);
comp.setState({roomState: ROOM_STATES.FULL});
comp.setState({ roomState: ROOM_STATES.FULL });
sinon.assert.calledOnce(comp.play);
sinon.assert.calledWithExactly(comp.play, "failure");

View File

@ -26,7 +26,7 @@ describe("loop.shared.models", function() {
sandbox.stub(l10n, "get", function(x, y) {
return "translated:" + x + (y ? ":" + y : "");
});
notifData = {level: "error", message: "plop"};
notifData = { level: "error", message: "plop" };
testNotif = new sharedModels.NotificationModel(notifData);
});

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.OTSdkDriver", function () {
describe("loop.OTSdkDriver", function() {
"use strict";
var expect = chai.expect;
@ -110,7 +110,7 @@ describe("loop.OTSdkDriver", function () {
it("should throw an error if the sdk is missing", function() {
expect(function() {
new loop.OTSdkDriver({dispatcher: dispatcher});
new loop.OTSdkDriver({ dispatcher: dispatcher });
}).to.Throw(/sdk/);
});
@ -340,7 +340,7 @@ describe("loop.OTSdkDriver", function () {
sinon.assert.calledWithExactly(sdk.initSession, "3216549870");
});
it("should connect the session", function () {
it("should connect the session", function() {
driver.connectSession(sessionData);
sinon.assert.calledOnce(session.connect);
@ -350,7 +350,7 @@ describe("loop.OTSdkDriver", function () {
it("should set the two-way media start time to 'uninitialized' " +
"when sessionData.sendTwoWayMediaTelemetry is true'", function() {
driver.connectSession(_.extend(sessionData,
{sendTwoWayMediaTelemetry: true}));
{ sendTwoWayMediaTelemetry: true }));
expect(driver._getTwoWayMediaStartTime()).to.eql(
driver.CONNECTION_START_TIME_UNINITIALIZED);
@ -702,7 +702,7 @@ describe("loop.OTSdkDriver", function () {
id: "localUser"
};
session.trigger("connectionCreated", {
connection: {id: "remoteUser"}
connection: { id: "remoteUser" }
});
expect(driver.connections).to.include.keys("remoteUser");
@ -711,7 +711,7 @@ describe("loop.OTSdkDriver", function () {
// Add another remote connection.
session.trigger("connectionCreated", {
connection: {id: "remoteUser2"}
connection: { id: "remoteUser2" }
});
expect(driver.connections).to.include.keys("remoteUser", "remoteUser2");
@ -748,7 +748,7 @@ describe("loop.OTSdkDriver", function () {
fakeStream = {
hasVideo: true,
videoType: "camera",
videoDimensions: {width: 1, height: 2}
videoDimensions: { width: 1, height: 2 }
};
fakeSubscriberObject = _.extend({
@ -907,7 +907,7 @@ describe("loop.OTSdkDriver", function () {
stream = {
hasVideo: true,
videoType: "camera",
videoDimensions: {width: 1, height: 2}
videoDimensions: { width: 1, height: 2 }
};
});
@ -919,7 +919,7 @@ describe("loop.OTSdkDriver", function () {
new sharedActions.VideoDimensionsChanged({
isLocal: true,
videoType: "camera",
dimensions: {width: 1, height: 2}
dimensions: { width: 1, height: 2 }
}));
});
@ -952,7 +952,7 @@ describe("loop.OTSdkDriver", function () {
driver._metrics.recvStreams = 1;
driver._metrics.connections = 2;
publisher.trigger("streamCreated", {stream: stream});
publisher.trigger("streamCreated", { stream: stream });
sinon.assert.called(dispatcher.dispatch);
sinon.assert.calledWithExactly(dispatcher.dispatch,
@ -1132,10 +1132,10 @@ describe("loop.OTSdkDriver", function () {
it("should not dispatch a ReceivingScreenShare action for camera streams",
function() {
session.trigger("streamCreated", {stream: fakeStream});
session.trigger("streamCreated", { stream: fakeStream });
sinon.assert.neverCalledWithMatch(dispatcher.dispatch,
new sharedActions.ReceivingScreenShare({receiving: true}));
new sharedActions.ReceivingScreenShare({ receiving: true }));
});
it("should dispatch a ReceivingScreenShare action for screen" +
@ -1215,7 +1215,7 @@ describe("loop.OTSdkDriver", function () {
driver._metrics.sendStreams = 1;
driver._metrics.recvStreams = 1;
session.trigger("streamDestroyed", {stream: stream});
session.trigger("streamDestroyed", { stream: stream });
sinon.assert.called(dispatcher.dispatch);
sinon.assert.calledWithExactly(dispatcher.dispatch,
@ -1448,7 +1448,7 @@ describe("loop.OTSdkDriver", function () {
it("should dispatch a RemoteVideoStatus action", function() {
session.subscribe.yieldsOn(driver, null, fakeSubscriberObject,
videoElement).returns(this.fakeSubscriberObject);
session.trigger("streamCreated", {stream: fakeSubscriberObject.stream});
session.trigger("streamCreated", { stream: fakeSubscriberObject.stream });
driver._mockSubscribeEl.appendChild(videoElement);
fakeSubscriberObject.trigger("videoEnabled");
@ -1465,7 +1465,7 @@ describe("loop.OTSdkDriver", function () {
it("should dispatch a RemoteVideoStatus action", function() {
session.subscribe.yieldsOn(driver, null, fakeSubscriberObject,
videoElement).returns(this.fakeSubscriberObject);
session.trigger("streamCreated", {stream: fakeSubscriberObject.stream});
session.trigger("streamCreated", { stream: fakeSubscriberObject.stream });
fakeSubscriberObject.trigger("videoDisabled");

View File

@ -7,7 +7,7 @@
* an interface that tests can mock out, without needing to maintain a copy of
* the sdk or load one from the network.
*/
(function (window) {
(function(window) {
"use strict";
if (!window.OT) {

View File

@ -2,7 +2,7 @@
* 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/. */
describe("loop.store", function () {
describe("loop.store", function() {
"use strict";
var expect = chai.expect;
@ -40,8 +40,8 @@ describe("loop.store", function () {
it("should call initialize() when constructed, if defined", function() {
var initialize = sandbox.spy();
var TestStore = loop.store.createStore({initialize: initialize});
var options = {fake: true};
var TestStore = loop.store.createStore({ initialize: initialize });
var options = { fake: true };
new TestStore(dispatcher, options);
@ -79,13 +79,13 @@ describe("loop.store", function () {
it("should set initial store state if provided", function() {
var TestStore = loop.store.createStore({
getInitialStoreState: function() {
return {foo: "bar"};
return { foo: "bar" };
}
});
var store = new TestStore(dispatcher);
expect(store.getStoreState()).eql({foo: "bar"});
expect(store.getStoreState()).eql({ foo: "bar" });
});
});
@ -110,11 +110,11 @@ describe("loop.store", function () {
beforeEach(function() {
store = new TestStore(dispatcher);
store.setStoreState({foo: "bar", bar: "baz"});
store.setStoreState({ foo: "bar", bar: "baz" });
});
it("should retrieve the whole state by default", function() {
expect(store.getStoreState()).eql({foo: "bar", bar: "baz"});
expect(store.getStoreState()).eql({ foo: "bar", bar: "baz" });
});
it("should retrieve a given property state", function() {
@ -128,11 +128,11 @@ describe("loop.store", function () {
beforeEach(function() {
store = new TestStore(dispatcher);
store.setStoreState({foo: "bar"});
store.setStoreState({ foo: "bar" });
});
it("should update store state data", function() {
store.setStoreState({foo: "baz"});
store.setStoreState({ foo: "baz" });
expect(store.getStoreState("foo")).eql("baz");
});
@ -142,7 +142,7 @@ describe("loop.store", function () {
done();
});
store.setStoreState({foo: "baz"});
store.setStoreState({ foo: "baz" });
});
it("should trigger a `change:<prop>` event", function(done) {
@ -150,7 +150,7 @@ describe("loop.store", function () {
done();
});
store.setStoreState({foo: "baz"});
store.setStoreState({ foo: "baz" });
});
});
});
@ -164,7 +164,7 @@ describe("loop.store", function () {
store = new storeClass(dispatcher);
loop.store.StoreMixin.register({store: store});
loop.store.StoreMixin.register({ store: store });
testComp = React.createClass({
mixins: [loop.store.StoreMixin("store")],
@ -177,16 +177,16 @@ describe("loop.store", function () {
});
it("should update the state when the store changes", function() {
store.setStoreState({test: true});
store.setStoreState({ test: true });
expect(view1.state).eql({test: true});
expect(view1.state).eql({ test: true });
});
it("should stop listening to state changes", function() {
// There's no easy way in TestUtils to unmount, so simulate it.
view1.componentWillUnmount();
store.setStoreState({test2: true});
store.setStoreState({ test2: true });
expect(view1.state).eql(null);
});
@ -197,9 +197,9 @@ describe("loop.store", function () {
// There's no easy way in TestUtils to unmount, so simulate it.
view1.componentWillUnmount();
store.setStoreState({test3: true});
store.setStoreState({ test3: true });
expect(view2.state).eql({test3: true});
expect(view2.state).eql({ test3: true });
});
});
});

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.store.TextChatStore", function () {
describe("loop.store.TextChatStore", function() {
"use strict";
var expect = chai.expect;

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.shared.views.TextChatView", function () {
describe("loop.shared.views.TextChatView", function() {
"use strict";
var expect = chai.expect;
@ -376,7 +376,7 @@ describe("loop.shared.views.TextChatView", function () {
// note that this is really an integration test to be sure that we don't
// inadvertently regress using LinkifiedTextView.
it("should linkify a URL starting with http", function (){
it("should linkify a URL starting with http", function() {
view = mountTestComponent({
showTimestamp: true,
timestamp: "2015-06-23T22:48:39.738Z",

View File

@ -65,7 +65,7 @@ describe("loop.shared.utils", function() {
sinon.assert.calledOnce(Date.prototype.toLocaleDateString);
sinon.assert.calledWithExactly(Date.prototype.toLocaleDateString,
navigator.language,
{year: "numeric", month: "long", day: "numeric"}
{ year: "numeric", month: "long", day: "numeric" }
);
});
@ -321,7 +321,7 @@ describe("loop.shared.utils", function() {
beforeEach(function() {
// fake mozL10n
sandbox.stub(navigator.mozL10n, "get", function(id) {
switch(id) {
switch (id) {
case "share_email_subject6":
return "subject";
case "share_email_body6":
@ -366,7 +366,7 @@ describe("loop.shared.utils", function() {
sharedUtils.composeCallUrlEmail("http://invalid", null,
"Hello, is me you're looking for?", "callfailed");
sinon.assert.calledOnce(telemetryAddValue, "LOOP_SHARING_ROOM_URL", 2);
sinon.assert.calledOnce(telemetryAddValue, "LOOP_SHARING_ROOM_URL", 2);
});
it("should log an error for invalid URLs", function() {

View File

@ -13,8 +13,8 @@ describe("Validator", function() {
}
// test types
function X(){}
function Y(){}
function X() {}
function Y() {}
describe("#validate", function() {
function RTCSessionDescription() {}
@ -26,61 +26,61 @@ describe("Validator", function() {
it("should check for a single required dependency when no option passed",
function() {
expect(create({x: Number}, {}))
expect(create({ x: Number }, {}))
.to.Throw(TypeError, /missing required x$/);
});
it("should check for a missing required dependency, undefined passed",
function() {
expect(create({x: Number}, {x: undefined}))
expect(create({ x: Number }, { x: undefined }))
.to.Throw(TypeError, /missing required x$/);
});
it("should check for multiple missing required dependencies", function() {
expect(create({x: Number, y: String}, {}))
expect(create({ x: Number, y: String }, {}))
.to.Throw(TypeError, /missing required x, y$/);
});
it("should check for required dependency types", function() {
expect(create({x: Number}, {x: "woops"})).to.Throw(
expect(create({ x: Number }, { x: "woops" })).to.Throw(
TypeError, /invalid dependency: x; expected Number, got String$/);
});
it("should check for a dependency to match at least one of passed types",
function() {
expect(create({x: [X, Y]}, {x: 42})).to.Throw(
expect(create({ x: [X, Y] }, { x: 42 })).to.Throw(
TypeError, /invalid dependency: x; expected X, Y, got Number$/);
expect(create({x: [X, Y]}, {x: new Y()})).to.not.Throw();
expect(create({ x: [X, Y] }, { x: new Y() })).to.not.Throw();
});
it("should skip type check if required dependency type is undefined",
function() {
expect(create({x: undefined}, {x: /whatever/})).not.to.Throw();
expect(create({ x: undefined }, { x: /whatever/ })).not.to.Throw();
});
it("should check for a String dependency", function() {
expect(create({foo: String}, {foo: 42})).to.Throw(
expect(create({ foo: String }, { foo: 42 })).to.Throw(
TypeError, /invalid dependency: foo/);
});
it("should check for a Number dependency", function() {
expect(create({foo: Number}, {foo: "x"})).to.Throw(
expect(create({ foo: Number }, { foo: "x" })).to.Throw(
TypeError, /invalid dependency: foo/);
});
it("should check for a custom constructor dependency", function() {
expect(create({foo: X}, {foo: null})).to.Throw(
expect(create({ foo: X }, { foo: null })).to.Throw(
TypeError, /invalid dependency: foo; expected X, got null$/);
});
it("should check for a native constructor dependency", function() {
expect(create({foo: rtcsd}, {foo: "x"}))
expect(create({ foo: rtcsd }, { foo: "x" }))
.to.Throw(TypeError,
/invalid dependency: foo; expected RTCSessionDescription/);
});
it("should check for a null dependency", function() {
expect(create({foo: null}, {foo: "x"})).to.Throw(
expect(create({ foo: null }, { foo: "x" })).to.Throw(
TypeError, /invalid dependency: foo; expected null, got String$/);
});
});

View File

@ -60,7 +60,7 @@ describe("loop.shared.views", function() {
React.createElement(sharedViews.MediaControlButton, {
scope: "local",
type: "audio",
action: function(){},
action: function() {},
enabled: true
}));
@ -72,7 +72,7 @@ describe("loop.shared.views", function() {
React.createElement(sharedViews.MediaControlButton, {
scope: "local",
type: "audio",
action: function(){},
action: function() {},
enabled: false
}));
@ -84,7 +84,7 @@ describe("loop.shared.views", function() {
React.createElement(sharedViews.MediaControlButton, {
scope: "local",
type: "video",
action: function(){},
action: function() {},
enabled: true
}));
@ -96,7 +96,7 @@ describe("loop.shared.views", function() {
React.createElement(sharedViews.MediaControlButton, {
scope: "local",
type: "video",
action: function(){},
action: function() {},
enabled: false
}));
@ -292,7 +292,7 @@ describe("loop.shared.views", function() {
fakeMozLoop = {
openURL: sandbox.stub(),
setLoopPref: sandbox.stub(),
getLoopPref: function (prefName) {
getLoopPref: function(prefName) {
switch (prefName) {
case "support_url":
return support_url;
@ -314,7 +314,7 @@ describe("loop.shared.views", function() {
it("should render a visible button", function() {
var settingsMenuItems = [{ id: "help" }];
var comp = mountTestComponent({ menuItems: settingsMenuItems} );
var comp = mountTestComponent({ menuItems: settingsMenuItems });
var node = comp.getDOMNode().querySelector(".btn-settings");
expect(node.classList.contains("hide")).eql(false);
@ -330,7 +330,7 @@ describe("loop.shared.views", function() {
{ id: "not Defined" },
{ id: "help" }
];
var comp = mountTestComponent({ menuItems: settingsMenuItems} );
var comp = mountTestComponent({ menuItems: settingsMenuItems });
var menuItems = comp.getDOMNode().querySelectorAll(".settings-menu > li");
expect(menuItems).to.have.length.of(1);
});
@ -340,13 +340,13 @@ describe("loop.shared.views", function() {
{ id: "not Defined" },
{ id: "another wrong menu item" }
];
var comp = mountTestComponent({ menuItems: settingsMenuItems} );
var comp = mountTestComponent({ menuItems: settingsMenuItems });
expect(comp.getDOMNode()).to.eql(null);
});
it("should show the settings dropdown on click", function() {
var settingsMenuItems = [{ id: "help" }];
var comp = mountTestComponent({ menuItems: settingsMenuItems} );
var comp = mountTestComponent({ menuItems: settingsMenuItems });
expect(comp.state.showMenu).eql(false);
TestUtils.Simulate.click(comp.getDOMNode().querySelector(".btn-settings"));
@ -388,7 +388,7 @@ describe("loop.shared.views", function() {
onClick: function() {}
}
];
var comp = mountTestComponent({ menuItems: settingsMenuItems} );
var comp = mountTestComponent({ menuItems: settingsMenuItems });
var node = comp.getDOMNode().querySelector(".settings-menu > li.entry-settings-edit");
expect(node.classList.contains("hide")).eql(false);
@ -403,7 +403,7 @@ describe("loop.shared.views", function() {
onClick: function() {}
}
];
var comp = mountTestComponent({ menuItems: settingsMenuItems} );
var comp = mountTestComponent({ menuItems: settingsMenuItems });
var node = comp.getDOMNode().querySelector(".settings-menu > li.entry-settings-edit");
expect(node.classList.contains("hide")).eql(true);
@ -419,7 +419,7 @@ describe("loop.shared.views", function() {
onClick: sandbox.stub()
}
];
var comp = mountTestComponent({ menuItems: settingsMenuItems} );
var comp = mountTestComponent({ menuItems: settingsMenuItems });
TestUtils.Simulate.click(comp.getDOMNode().querySelector(".settings-menu > li.entry-settings-edit"));
sinon.assert.calledOnce(settingsMenuItems[0].onClick);
@ -429,7 +429,7 @@ describe("loop.shared.views", function() {
var settingsMenuItems = [
{ id: "help" }
];
var comp = mountTestComponent({ menuItems: settingsMenuItems} );
var comp = mountTestComponent({ menuItems: settingsMenuItems });
TestUtils.Simulate.click(comp.getDOMNode().querySelector(".settings-menu > li:last-child"));
@ -521,7 +521,7 @@ describe("loop.shared.views", function() {
var comp = mountTestComponent({
hangup: hangup,
publishStream: publishStream,
audio: {enabled: true}
audio: { enabled: true }
});
TestUtils.Simulate.click(
@ -535,7 +535,7 @@ describe("loop.shared.views", function() {
var comp = mountTestComponent({
hangup: hangup,
publishStream: publishStream,
audio: {enabled: true}
audio: { enabled: true }
});
TestUtils.Simulate.click(
@ -549,7 +549,7 @@ describe("loop.shared.views", function() {
var comp = mountTestComponent({
hangup: hangup,
publishStream: publishStream,
audio: {enabled: false}
audio: { enabled: false }
});
TestUtils.Simulate.click(
@ -563,7 +563,7 @@ describe("loop.shared.views", function() {
var comp = mountTestComponent({
hangup: hangup,
publishStream: publishStream,
video: {enabled: true}
video: { enabled: true }
});
TestUtils.Simulate.click(
@ -577,7 +577,7 @@ describe("loop.shared.views", function() {
var comp = mountTestComponent({
hangup: hangup,
publishStream: publishStream,
video: {enabled: false}
video: { enabled: false }
});
TestUtils.Simulate.click(
@ -601,8 +601,8 @@ describe("loop.shared.views", function() {
beforeEach(function() {
coll = new sharedModels.NotificationCollection();
view = mountTestComponent({notifications: coll});
testNotif = {level: "warning", message: "foo"};
view = mountTestComponent({ notifications: coll });
testNotif = { level: "warning", message: "foo" };
sinon.spy(view, "render");
});
@ -690,7 +690,7 @@ describe("loop.shared.views", function() {
checked: true
});
view.setProps({checked: false});
view.setProps({ checked: false });
var checkbox = view.getDOMNode().querySelector(".checkbox");
expect(checkbox.classList.contains("checked")).eql(false);
@ -979,10 +979,10 @@ describe("loop.shared.views", function() {
sinon.stub(view, "getDOMNode").returns(fakeViewElement);
view.attachVideo({
srcObject: {fake: 1}
srcObject: { fake: 1 }
});
expect(fakeViewElement.srcObject).eql({fake: 1});
expect(fakeViewElement.srcObject).eql({ fake: 1 });
});
it("should attach a video object for Firefox", function() {
@ -991,10 +991,10 @@ describe("loop.shared.views", function() {
sinon.stub(view, "getDOMNode").returns(fakeViewElement);
view.attachVideo({
mozSrcObject: {fake: 2}
mozSrcObject: { fake: 2 }
});
expect(fakeViewElement.mozSrcObject).eql({fake: 2});
expect(fakeViewElement.mozSrcObject).eql({ fake: 2 });
});
it("should attach a video object for Chrome", function() {
@ -1003,10 +1003,10 @@ describe("loop.shared.views", function() {
sinon.stub(view, "getDOMNode").returns(fakeViewElement);
view.attachVideo({
src: {fake: 2}
src: { fake: 2 }
});
expect(fakeViewElement.src).eql({fake: 2});
expect(fakeViewElement.src).eql({ fake: 2 });
});
});
});
@ -1038,7 +1038,7 @@ describe("loop.shared.views", function() {
sdkDriver: {}
});
loop.store.StoreMixin.register({textChatStore: textChatStore});
loop.store.StoreMixin.register({ textChatStore: textChatStore });
});
it("should mark the remote stream as the focus stream when not displaying screen share", function() {

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
describe("loop.store.StandaloneAppStore", function () {
describe("loop.store.StandaloneAppStore", function() {
"use strict";
var expect = chai.expect;

View File

@ -193,7 +193,7 @@ describe("loop.store.StandaloneMetricsStore", function() {
describe("Store Change Handlers", function() {
it("should log an event on room full", function() {
fakeActiveRoomStore.setStoreState({roomState: ROOM_STATES.FULL});
fakeActiveRoomStore.setStoreState({ roomState: ROOM_STATES.FULL });
sinon.assert.calledOnce(window.ga);
sinon.assert.calledWithExactly(window.ga,

View File

@ -14,7 +14,7 @@ describe("loop.StandaloneMozLoop", function() {
fakeXHR = sandbox.useFakeXMLHttpRequest();
requests = [];
// https://github.com/cjohansen/Sinon.JS/issues/393
fakeXHR.xhr.onCreate = function (xhr) {
fakeXHR.xhr.onCreate = function(xhr) {
requests.push(xhr);
};
fakeBaseServerUrl = "http://fake.api";
@ -86,7 +86,7 @@ describe("loop.StandaloneMozLoop", function() {
roomUrl: "http://invalid"
};
requests[0].respond(200, {"Content-Type": "application/json"},
requests[0].respond(200, { "Content-Type": "application/json" },
JSON.stringify(roomDetails));
sinon.assert.calledOnce(callback);
@ -96,7 +96,7 @@ describe("loop.StandaloneMozLoop", function() {
it("should call the callback with failure parameters", function() {
mozLoop.rooms.get("fakeToken", callback);
requests[0].respond(401, {"Content-Type": "application/json"},
requests[0].respond(401, { "Content-Type": "application/json" },
JSON.stringify(fakeServerErrorDescription));
sinon.assert.calledWithMatch(callback, sinon.match(function(err) {
return /HTTP 401 Unauthorized/.test(err.message);
@ -126,7 +126,7 @@ describe("loop.StandaloneMozLoop", function() {
expires: 20
};
requests[0].respond(200, {"Content-Type": "application/json"},
requests[0].respond(200, { "Content-Type": "application/json" },
JSON.stringify(sessionData));
sinon.assert.calledOnce(callback);
@ -136,7 +136,7 @@ describe("loop.StandaloneMozLoop", function() {
it("should call the callback with failure parameters", function() {
mozLoop.rooms.join("fakeToken", callback);
requests[0].respond(401, {"Content-Type": "application/json"},
requests[0].respond(401, { "Content-Type": "application/json" },
JSON.stringify(fakeServerErrorDescription));
sinon.assert.calledWithMatch(callback, sinon.match(function(err) {
return /HTTP 401 Unauthorized/.test(err.message);
@ -184,7 +184,7 @@ describe("loop.StandaloneMozLoop", function() {
expires: 20
};
requests[0].respond(200, {"Content-Type": "application/json"},
requests[0].respond(200, { "Content-Type": "application/json" },
JSON.stringify(responseData));
sinon.assert.calledOnce(callback);
@ -195,7 +195,7 @@ describe("loop.StandaloneMozLoop", function() {
standaloneMozLoop.rooms.refreshMembership("fakeToken", "fakeSessionToken",
callback);
requests[0].respond(401, {"Content-Type": "application/json"},
requests[0].respond(401, { "Content-Type": "application/json" },
JSON.stringify(fakeServerErrDescription));
sinon.assert.calledWithMatch(callback, sinon.match(function(err) {
return /HTTP 401 Unauthorized/.test(err.message);
@ -230,7 +230,7 @@ describe("loop.StandaloneMozLoop", function() {
it("should call the callback with failure parameters", function() {
mozLoop.rooms.leave("fakeToken", "fakeSessionToken", callback);
requests[0].respond(401, {"Content-Type": "application/json"},
requests[0].respond(401, { "Content-Type": "application/json" },
JSON.stringify(fakeServerErrorDescription));
sinon.assert.calledWithMatch(callback, sinon.match(function(err) {
return /HTTP 401 Unauthorized/.test(err.message);

View File

@ -39,7 +39,7 @@ describe("loop.standaloneRoomViews", function() {
fakeWindow = {
close: sandbox.stub(),
addEventListener: function() {},
document: { addEventListener: function(){} },
document: { addEventListener: function() {} },
removeEventListener: function() {},
setTimeout: function(callback) { callback(); }
};
@ -47,7 +47,7 @@ describe("loop.standaloneRoomViews", function() {
sandbox.stub(navigator.mozL10n, "get", function(key, args) {
switch(key) {
switch (key) {
case "standalone_title_with_room_name":
return args.roomName + " — " + args.clientShortname;
case "legal_text_and_links":
@ -366,37 +366,37 @@ describe("loop.standaloneRoomViews", function() {
describe("#componentWillUpdate", function() {
it("should set document.title to roomName and brand name when the READY state is dispatched", function() {
activeRoomStore.setStoreState({roomName: "fakeName", roomState: ROOM_STATES.INIT});
activeRoomStore.setStoreState({ roomName: "fakeName", roomState: ROOM_STATES.INIT });
view = mountTestComponent();
activeRoomStore.setStoreState({roomState: ROOM_STATES.READY});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
expect(fakeWindow.document.title).to.equal("fakeName — clientShortname2");
});
it("should set document.title brand name when there is no context available", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.INIT});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.INIT });
view = mountTestComponent();
activeRoomStore.setStoreState({roomState: ROOM_STATES.READY});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
expect(fakeWindow.document.title).to.equal("clientShortname2");
});
it("should dispatch a `SetupStreamElements` action when the MEDIA_WAIT state " +
"is entered", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.READY});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
view = mountTestComponent();
activeRoomStore.setStoreState({roomState: ROOM_STATES.MEDIA_WAIT});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.MEDIA_WAIT });
expectActionDispatched(view);
});
it("should dispatch a `SetupStreamElements` action on MEDIA_WAIT state is " +
"re-entered", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.ENDED });
view = mountTestComponent();
activeRoomStore.setStoreState({roomState: ROOM_STATES.MEDIA_WAIT});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.MEDIA_WAIT });
expectActionDispatched(view);
});
@ -405,8 +405,8 @@ describe("loop.standaloneRoomViews", function() {
describe("#componentDidUpdate", function() {
beforeEach(function() {
view = mountTestComponent();
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINING});
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINING });
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINED });
});
it("should not dispatch a `TileShown` action immediately in the JOINED state",
@ -424,7 +424,7 @@ describe("loop.standaloneRoomViews", function() {
it("should dispatch a single `TileShown` action after a wait when going through multiple waiting states",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.SESSION_CONNECTED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.SESSION_CONNECTED });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
sinon.assert.calledOnce(dispatch);
@ -433,7 +433,7 @@ describe("loop.standaloneRoomViews", function() {
it("should not dispatch a `TileShown` action after a wait when in the HAS_PARTICIPANTS state",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.HAS_PARTICIPANTS });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
sinon.assert.notCalled(dispatch);
@ -441,7 +441,7 @@ describe("loop.standaloneRoomViews", function() {
it("should dispatch a `TileShown` action after a wait when a participant leaves",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.HAS_PARTICIPANTS });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
activeRoomStore.remotePeerDisconnected();
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
@ -456,7 +456,7 @@ describe("loop.standaloneRoomViews", function() {
view = mountTestComponent();
// Pretend the user waited a little bit
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINING});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINING });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY - 1);
});
@ -473,8 +473,8 @@ describe("loop.standaloneRoomViews", function() {
function() {
// Trigger the first message then rejoin and wait
clock.tick(1);
activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED});
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINING});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.ENDED });
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINING });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
sinon.assert.calledTwice(dispatch);
@ -485,8 +485,8 @@ describe("loop.standaloneRoomViews", function() {
describe("Handle leaving quickly", function() {
beforeEach(function() {
// The user left and rejoined
activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED});
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINING});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.ENDED });
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINING });
});
it("should not dispatch an old `TileShown` action after leaving and rejoining",
@ -541,13 +541,13 @@ describe("loop.standaloneRoomViews", function() {
describe("#render", function() {
beforeEach(function() {
view = mountTestComponent();
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINING});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINING });
});
describe("Empty room message", function() {
it("should not display an message immediately in the JOINED state",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINED });
expect(view.getDOMNode().querySelector(".empty-room-message"))
.eql(null);
@ -555,7 +555,7 @@ describe("loop.standaloneRoomViews", function() {
it("should display an empty room message after a wait when in the JOINED state",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINED });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
expect(view.getDOMNode().querySelector(".empty-room-message"))
@ -564,7 +564,7 @@ describe("loop.standaloneRoomViews", function() {
it("should not display an message immediately in the SESSION_CONNECTED state",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.SESSION_CONNECTED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.SESSION_CONNECTED });
expect(view.getDOMNode().querySelector(".empty-room-message"))
.eql(null);
@ -572,7 +572,7 @@ describe("loop.standaloneRoomViews", function() {
it("should display an empty room message after a wait when in the SESSION_CONNECTED state",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.SESSION_CONNECTED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.SESSION_CONNECTED });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
expect(view.getDOMNode().querySelector(".empty-room-message"))
@ -581,7 +581,7 @@ describe("loop.standaloneRoomViews", function() {
it("should not display an message immediately in the HAS_PARTICIPANTS state",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.HAS_PARTICIPANTS });
expect(view.getDOMNode().querySelector(".empty-room-message"))
.eql(null);
@ -589,7 +589,7 @@ describe("loop.standaloneRoomViews", function() {
it("should not display an empty room message even after a wait when in the HAS_PARTICIPANTS state",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.HAS_PARTICIPANTS });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
expect(view.getDOMNode().querySelector(".empty-room-message"))
@ -601,7 +601,7 @@ describe("loop.standaloneRoomViews", function() {
it("should display a waiting room message and tile iframe on JOINED", function() {
var DUMMY_TILE_URL = "http://tile/";
loop.config.tilesIframeUrl = DUMMY_TILE_URL;
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINED });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
expect(view.getDOMNode().querySelector(".room-waiting-area")).not.eql(null);
@ -612,7 +612,7 @@ describe("loop.standaloneRoomViews", function() {
});
it("should dispatch a RecordClick action when the tile support link is clicked", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINED });
clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
TestUtils.Simulate.click(view.getDOMNode().querySelector(".room-waiting-area a"));
@ -629,7 +629,7 @@ describe("loop.standaloneRoomViews", function() {
describe("Prompt media message", function() {
it("should display a prompt for user media on MEDIA_WAIT",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.MEDIA_WAIT});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.MEDIA_WAIT });
expect(view.getDOMNode().querySelector(".prompt-media-message"))
.not.eql(null);
@ -639,7 +639,7 @@ describe("loop.standaloneRoomViews", function() {
describe("Full room message", function() {
it("should display a full room message on FULL",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.FULL});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.FULL });
expect(view.getDOMNode().querySelector(".full-room-message"))
.not.eql(null);
@ -672,20 +672,20 @@ describe("loop.standaloneRoomViews", function() {
}
it("should render the Join button when room isn't active", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.READY});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
expect(getJoinButton(view)).not.eql(null);
});
it("should not render the Join button when room is active",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.SESSION_CONNECTED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.SESSION_CONNECTED });
expect(getJoinButton(view)).eql(null);
});
it("should join the room when clicking the Join button", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.READY});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
TestUtils.Simulate.click(getJoinButton(view));
@ -889,48 +889,48 @@ describe("loop.standaloneRoomViews", function() {
it("should remove the Leave button when the room state is READY",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.READY});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
expect(getLeaveButton(view)).eql(null);
});
it("should remove the Leave button when the room state is FAILED",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.FAILED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.FAILED });
expect(getLeaveButton(view)).eql(null);
});
it("should remove the Leave button when the room state is FULL",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.FULL});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.FULL });
expect(getLeaveButton(view)).eql(null);
});
it("should display the Leave button when the room state is SESSION_CONNECTED",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.SESSION_CONNECTED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.SESSION_CONNECTED });
expect(getLeaveButton(view)).not.eql(null);
});
it("should display the Leave button when the room state is JOINED",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINED});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.JOINED });
expect(getLeaveButton(view)).not.eql(null);
});
it("should display the Leave button when the room state is HAS_PARTICIPANTS",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.HAS_PARTICIPANTS });
expect(getLeaveButton(view)).not.eql(null);
});
it("should leave the room when clicking the Leave button", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
activeRoomStore.setStoreState({ roomState: ROOM_STATES.HAS_PARTICIPANTS });
TestUtils.Simulate.click(getLeaveButton(view));

View File

@ -102,7 +102,7 @@ describe("loop.webapp", function() {
it("should display the UnsupportedDeviceView for `unsupportedDevice` window type",
function() {
standaloneAppStore.setStoreState({windowType: "unsupportedDevice", unsupportedPlatform: "ios"});
standaloneAppStore.setStoreState({ windowType: "unsupportedDevice", unsupportedPlatform: "ios" });
var webappRootView = mountTestComponent();
TestUtils.findRenderedComponentWithType(webappRootView,
@ -111,7 +111,7 @@ describe("loop.webapp", function() {
it("should display the UnsupportedBrowserView for `unsupportedBrowser` window type",
function() {
standaloneAppStore.setStoreState({windowType: "unsupportedBrowser", isFirefox: false});
standaloneAppStore.setStoreState({ windowType: "unsupportedBrowser", isFirefox: false });
var webappRootView = mountTestComponent();
@ -121,7 +121,7 @@ describe("loop.webapp", function() {
it("should display the StandaloneRoomControllerView for `room` window type",
function() {
standaloneAppStore.setStoreState({windowType: "room", isFirefox: true});
standaloneAppStore.setStoreState({ windowType: "room", isFirefox: true });
var webappRootView = mountTestComponent();
@ -130,7 +130,7 @@ describe("loop.webapp", function() {
});
it("should display the HomeView for `home` window type", function() {
standaloneAppStore.setStoreState({windowType: "home", isFirefox: true});
standaloneAppStore.setStoreState({ windowType: "home", isFirefox: true });
var webappRootView = mountTestComponent();

View File

@ -3,7 +3,7 @@
"use strict";
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
// Initialize this before the imports, as some of them need it.
do_get_profile();
@ -169,11 +169,11 @@ MockWebSocketChannel.prototype = {
sendMsg: function(aMsg) {
var message = JSON.parse(aMsg);
switch(message.messageType) {
switch (message.messageType) {
case "hello":
this.listener.onMessageAvailable(this.context,
JSON.stringify({messageType: "hello",
uaid: kUAID}));
JSON.stringify({ messageType: "hello",
uaid: kUAID }));
break;
case "register":
this.channelID = message.channelID;
@ -183,10 +183,10 @@ MockWebSocketChannel.prototype = {
this.initRegStatus = 0;
}
this.listener.onMessageAvailable(this.context,
JSON.stringify({messageType: "register",
JSON.stringify({ messageType: "register",
status: statusCode,
channelID: this.channelID,
pushEndpoint: kEndPointUrl}));
pushEndpoint: kEndPointUrl }));
break;
default:
this.defaultMsgHandler && this.defaultMsgHandler(message);
@ -207,11 +207,11 @@ MockWebSocketChannel.prototype = {
}));
},
stop: function (err) {
stop: function(err) {
this.listener.onStop(this.context, err || -1);
},
serverClose: function (err) {
serverClose: function(err) {
this.listener.onServerClose(this.context, err || -1);
}
};

View File

@ -23,7 +23,7 @@ add_test(function test_initalize_missing_notifycallback() {
});
add_test(function test_initalize_websocket() {
MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket});
MozLoopPushHandler.initialize({ mockWebSocket: mockWebSocket });
MozLoopPushHandler.register(
"chan-1",
function(err, url, id) {
@ -103,7 +103,7 @@ add_test(function test_retry_registration() {
add_test(function test_reconnect_no_registration() {
let regCnt = 0;
MozLoopPushHandler.shutdown();
MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket});
MozLoopPushHandler.initialize({ mockWebSocket: mockWebSocket });
MozLoopPushHandler.register(
"test-chan",
function(err, url, id) {
@ -130,7 +130,7 @@ add_test(function test_ping_websocket() {
};
MozLoopPushHandler.shutdown();
MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket});
MozLoopPushHandler.initialize({ mockWebSocket: mockWebSocket });
MozLoopPushHandler.register(
"test-chan",
function(err, url) {
@ -164,7 +164,7 @@ add_test(function test_retry_pushurl() {
case 2:
// missing parameter
response.setStatusLine(null, 200, "OK");
response.write(JSON.stringify({pushServerURI: null}));
response.write(JSON.stringify({ pushServerURI: null }));
response.processAsync();
response.finish();
break;
@ -176,7 +176,7 @@ add_test(function test_retry_pushurl() {
break;
case 4:
response.setStatusLine(null, 200, "OK");
response.write(JSON.stringify({pushServerURI: kServerPushUrl}));
response.write(JSON.stringify({ pushServerURI: kServerPushUrl }));
response.processAsync();
response.finish();
@ -185,7 +185,7 @@ add_test(function test_retry_pushurl() {
}
});
MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket});
MozLoopPushHandler.initialize({ mockWebSocket: mockWebSocket });
});
function run_test() {
@ -193,7 +193,7 @@ function run_test() {
loopServer.registerPathHandler("/push-server-config", (request, response) => {
response.setStatusLine(null, 200, "OK");
response.write(JSON.stringify({pushServerURI: kServerPushUrl}));
response.write(JSON.stringify({ pushServerURI: kServerPushUrl }));
response.processAsync();
response.finish();
});

View File

@ -151,7 +151,7 @@ const kRoomUpdates = {
displayName: "Alexis",
account: "alexis@example.com",
roomConnectionId: "2a1787a6-4a73-43b5-ae3e-906ec1e763cb"
}, {
}, {
displayName: "Ruharb",
roomConnectionId: "5de6281c-6568-455f-af08-c0b0a973100e"
}]
@ -652,7 +652,7 @@ function run_test() {
LoopRooms.on("left", onRoomLeft);
LoopRooms.on("refresh", onRefresh);
do_register_cleanup(function () {
do_register_cleanup(function() {
// Revert original Chat.open implementation
Chat.open = openChatOrig;
Services.prefs.clearUserPref("loop.key");

View File

@ -201,7 +201,7 @@ add_task(function* test_get_rooms_saves_unknown_keys() {
add_task(function* test_get_rooms_saves_different_keys() {
let roomsCache = {};
roomsCache[LOOP_SESSION_TYPE.FXA] = {
QzBbvGmIZWU: {key: "fakeKey"}
QzBbvGmIZWU: { key: "fakeKey" }
};
yield saveRoomsCache(roomsCache);
@ -225,7 +225,7 @@ add_task(function* test_get_rooms_uses_saved_key() {
let roomsCache = {};
roomsCache[LOOP_SESSION_TYPE.FXA] = {
"_nxD4V4FflQ": {key: kExpected.roomKey}
"_nxD4V4FflQ": { key: kExpected.roomKey }
};
yield saveRoomsCache(roomsCache);
@ -261,7 +261,7 @@ function run_test() {
MozLoopServiceInternal.fxAOAuthTokenData = { token_type: "bearer" };
MozLoopServiceInternal.fxAOAuthProfile = { email: "fake@invalid.com" };
do_register_cleanup(function () {
do_register_cleanup(function() {
Services.prefs.clearUserPref(kContextEnabledPref);
Services.prefs.clearUserPref("loop.key.fxa");

View File

@ -108,7 +108,7 @@ function run_test() {
LoopRooms.on("add", onRoomAdded);
LoopRooms.on("update", onRoomUpdated);
do_register_cleanup(function () {
do_register_cleanup(function() {
Services.prefs.clearUserPref("loop.key");
LoopRooms.off("add", onRoomAdded);

View File

@ -12,7 +12,7 @@ const { LOOP_ROOMS_CACHE_FILENAME } = Cu.import("resource:///modules/loop/LoopRo
var gTimerArgs = [];
timerHandlers.startTimer = function(callback, delay) {
gTimerArgs.push({callback, delay});
gTimerArgs.push({ callback, delay });
return gTimerArgs.length;
};
@ -129,7 +129,7 @@ function run_test() {
MozLoopServiceInternal.fxAOAuthTokenData = { token_type: "bearer" };
MozLoopServiceInternal.fxAOAuthProfile = { email: "fake@invalid.com" };
do_register_cleanup(function () {
do_register_cleanup(function() {
Services.prefs.clearUserPref(kContextEnabledPref);
Services.prefs.clearUserPref("loop.key.fxa");

View File

@ -42,7 +42,7 @@ function run_test() {
});
loopServer.registerPathHandler("/calls", (request, response) => {
response.setStatusLine(null, 200, "OK");
response.write(JSON.stringify({calls: [{callId: 4444333221, websocketToken: "0deadbeef0"}]}));
response.write(JSON.stringify({ calls: [{ callId: 4444333221, websocketToken: "0deadbeef0" }] }));
response.processAsync();
response.finish();
});

View File

@ -22,7 +22,7 @@ add_task(function* request_with_unicode() {
response.finish();
});
yield MozLoopServiceInternal.hawkRequestInternal(LOOP_SESSION_TYPE.GUEST, "/fake", "POST", {name: unicodeName}).then(
yield MozLoopServiceInternal.hawkRequestInternal(LOOP_SESSION_TYPE.GUEST, "/fake", "POST", { name: unicodeName }).then(
() => Assert.ok(true, "Should have accepted"),
() => Assert.ok(false, "Should have accepted"));
});

View File

@ -12,11 +12,11 @@
* @type {Object}
*/
navigator.mozL10n = document.mozL10n = {
initialize: function(){},
initialize: function() {},
getLanguage: function(){},
getLanguage: function() {},
getDirection: function(){
getDirection: function() {
if (document.location.search === "?rtl=1") {
return "rtl";
}

View File

@ -112,9 +112,9 @@ var fakeRooms = [
*/
navigator.mozLoop = {
ensureRegistered: function() {},
getAudioBlob: function(){},
getAudioBlob: function() {},
getLoopPref: function(pref) {
switch(pref) {
switch (pref) {
// Ensure we skip FTE completely.
case "gettingStarted.seen":
return true;
@ -122,7 +122,7 @@ var fakeRooms = [
return null;
},
hasEncryptionKey: true,
setLoopPref: function(){},
setLoopPref: function() {},
releaseCallData: function() {},
copyString: function() {},
getUserAvatar: function(emailAddress) {

View File

@ -23,9 +23,9 @@
var DesktopRoomConversationView = loop.roomViews.DesktopRoomConversationView;
// 2. Standalone webapp
var UnsupportedBrowserView = loop.webapp.UnsupportedBrowserView;
var UnsupportedDeviceView = loop.webapp.UnsupportedDeviceView;
var StandaloneRoomView = loop.standaloneRoomViews.StandaloneRoomView;
var UnsupportedBrowserView = loop.webapp.UnsupportedBrowserView;
var UnsupportedDeviceView = loop.webapp.UnsupportedDeviceView;
var StandaloneRoomView = loop.standaloneRoomViews.StandaloneRoomView;
var StandaloneHandleUserAgentView = loop.standaloneRoomViews.StandaloneHandleUserAgentView;
// 3. Shared components
@ -49,7 +49,7 @@
return false;
}
function noop(){}
function noop() {}
// We save the visibility change listeners so that we can fake an event
// to the panel once we've loaded all the views.
@ -141,12 +141,12 @@
// (eg MacBook Pro) where that is the default camera resolution.
var newStoreState = {
localVideoDimensions: {
camera: {height: 480, orientation: 0, width: 640}
camera: { height: 480, orientation: 0, width: 640 }
},
mediaConnected: options.mediaConnected,
receivingScreenShare: !!options.receivingScreenShare,
remoteVideoDimensions: {
camera: {height: 480, orientation: 0, width: 640}
camera: { height: 480, orientation: 0, width: 640 }
},
remoteVideoEnabled: options.remoteVideoEnabled,
// Override the matchMedia, this is so that the correct version is
@ -172,7 +172,7 @@
// For showcase purposes, this shouldn't matter much, as the sizes
// of things being shared will be fairly arbitrary.
newStoreState.remoteVideoDimensions.screen =
{height: 456, orientation: 0, width: 641};
{ height: 456, orientation: 0, width: 641 };
}
store.setStoreState(newStoreState);
@ -339,7 +339,7 @@
}]
}));
textChatStore.setStoreState({textChatEnabled: true});
textChatStore.setStoreState({ textChatEnabled: true });
dispatcher.dispatch(new sharedActions.SendTextChatMessage({
contentType: loop.shared.utils.CHAT_CONTENT_TYPES.TEXT,
@ -392,7 +392,7 @@
};
var mockMozLoopNoRoomsNoContext = _.cloneDeep(navigator.mozLoop);
mockMozLoopNoRoomsNoContext.getSelectedTabMetadata = function(){};
mockMozLoopNoRoomsNoContext.getSelectedTabMetadata = function() {};
mockMozLoopNoRoomsNoContext.rooms.getAll = function(version, callback) {
callback(null, []);
};
@ -425,7 +425,7 @@
};
var mockMozLoopLoggedInNoContext = _.cloneDeep(navigator.mozLoop);
mockMozLoopLoggedInNoContext.getSelectedTabMetadata = function(){};
mockMozLoopLoggedInNoContext.getSelectedTabMetadata = function() {};
mockMozLoopLoggedInNoContext.userProfile = _.cloneDeep(mockMozLoopLoggedIn.userProfile);
var mockMozLoopLoggedInLongEmail = _.cloneDeep(navigator.mozLoop);
@ -553,7 +553,7 @@
React.createElement("a", {href: this.makeId("#")}, " ¶")
),
React.createElement("div", {className: "comp"},
React.createElement(Frame, {className: cx({dashed: this.props.dashed}),
React.createElement(Frame, {className: cx({ dashed: this.props.dashed }),
cssClass: this.props.cssClass,
height: height,
onContentsRendered: this.props.onContentsRendered,
@ -883,7 +883,7 @@
dispatcher: dispatcher,
localPosterUrl: "sample-img/video-screen-local.png",
mozLoop: navigator.mozLoop,
onCallTerminated: function(){},
onCallTerminated: function() {},
roomState: ROOM_STATES.INIT,
roomStore: invitationRoomStore})
)
@ -898,7 +898,7 @@
dispatcher: dispatcher,
error: {},
mozLoop: navigator.mozLoop,
onClose: function(){},
onClose: function() {},
roomData: {},
savingContext: false,
show: true}
@ -919,7 +919,7 @@
dispatcher: dispatcher,
localPosterUrl: "sample-img/video-screen-local.png",
mozLoop: navigator.mozLoop,
onCallTerminated: function(){},
onCallTerminated: function() {},
remotePosterUrl: "sample-img/video-screen-remote.png",
roomState: ROOM_STATES.HAS_PARTICIPANTS,
roomStore: desktopRoomStoreLoading})
@ -937,7 +937,7 @@
dispatcher: dispatcher,
localPosterUrl: "sample-img/video-screen-local.png",
mozLoop: navigator.mozLoop,
onCallTerminated: function(){},
onCallTerminated: function() {},
remotePosterUrl: "sample-img/video-screen-remote.png",
roomState: ROOM_STATES.HAS_PARTICIPANTS,
roomStore: roomStore})
@ -955,7 +955,7 @@
dispatcher: dispatcher,
localPosterUrl: "sample-img/video-screen-local.png",
mozLoop: navigator.mozLoop,
onCallTerminated: function(){},
onCallTerminated: function() {},
remotePosterUrl: "sample-img/video-screen-remote.png",
roomState: ROOM_STATES.HAS_PARTICIPANTS,
roomStore: desktopRoomStoreMedium})
@ -973,7 +973,7 @@
dispatcher: dispatcher,
localPosterUrl: "sample-img/video-screen-local.png",
mozLoop: navigator.mozLoop,
onCallTerminated: function(){},
onCallTerminated: function() {},
remotePosterUrl: "sample-img/video-screen-remote.png",
roomState: ROOM_STATES.HAS_PARTICIPANTS,
roomStore: desktopRoomStoreLarge})
@ -990,7 +990,7 @@
chatWindowDetached: false,
dispatcher: dispatcher,
mozLoop: navigator.mozLoop,
onCallTerminated: function(){},
onCallTerminated: function() {},
remotePosterUrl: "sample-img/video-screen-remote.png",
roomStore: desktopLocalFaceMuteRoomStore})
)
@ -1007,7 +1007,7 @@
dispatcher: dispatcher,
localPosterUrl: "sample-img/video-screen-local.png",
mozLoop: navigator.mozLoop,
onCallTerminated: function(){},
onCallTerminated: function() {},
remotePosterUrl: "sample-img/video-screen-remote.png",
roomStore: desktopRemoteFaceMuteRoomStore})
)
@ -1321,9 +1321,9 @@
React.render(React.createElement(App, null), document.getElementById("main"));
for (var listener of visibilityListeners) {
listener({target: {hidden: false}});
listener({ target: { hidden: false } });
}
} catch(err) {
} catch (err) {
console.error(err);
uncaughtError = err;
}
@ -1358,7 +1358,7 @@
if (warningsMismatch) {
liTestFail.className = "test";
liTestFail.className = liTestFail.className + " fail";
liTestFail.className += " fail";
h2Node.innerHTML = "Unexpected number of warnings detected in UI-Showcase";
preErrorNode.className = "error";
preErrorNode.innerHTML = "Got: " + caughtWarnings.length + "\n" + "Expected: " + expectedWarningsCount;
@ -1368,7 +1368,7 @@
}
if (uncaughtError) {
liTestFail.className = "test";
liTestFail.className = liTestFail.className + " fail";
liTestFail.className += " fail";
h2Node.innerHTML = "Errors rendering UI-Showcase";
preErrorNode.className = "error";
preErrorNode.innerHTML = uncaughtError + "\n" + uncaughtError.stack;

View File

@ -23,9 +23,9 @@
var DesktopRoomConversationView = loop.roomViews.DesktopRoomConversationView;
// 2. Standalone webapp
var UnsupportedBrowserView = loop.webapp.UnsupportedBrowserView;
var UnsupportedDeviceView = loop.webapp.UnsupportedDeviceView;
var StandaloneRoomView = loop.standaloneRoomViews.StandaloneRoomView;
var UnsupportedBrowserView = loop.webapp.UnsupportedBrowserView;
var UnsupportedDeviceView = loop.webapp.UnsupportedDeviceView;
var StandaloneRoomView = loop.standaloneRoomViews.StandaloneRoomView;
var StandaloneHandleUserAgentView = loop.standaloneRoomViews.StandaloneHandleUserAgentView;
// 3. Shared components
@ -49,7 +49,7 @@
return false;
}
function noop(){}
function noop() {}
// We save the visibility change listeners so that we can fake an event
// to the panel once we've loaded all the views.
@ -141,12 +141,12 @@
// (eg MacBook Pro) where that is the default camera resolution.
var newStoreState = {
localVideoDimensions: {
camera: {height: 480, orientation: 0, width: 640}
camera: { height: 480, orientation: 0, width: 640 }
},
mediaConnected: options.mediaConnected,
receivingScreenShare: !!options.receivingScreenShare,
remoteVideoDimensions: {
camera: {height: 480, orientation: 0, width: 640}
camera: { height: 480, orientation: 0, width: 640 }
},
remoteVideoEnabled: options.remoteVideoEnabled,
// Override the matchMedia, this is so that the correct version is
@ -172,7 +172,7 @@
// For showcase purposes, this shouldn't matter much, as the sizes
// of things being shared will be fairly arbitrary.
newStoreState.remoteVideoDimensions.screen =
{height: 456, orientation: 0, width: 641};
{ height: 456, orientation: 0, width: 641 };
}
store.setStoreState(newStoreState);
@ -339,7 +339,7 @@
}]
}));
textChatStore.setStoreState({textChatEnabled: true});
textChatStore.setStoreState({ textChatEnabled: true });
dispatcher.dispatch(new sharedActions.SendTextChatMessage({
contentType: loop.shared.utils.CHAT_CONTENT_TYPES.TEXT,
@ -392,7 +392,7 @@
};
var mockMozLoopNoRoomsNoContext = _.cloneDeep(navigator.mozLoop);
mockMozLoopNoRoomsNoContext.getSelectedTabMetadata = function(){};
mockMozLoopNoRoomsNoContext.getSelectedTabMetadata = function() {};
mockMozLoopNoRoomsNoContext.rooms.getAll = function(version, callback) {
callback(null, []);
};
@ -425,7 +425,7 @@
};
var mockMozLoopLoggedInNoContext = _.cloneDeep(navigator.mozLoop);
mockMozLoopLoggedInNoContext.getSelectedTabMetadata = function(){};
mockMozLoopLoggedInNoContext.getSelectedTabMetadata = function() {};
mockMozLoopLoggedInNoContext.userProfile = _.cloneDeep(mockMozLoopLoggedIn.userProfile);
var mockMozLoopLoggedInLongEmail = _.cloneDeep(navigator.mozLoop);
@ -553,7 +553,7 @@
<a href={this.makeId("#")}>&nbsp;</a>
</h3>
<div className="comp">
<Frame className={cx({dashed: this.props.dashed})}
<Frame className={cx({ dashed: this.props.dashed })}
cssClass={this.props.cssClass}
height={height}
onContentsRendered={this.props.onContentsRendered}
@ -883,7 +883,7 @@
dispatcher={dispatcher}
localPosterUrl="sample-img/video-screen-local.png"
mozLoop={navigator.mozLoop}
onCallTerminated={function(){}}
onCallTerminated={function() {}}
roomState={ROOM_STATES.INIT}
roomStore={invitationRoomStore} />
</div>
@ -898,7 +898,7 @@
dispatcher={dispatcher}
error={{}}
mozLoop={navigator.mozLoop}
onClose={function(){}}
onClose={function() {}}
roomData={{}}
savingContext={false}
show={true}
@ -919,7 +919,7 @@
dispatcher={dispatcher}
localPosterUrl="sample-img/video-screen-local.png"
mozLoop={navigator.mozLoop}
onCallTerminated={function(){}}
onCallTerminated={function() {}}
remotePosterUrl="sample-img/video-screen-remote.png"
roomState={ROOM_STATES.HAS_PARTICIPANTS}
roomStore={desktopRoomStoreLoading} />
@ -937,7 +937,7 @@
dispatcher={dispatcher}
localPosterUrl="sample-img/video-screen-local.png"
mozLoop={navigator.mozLoop}
onCallTerminated={function(){}}
onCallTerminated={function() {}}
remotePosterUrl="sample-img/video-screen-remote.png"
roomState={ROOM_STATES.HAS_PARTICIPANTS}
roomStore={roomStore} />
@ -955,7 +955,7 @@
dispatcher={dispatcher}
localPosterUrl="sample-img/video-screen-local.png"
mozLoop={navigator.mozLoop}
onCallTerminated={function(){}}
onCallTerminated={function() {}}
remotePosterUrl="sample-img/video-screen-remote.png"
roomState={ROOM_STATES.HAS_PARTICIPANTS}
roomStore={desktopRoomStoreMedium} />
@ -973,7 +973,7 @@
dispatcher={dispatcher}
localPosterUrl="sample-img/video-screen-local.png"
mozLoop={navigator.mozLoop}
onCallTerminated={function(){}}
onCallTerminated={function() {}}
remotePosterUrl="sample-img/video-screen-remote.png"
roomState={ROOM_STATES.HAS_PARTICIPANTS}
roomStore={desktopRoomStoreLarge} />
@ -990,7 +990,7 @@
chatWindowDetached={false}
dispatcher={dispatcher}
mozLoop={navigator.mozLoop}
onCallTerminated={function(){}}
onCallTerminated={function() {}}
remotePosterUrl="sample-img/video-screen-remote.png"
roomStore={desktopLocalFaceMuteRoomStore} />
</div>
@ -1007,7 +1007,7 @@
dispatcher={dispatcher}
localPosterUrl="sample-img/video-screen-local.png"
mozLoop={navigator.mozLoop}
onCallTerminated={function(){}}
onCallTerminated={function() {}}
remotePosterUrl="sample-img/video-screen-remote.png"
roomStore={desktopRemoteFaceMuteRoomStore} />
</div>
@ -1290,12 +1290,12 @@
width={800}>
<SVGIcons size="10x10"/>
</FramedExample>
<FramedExample height={350}
<FramedExample height={350}
summary="14x14"
width={800}>
<SVGIcons size="14x14" />
</FramedExample>
<FramedExample height={480}
<FramedExample height={480}
summary="16x16"
width={800}>
<SVGIcons size="16x16"/>
@ -1321,9 +1321,9 @@
React.render(<App />, document.getElementById("main"));
for (var listener of visibilityListeners) {
listener({target: {hidden: false}});
listener({ target: { hidden: false } });
}
} catch(err) {
} catch (err) {
console.error(err);
uncaughtError = err;
}
@ -1358,7 +1358,7 @@
if (warningsMismatch) {
liTestFail.className = "test";
liTestFail.className = liTestFail.className + " fail";
liTestFail.className += " fail";
h2Node.innerHTML = "Unexpected number of warnings detected in UI-Showcase";
preErrorNode.className = "error";
preErrorNode.innerHTML = "Got: " + caughtWarnings.length + "\n" + "Expected: " + expectedWarningsCount;
@ -1368,7 +1368,7 @@
}
if (uncaughtError) {
liTestFail.className = "test";
liTestFail.className = liTestFail.className + " fail";
liTestFail.className += " fail";
h2Node.innerHTML = "Errors rendering UI-Showcase";
preErrorNode.className = "error";
preErrorNode.innerHTML = uncaughtError + "\n" + uncaughtError.stack;

View File

@ -105,6 +105,12 @@ const PING_ACTIONS = ["block", "click", "pin", "sponsored", "sponsored_link", "u
// Location of inadjacent sites json
const INADJACENCY_SOURCE = "chrome://browser/content/newtab/newTab.inadjacent.json";
// Fake URL to keep track of last block of a suggested tile in the frequency cap object
const FAKE_SUGGESTED_BLOCK_URL = "ignore://suggested_block";
// Time before suggested tile is allowed to play again after block - default to 1 day
const AFTER_SUGGESTED_BLOCK_DECAY_TIME = 24*60*60*1000;
/**
* Singleton that serves as the provider of directory links.
* Directory links are a hard-coded set of links shown if a user's link
@ -492,6 +498,28 @@ var DirectoryLinksProvider = {
return {use: true};
},
/**
* Handles block on suggested tile: updates fake block url with current timestamp
*/
handleSuggestedTileBlock: function DirectoryLinksProvider_handleSuggestedTileBlock() {
this._updateFrequencyCapSettings({url: FAKE_SUGGESTED_BLOCK_URL});
this._writeFrequencyCapFile();
},
/**
* Checks if suggested tile is being blocked for the rest of "decay time"
* @return True if blocked, false otherwise
*/
_isSuggestedTileBlocked: function DirectoryLinksProvider__isSuggestedTileBlocked() {
let capObject = this._frequencyCaps[FAKE_SUGGESTED_BLOCK_URL];
if (!capObject || !capObject.lastUpdated) {
// user never blocked suggested tile or lastUpdated is missing
return false;
}
// otherwise, make sure that enough time passed after suggested tile was blocked
return (capObject.lastUpdated + AFTER_SUGGESTED_BLOCK_DECAY_TIME) > Date.now();
},
/**
* Report some action on a newtab page (view, click)
* @param sites Array of sites shown on newtab page
@ -890,9 +918,12 @@ var DirectoryLinksProvider = {
}
}
if (this._topSitesWithSuggestedLinks.size == 0 || !this._shouldUpdateSuggestedTile()) {
if (this._topSitesWithSuggestedLinks.size == 0 ||
!this._shouldUpdateSuggestedTile() ||
this._isSuggestedTileBlocked()) {
// There are no potential suggested links we can show or not
// enough history for a suggested tile.
// enough history for a suggested tile, or suggested tile was
// recently blocked and wait time interval has not decayed yet
return;
}
@ -1113,7 +1144,8 @@ var DirectoryLinksProvider = {
_pruneFrequencyCapUrls: function DirectoryLinksProvider_pruneFrequencyCapUrls(timeDelta = DEFAULT_PRUNE_TIME_DELTA) {
let timeThreshold = Date.now() - timeDelta;
Object.keys(this._frequencyCaps).forEach(url => {
if (this._frequencyCaps[url].lastUpdated <= timeThreshold) {
// remove url if it is not ignorable and wasn't updated for a while
if (!url.startsWith("ignore") && this._frequencyCaps[url].lastUpdated <= timeThreshold) {
delete this._frequencyCaps[url];
}
});

View File

@ -2003,3 +2003,63 @@ add_task(function test_reportPastImpressions() {
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
DirectoryLinksProvider._getCurrentTopSiteCount = origCurrentTopSiteCount;
});
add_task(function test_blockSuggestedTiles() {
// Initial setup
let suggestedTile = suggestedTile1;
let topSites = ["site0.com", "1040.com", "site2.com", "hrblock.com", "site4.com", "freetaxusa.com", "site6.com"];
let data = {"suggested": [suggestedTile1, suggestedTile2, suggestedTile3], "directory": [someOtherSite]};
let dataURI = 'data:application/json,' + JSON.stringify(data);
yield promiseSetupDirectoryLinksProvider({linksURL: dataURI});
let links = yield fetchData();
let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
NewTabUtils.isTopPlacesSite = function(site) {
return topSites.indexOf(site) >= 0;
}
let origGetProviderLinks = NewTabUtils.getProviderLinks;
NewTabUtils.getProviderLinks = function(provider) {
return links;
}
let origCurrentTopSiteCount = DirectoryLinksProvider._getCurrentTopSiteCount;
DirectoryLinksProvider._getCurrentTopSiteCount = () => 8;
// load the links
yield new Promise(resolve => {
DirectoryLinksProvider.getLinks(resolve);
});
// ensure that tile is suggested
let suggestedLink = DirectoryLinksProvider._updateSuggestedTile();
do_check_true(suggestedLink.frecent_sites);
// block suggested tile in a regular way
DirectoryLinksProvider.reportSitesAction([{
isPinned: function() {return false;},
link: Object.assign({frecency: 1000},suggestedLink)
}], "block", 0);
// suggested tile still must be recommended
suggestedLink = DirectoryLinksProvider._updateSuggestedTile();
do_check_true(suggestedLink.frecent_sites);
// timestamp suggested_block in the frequency cap object
DirectoryLinksProvider.handleSuggestedTileBlock();
// no more recommendations should be seen
do_check_eq(DirectoryLinksProvider._updateSuggestedTile(), undefined);
// move lastUpdated for suggested tile into the past
DirectoryLinksProvider._frequencyCaps["ignore://suggested_block"].lastUpdated = Date.now() - 25*60*60*1000;
// ensure that suggested tile updates again
suggestedLink = DirectoryLinksProvider._updateSuggestedTile();
do_check_true(suggestedLink.frecent_sites);
// Cleanup
yield promiseCleanDirectoryLinksProvider();
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
NewTabUtils.getProviderLinks = origGetProviderLinks;
DirectoryLinksProvider._getCurrentTopSiteCount = origCurrentTopSiteCount;
});

View File

@ -26,7 +26,7 @@
.theme-dark .searchBox,
.theme-light .searchBox {
border: 1px solid rgb(170, 170, 170);
background-image: url("chrome://browser/skin/devtools/magnifying-glass-light.png");
background-image: url("chrome://devtools/skin/themes/images/magnifying-glass-light.png");
background-position: 8px center;
border-radius: 2px;
padding-left: 25px;
@ -42,5 +42,5 @@
background-color: rgba(24, 29, 32, 1);
color: rgba(184, 200, 217, 1);
border-color: var(--theme-splitter-color);
background-image: url("chrome://browser/skin/devtools/magnifying-glass.png");
background-image: url("chrome://devtools/skin/themes/images/magnifying-glass.png");
}

View File

@ -7,7 +7,7 @@ Bug 1067491 - Test taking a census over the RDP.
<meta charset="utf-8">
<title>Census Tree 01</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link href="chrome://browser/content/devtools/widgets.css" type="text/css" />
<link href="chrome://devtools/content/shared/widgets/widgets.css" type="text/css" />
<link href="chrome://devtools/skin/themes/light-theme.css" type="text/css" />
<link href="chrome://devtools/skin/themes/common.css" type="text/css" />
<link href="chrome://devtools/skin/themes/widgets.css" type="text/css" />
@ -19,7 +19,7 @@ Bug 1067491 - Test taking a census over the RDP.
<script src="head.js" type="application/javascript;version=1.8"></script>
<script>
window.onload = function() {
var { CensusTreeNode } = require("devtools/shared/heapsnapshot/census-tree-node");
var { censusReportToCensusTreeNode } = require("devtools/shared/heapsnapshot/census-tree-node");
var { INDENTATION, CensusView } = require("devtools/client/memory/modules/census-view");
SimpleTest.waitForExplicitFinish();
const countBreakdown = { by: "count", count: true, bytes: true };
@ -28,6 +28,7 @@ window.onload = function() {
by: "coarseType",
objects: { by: "objectClass", then: countBreakdown },
strings: countBreakdown,
scripts: countBreakdown,
other: { by: "internalType", then: countBreakdown },
};
@ -37,6 +38,7 @@ window.onload = function() {
"Array": { bytes: 20, count: 2 },
},
"strings": { bytes: 10, count: 1 },
"scripts": { bytes: 20, count: 2 },
"other": {
"js::Shape": { bytes: 30, count: 3 },
"js::Shape2": { bytes: 40, count: 4 }
@ -44,15 +46,16 @@ window.onload = function() {
};
const EXPECTED_ROWS = [
{ level: 0, name: "strings", bytes: 10, count: 1, },
{ level: 0, name: "objects" },
{ level: 1, name: "Array", bytes: 20, count: 2, },
{ level: 1, name: "Function", bytes: 10, count: 1, },
{ level: 0, name: "other" },
{ level: 0, name: "other", bytes: 0, count: 0 },
{ level: 1, name: "js::Shape2", bytes: 40, count: 4, },
{ level: 1, name: "js::Shape", bytes: 30, count: 3, },
{ level: 0, name: "objects", bytes: 0, count: 0 },
{ level: 1, name: "Array", bytes: 20, count: 2, },
{ level: 1, name: "Function", bytes: 10, count: 1, },
{ level: 0, name: "scripts", bytes: 20, count: 2, },
{ level: 0, name: "strings", bytes: 10, count: 1, },
];
var censusTreeNode = new CensusTreeNode(BREAKDOWN, REPORT);
var censusTreeNode = censusReportToCensusTreeNode(BREAKDOWN, REPORT);
var view = new CensusView({
censusTreeNode: censusTreeNode,
@ -81,14 +84,14 @@ window.onload = function() {
is(bytesEl.innerHTML, String(expected.bytes),
`correct bytes "${expected.bytes}" in heap tree`);
} else {
ok(!bytesEl, "no bytes correctly displayed for ${expected.name}");
ok(!bytesEl, `no bytes correctly displayed for ${expected.name}`);
}
if ("count" in expected) {
is(countEl.innerHTML, String(expected.count),
`correct count "${expected.count}" in heap tree`);
} else {
ok(!countEl, "no count correctly displayed for ${expected.name}");
ok(!countEl, `no count correctly displayed for ${expected.name}`);
}
}

View File

@ -10,7 +10,7 @@ let { snapshotState: states } = require("devtools/client/memory/constants");
let { breakdownEquals } = require("devtools/client/memory/utils");
let { setBreakdownAndRefresh } = require("devtools/client/memory/actions/breakdown");
let { takeSnapshotAndCensus } = require("devtools/client/memory/actions/snapshot");
let custom = { by: "internalType", then: { by: "count", bytes: true }};
let custom = { by: "internalType", then: { by: "count", bytes: true, count: false }};
function run_test() {
run_next_test();
@ -34,5 +34,9 @@ add_task(function *() {
"New snapshot stored custom breakdown when done taking census");
ok(getState().snapshots[0].census.children.length, "Census has some children");
// Ensure we don't have `count` in any results
ok(getState().snapshots[0].census.children.every(c => !c.count), "Census used custom breakdown");
ok(getState().snapshots[0].census.children.every(c => !c.count),
"Census used custom breakdown without counts");
// Ensure we do have `bytes` in the results
ok(getState().snapshots[0].census.children.every(c => typeof c.bytes === "number"),
"Census used custom breakdown with bytes");
});

View File

@ -72,6 +72,7 @@ LegacyProfilerFront.prototype = {
}
yield this.unregisterEventNotifications({ events: this.EVENTS });
this._target.client.removeListener("eventNotification", this._onProfilerEvent);
yield this._front.destroy();
}),
/**

View File

@ -653,6 +653,8 @@ box.requests-menu-status[code^="5"] {
transition-property: max-width, -moz-padding-end, -moz-padding-start;
transition-duration: 250ms;
transition-timing-function: ease;
margin-left: 3px;
margin-right: 3px;
}
#requests-menu-filter-freetext-text:not([focused]):not([filled]) > .textbox-input-box {

View File

@ -328,7 +328,7 @@
.devtools-textinput,
.devtools-searchinput {
-moz-appearance: none;
margin: 0 3px;
margin: 1px 0;
border: 1px solid;
%ifdef XP_MACOSX
border-radius: 20px;
@ -340,8 +340,6 @@
}
.devtools-searchinput {
margin-top: 1px;
margin-bottom: 1px;
padding: 0;
-moz-padding-start: 22px;
-moz-padding-end: 4px;

View File

@ -73,9 +73,6 @@ var UI = {
AppManager.init();
this.onMessage = this.onMessage.bind(this);
window.addEventListener("message", this.onMessage);
this.appManagerUpdate = this.appManagerUpdate.bind(this);
AppManager.on("app-manager-update", this.appManagerUpdate);
@ -136,7 +133,6 @@ var UI = {
AppManager.off("app-manager-update", this.appManagerUpdate);
AppManager.destroy();
Simulators.off("configure", this.configureSimulator);
window.removeEventListener("message", this.onMessage);
this.updateConnectionTelemetry();
this._telemetry.toolClosed("webide");
this._telemetry.toolClosed("webideProjectEditor");
@ -925,28 +921,36 @@ var UI = {
/********** TOOLBOX **********/
onMessage: function(event) {
// The custom toolbox sends a message to its parent
// window.
try {
let json = JSON.parse(event.data);
switch (json.name) {
case "toolbox-close":
// There are many ways to close a toolbox:
// * Close button inside the toolbox
// * Toggle toolbox wrench in WebIDE
// * Disconnect the current runtime gracefully
// * Yank cord out of device
// We can't know for sure which one was used here, so reset the
// |toolboxPromise| since someone must be destroying it to reach here,
// and call our own close method.
if (this.toolboxIframe && this.toolboxIframe.uid == json.uid) {
this.toolboxPromise = null;
this._closeToolboxUI();
}
break;
}
} catch(e) { console.error(e); }
/**
* There are many ways to close a toolbox:
* * Close button inside the toolbox
* * Toggle toolbox wrench in WebIDE
* * Disconnect the current runtime gracefully
* * Yank cord out of device
* * Close or crash the app/tab
* We can't know for sure which one was used here, so reset the
* |toolboxPromise| since someone must be destroying it to reach here,
* and call our own close method.
*/
_onToolboxClosed: function(promise, iframe) {
// Only save toolbox size, disable wrench button, workaround focus issue...
// if we are closing the last toolbox:
// - toolboxPromise is nullified by destroyToolbox and is still null here
// if no other toolbox has been opened in between,
// - having two distinct promise means we are receiving closed event
// for a previous, non-current, toolbox.
if (!this.toolboxPromise || this.toolboxPromise === promise) {
this.toolboxPromise = null;
this.resetFocus();
Services.prefs.setIntPref("devtools.toolbox.footer.height", iframe.height);
let splitter = document.querySelector(".devtools-horizontal-splitter");
splitter.setAttribute("hidden", "true");
document.querySelector("#action-button-debug").removeAttribute("active");
}
// We have to destroy the iframe, otherwise, the keybindings of webide don't work
// properly anymore.
iframe.remove();
},
destroyToolbox: function() {
@ -954,11 +958,7 @@ var UI = {
if (this.toolboxPromise) {
let toolboxPromise = this.toolboxPromise;
this.toolboxPromise = null;
return toolboxPromise.then(toolbox => {
return toolbox.destroy();
}).then(null, console.error)
.then(() => this._closeToolboxUI())
.then(null, console.error);
return toolboxPromise.then(toolbox => toolbox.destroy());
}
return promise.resolve();
},
@ -968,15 +968,6 @@ var UI = {
if (this.toolboxPromise) {
return this.toolboxPromise;
}
this.toolboxPromise = AppManager.getTarget().then((target) => {
return this._showToolbox(target);
}, console.error);
return this.busyUntil(this.toolboxPromise, "opening toolbox");
},
_showToolbox: function(target) {
let splitter = document.querySelector(".devtools-horizontal-splitter");
splitter.removeAttribute("hidden");
let iframe = document.createElement("iframe");
iframe.id = "toolbox";
@ -985,37 +976,34 @@ var UI = {
// when receiving toolbox-close event
iframe.uid = new Date().getTime();
let height = Services.prefs.getIntPref("devtools.toolbox.footer.height");
iframe.height = height;
let promise = this.toolboxPromise = AppManager.getTarget().then(target => {
return this._showToolbox(target, iframe);
}).then(toolbox => {
// Destroy the toolbox on WebIDE side before
// toolbox.destroy's promise resolves.
toolbox.once("destroyed", this._onToolboxClosed.bind(this, promise, iframe));
return toolbox;
}, console.error);
return this.busyUntil(this.toolboxPromise, "opening toolbox");
},
_showToolbox: function(target, iframe) {
let splitter = document.querySelector(".devtools-horizontal-splitter");
splitter.removeAttribute("hidden");
document.querySelector("notificationbox").insertBefore(iframe, splitter.nextSibling);
let host = Toolbox.HostType.CUSTOM;
let options = { customIframe: iframe, zoom: false, uid: iframe.uid };
this.toolboxIframe = iframe;
let height = Services.prefs.getIntPref("devtools.toolbox.footer.height");
iframe.height = height;
document.querySelector("#action-button-debug").setAttribute("active", "true");
return gDevTools.showToolbox(target, null, host, options);
},
_closeToolboxUI: function() {
if (!this.toolboxIframe) {
return;
}
this.resetFocus();
Services.prefs.setIntPref("devtools.toolbox.footer.height", this.toolboxIframe.height);
// We have to destroy the iframe, otherwise, the keybindings of webide don't work
// properly anymore.
this.toolboxIframe.remove();
this.toolboxIframe = null;
let splitter = document.querySelector(".devtools-horizontal-splitter");
splitter.setAttribute("hidden", "true");
document.querySelector("#action-button-debug").removeAttribute("active");
},
prePackageLog: function (msg) {
if (msg == "start") {
UI.selectDeckPanel("logs");
@ -1106,7 +1094,7 @@ var Cmds = {
toggleToolbox: function() {
UI.onAction("debug");
if (UI.toolboxIframe) {
if (UI.toolboxPromise) {
UI.destroyToolbox();
return promise.resolve();
} else {

View File

@ -365,10 +365,29 @@ var AppManager = exports.AppManager = {
_selectedProject: null,
set selectedProject(project) {
// A regular comparison still sees a difference when equal in some cases
if (JSON.stringify(this._selectedProject) ===
JSON.stringify(project)) {
// A regular comparison doesn't work as we recreate a new object every time
let prev = this._selectedProject;
if (!prev && !project) {
return;
} else if (prev && project && prev.type === project.type) {
let type = project.type;
if (type === "runtimeApp") {
if (prev.app.manifestURL === project.app.manifestURL) {
return;
}
} else if (type === "tab") {
if (prev.app.actor === project.app.actor) {
return;
}
} else if (type === "packaged" || type === "hosted") {
if (prev.location === project.location) {
return;
}
} else if (type === "mainProcess") {
return;
} else {
throw new Error("Unsupported project type: " + type);
}
}
let cancelled = false;

View File

@ -61,3 +61,4 @@ skip-if = true # Bug 1201392 - Update add-ons after migration
[test_zoom.html]
[test_build.html]
[test_simulators.html]
[test_toolbox.html]

View File

@ -78,6 +78,18 @@
ok(win.AppManager.isMainProcessDebuggable(), "Main process available");
is(win.AppManager.selectedProject.type, "mainProcess", "Main process reselected");
// Wait for the toolbox to be fully loaded
yield win.UI.toolboxPromise;
// If we happen to pass a project object targeting the same context,
// here, the main process, the `selectedProject` attribute shouldn't be updated
// so that no `project` event would fire.
let oldProject = win.AppManager.selectedProject;
win.AppManager.selectedProject = {
type: "mainProcess"
};
is(win.AppManager.selectedProject, oldProject, "AppManager.selectedProject shouldn't be updated if we selected the same project");
yield win.Cmds.disconnectRuntime();
yield closeWebIDE(win);

Some files were not shown because too many files have changed in this diff Show More