merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2015-12-07 11:51:55 +01:00
commit 834b04df6d
524 changed files with 128 additions and 158 deletions

View File

@ -169,6 +169,9 @@ loop.store.ActiveRoomStore = (function() {
case REST_ERRNOS.INVALID_TOKEN:
case REST_ERRNOS.EXPIRED:
return FAILURE_DETAILS.EXPIRED_OR_INVALID;
case undefined:
// XHR errors reach here with errno as undefined
return FAILURE_DETAILS.COULD_NOT_CONNECT;
default:
return FAILURE_DETAILS.UNKNOWN;
}
@ -355,6 +358,7 @@ loop.store.ActiveRoomStore = (function() {
this.setStoreState({
roomState: ROOM_STATES.GATHER,
roomToken: actionData.token,
roomCryptoKey: actionData.cryptoKey,
standalone: true
});

View File

@ -101,6 +101,11 @@ loop.StandaloneMozLoop = (function(mozL10n) {
}
}.bind(this);
this._xhrReq.onerror = function() {
var request = this._xhrReq;
failureHandler(callback, request);
}.bind(this);
this._xhrReq.send();
},

View File

@ -163,6 +163,8 @@ loop.standaloneRoomViews = (function(mozL10n) {
{ clientShortname: mozL10n.get("clientShortname2") });
case FAILURE_DETAILS.ICE_FAILED:
return mozL10n.get("rooms_ice_failure_message");
case FAILURE_DETAILS.COULD_NOT_CONNECT:
return mozL10n.get("rooms_server_unavailable_message");
default:
return mozL10n.get("status_error");
}
@ -447,15 +449,19 @@ loop.standaloneRoomViews = (function(mozL10n) {
componentWillUpdate: function(nextProps, nextState) {
if (this.state.roomState !== ROOM_STATES.READY &&
nextState.roomState === ROOM_STATES.READY) {
var roomName = nextState.roomName ||
this.state.roomName ||
this.state.roomContextUrls[0].description ||
this.state.roomContextUrls[0].location;
this.setTitle(mozL10n.get("standalone_title_with_room_name", {
roomName: roomName,
clientShortname: mozL10n.get("clientShortname2")
}));
var roomName = nextState.roomName;
if (!roomName && nextState.roomContextUrls) {
roomName = nextState.roomContextUrls[0].description ||
nextState.roomContextUrls[0].location;
}
if (!roomName) {
this.setTitle(mozL10n.get("clientShortname2"));
} else {
this.setTitle(mozL10n.get("standalone_title_with_room_name", {
roomName: roomName,
clientShortname: mozL10n.get("clientShortname2")
}));
}
}
if (this.state.roomState !== ROOM_STATES.MEDIA_WAIT &&

View File

@ -163,6 +163,8 @@ loop.standaloneRoomViews = (function(mozL10n) {
{ clientShortname: mozL10n.get("clientShortname2") });
case FAILURE_DETAILS.ICE_FAILED:
return mozL10n.get("rooms_ice_failure_message");
case FAILURE_DETAILS.COULD_NOT_CONNECT:
return mozL10n.get("rooms_server_unavailable_message");
default:
return mozL10n.get("status_error");
}
@ -447,15 +449,19 @@ loop.standaloneRoomViews = (function(mozL10n) {
componentWillUpdate: function(nextProps, nextState) {
if (this.state.roomState !== ROOM_STATES.READY &&
nextState.roomState === ROOM_STATES.READY) {
var roomName = nextState.roomName ||
this.state.roomName ||
this.state.roomContextUrls[0].description ||
this.state.roomContextUrls[0].location;
this.setTitle(mozL10n.get("standalone_title_with_room_name", {
roomName: roomName,
clientShortname: mozL10n.get("clientShortname2")
}));
var roomName = nextState.roomName;
if (!roomName && nextState.roomContextUrls) {
roomName = nextState.roomContextUrls[0].description ||
nextState.roomContextUrls[0].location;
}
if (!roomName) {
this.setTitle(mozL10n.get("clientShortname2"));
} else {
this.setTitle(mozL10n.get("standalone_title_with_room_name", {
roomName: roomName,
clientShortname: mozL10n.get("clientShortname2")
}));
}
}
if (this.state.roomState !== ROOM_STATES.MEDIA_WAIT &&

View File

@ -64,6 +64,7 @@ rooms_media_denied_message=We could not get access to your microphone or camera.
room_information_failure_not_available=No information about this conversation is available. Please request a new link from the person who sent it to you.
room_information_failure_unsupported_browser=Your browser cannot access any information about this conversation. Please make sure you're using the latest version.
rooms_ice_failure_message=Connection failed. Your firewall may be blocking calls.
rooms_server_unavailable_message=Could not connect to the server.
## LOCALIZATION_NOTE(rooms_read_while_wait_offer): This string is followed by a
# tile/offer image and title that are provided by a separate service that has

View File

@ -120,6 +120,8 @@ describe("loop.store.ActiveRoomStore", function() {
});
it("should set the state to `FAILED` on generic error", function() {
// errno !== undefined
fakeError.errno = 999;
store.roomFailure(new sharedActions.RoomFailure({
error: fakeError,
failedJoinRequest: false
@ -129,6 +131,16 @@ describe("loop.store.ActiveRoomStore", function() {
expect(store._storeState.failureReason).eql(FAILURE_DETAILS.UNKNOWN);
});
it("should set the state to `COULD_NOT_CONNECT` on undefined errno", function() {
store.roomFailure(new sharedActions.RoomFailure({
error: fakeError,
failedJoinRequest: false
}));
expect(store._storeState.roomState).eql(ROOM_STATES.FAILED);
expect(store._storeState.failureReason).eql(FAILURE_DETAILS.COULD_NOT_CONNECT);
});
it("should set the failureReason to EXPIRED_OR_INVALID on server error: " +
"invalid token", function() {
fakeError.errno = REST_ERRNOS.INVALID_TOKEN;

View File

@ -107,6 +107,19 @@ describe("loop.StandaloneMozLoop", function() {
return promise;
});
it("should call the callback on xhr error", function() {
var promise = loop.request("Rooms:Get", "fakeToken").then(function(result) {
expect(result.isError).eql(true);
expect(/HTTP 0/.test(result.message)).eql(true);
});
// Method to mock network failure
// https://github.com/sinonjs/sinon/issues/361
requests[0].respond(0, {}, "");
return promise;
});
});
describe("#rooms.join", function() {

View File

@ -346,6 +346,20 @@ describe("loop.standaloneRoomViews", function() {
.eql("tos_failure_message");
});
it("should display cannot connect to server on COULD_NOT_CONNECT", function() {
view = mountTestComponent({ failureReason: FAILURE_DETAILS.COULD_NOT_CONNECT });
expect(view.getDOMNode().querySelector(".failed-room-message").textContent)
.eql("rooms_server_unavailable_message");
});
it("should display Something went wrong on UNKNOWN error", function() {
view = mountTestComponent({ failureReason: FAILURE_DETAILS.UNKNOWN });
expect(view.getDOMNode().querySelector(".failed-room-message").textContent)
.eql("status_error");
});
it("should not display a retry button when the failure reason is expired or invalid", function() {
view = mountTestComponent({ failureReason: FAILURE_DETAILS.EXPIRED_OR_INVALID });
@ -443,6 +457,29 @@ describe("loop.standaloneRoomViews", function() {
expect(fakeWindow.document.title).to.equal("fakeName — clientShortname2");
});
it("should set document.title to brand name when state is READY and roomName is undefined", function() {
activeRoomStore.setStoreState({ roomState: ROOM_STATES.INIT });
view = mountTestComponent();
activeRoomStore.setStoreState({ roomName: undefined, roomState: ROOM_STATES.READY });
expect(fakeWindow.document.title).to.equal("clientShortname2");
});
it("should set document.title to roomContectUrls[0] and brand name when state is READY and roomContextUrls is present", function() {
activeRoomStore.setStoreState({ roomState: ROOM_STATES.INIT });
view = mountTestComponent();
activeRoomStore.setStoreState({
roomName: undefined,
roomContextUrls: [{
description: "fakeStartPage",
location: null
}],
roomState: ROOM_STATES.READY
});
expect(fakeWindow.document.title).to.equal("fakeStartPage — clientShortname2");
});
it("should dispatch a `SetupStreamElements` action when the MEDIA_WAIT state " +
"is entered", function() {
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });

View File

@ -101,13 +101,14 @@ idea {
// Object directories take a huge amount of time for IntelliJ to index.
// Exclude them. Convention is that object directories start with obj.
// IntelliJ is clever and will not exclude the parts of the object
// directory that are referenced, if there are any.
// In practice, indexing the entirety of the tree is taking too long.
// directory that are referenced, if there are any. In practice,
// indexing the entirety of the tree is taking too long, so exclude all
// but mobile/.
def topsrcdirURI = file(topsrcdir).toURI()
excludeDirs += files(file(topsrcdir)
.listFiles({it.isDirectory()} as FileFilter)
.collect({topsrcdirURI.relativize(it.toURI()).toString()}) // Relative paths.
.findAll({it.startsWith('obj') && !it.startsWith('.') && !it.equals('mobile/')}))
.findAll({!it.equals('mobile/')}))
// If topobjdir is below topsrcdir, hide only some portions of that tree.
def topobjdirURI = file(topobjdir).toURI()

View File

@ -239,8 +239,6 @@ var DebuggerController = {
return;
}
yield this._settleAllRequests();
DebuggerView.destroy();
this.StackFrames.disconnect();
this.ThreadState.disconnect();
@ -253,24 +251,6 @@ var DebuggerController = {
this._shutdown = true;
}),
_settleAllRequests: function() {
const requests = this.getState().asyncRequests;
if (requests.length > 0) {
const deferred = promise.defer();
this.onChange('open-requests', function checkSettled(reqs) {
if (reqs.length === 0) {
deferred.resolve();
}
this.offChange('open-requests', checkSettled);
}.bind(this));
return deferred.promise;
}
return promise.resolve();
},
/**
* Initiates remote debugging based on the current target, wiring event
* handlers as necessary.

View File

@ -27,8 +27,7 @@ android {
manifest.srcFile "${topsrcdir}/mobile/android/base/AndroidManifest.xml"
java {
srcDir "${topobjdir}/gradle/base/src"
srcDir "${topsrcdir}/mobile/android/base/java"
srcDir "${topsrcdir}/mobile/android/search/java"
srcDir "${topsrcdir}/mobile/android/javaaddons/java"
srcDir "${topsrcdir}/mobile/android/services/src/main/java"
@ -130,6 +129,5 @@ apply plugin: 'idea'
idea {
module {
excludeDirs += file("${topobjdir}/gradle/base/src/org/mozilla/gecko/resources")
}
}

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