Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #23373 from etiennesegonzac/bug-1007598-1.4
Browse files Browse the repository at this point in the history
Bug 1007598 - We should never try to format the phone number on a removed call r=gsvelto a=bbajaj
  • Loading branch information
etiennesegonzac committed Aug 28, 2014
2 parents 59e74a8 + 4058e5b commit d6a1e93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 3 additions & 7 deletions apps/callscreen/js/handled_call.js
Expand Up @@ -22,6 +22,7 @@ function HandledCall(aCall) {
this._initialState = this.call.state;
this._cachedInfo = '';
this._cachedAdditionalInfo = '';
this._removed = false;

this.node = document.getElementById('handled-call-template').cloneNode(true);
this.node.id = '';
Expand Down Expand Up @@ -231,13 +232,7 @@ HandledCall.prototype.restoreAdditionalContactInfo =

HandledCall.prototype.formatPhoneNumber =
function hc_formatPhoneNumber(ellipsisSide, maxFontSize) {
/**
* To solve bug 1017365 the font-size in case of emergency calls is set to
* the minimum one from the beginning and additional invocations of this
* function (due to changes in the state of the call (on hold, ended,
* etc.)) should be ignored.
*/
if (this.node.classList.contains('emergency-call')) {
if (this._removed) {
return;
}

Expand Down Expand Up @@ -288,6 +283,7 @@ HandledCall.prototype.updateDirection = function hc_updateDirection() {
};

HandledCall.prototype.remove = function hc_remove() {
this._removed = true;
this.call.removeEventListener('statechange', this);
this.photo = null;

Expand Down
8 changes: 8 additions & 0 deletions apps/callscreen/test/unit/handled_call_test.js
Expand Up @@ -655,6 +655,14 @@ suite('dialer/handled_call', function() {
assert.equal(subject.numberNode.style.fontSize, '');
});

test('formatPhoneNumber should do nothing if the call was removed',
function() {
subject.remove();
subject.numberNode.style.fontSize = '36px';
subject.formatPhoneNumber();
assert.equal(subject.numberNode.style.fontSize, '36px');
});

test('check replace number', function() {
mockCall = new MockCall('888', 'incoming');
subject = new HandledCall(mockCall);
Expand Down

0 comments on commit d6a1e93

Please sign in to comment.