Bug 773563 - Cleanup BTA_detach callers to avoid redundant state checks; r=robcee

This commit is contained in:
Panos Astithas 2013-12-16 21:27:00 +02:00
Родитель 29a80491f9
Коммит fa291d77b5
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -606,8 +606,7 @@ BrowserTabActor.prototype = {
return;
}
if (this.attached) {
this._detach();
if (this._detach()) {
this.conn.send({ from: this.actorID,
type: "tabDetached" });
}
@ -675,10 +674,12 @@ BrowserTabActor.prototype = {
/**
* Does the actual work of detaching from a tab.
*
* @returns false if the tab wasn't attached or true of detahing succeeds.
*/
_detach: function BTA_detach() {
if (!this.attached) {
return;
return false;
}
if (this._progressListener) {
@ -699,6 +700,7 @@ BrowserTabActor.prototype = {
}
this._attached = false;
return true;
},
// Protocol Request Handlers
@ -714,12 +716,10 @@ BrowserTabActor.prototype = {
},
onDetach: function BTA_onDetach(aRequest) {
if (!this.attached) {
if (!this._detach()) {
return { error: "wrongState" };
}
this._detach();
return { type: "detached" };
},