Bug 1136931 - Prevent racing hideBoxModel during connection shutdown. r=bgrins

This commit is contained in:
Alexandre Poirot 2015-07-28 05:18:24 -07:00
Родитель 6813eb81dc
Коммит c82a983ec2
3 изменённых файлов: 26 добавлений и 6 удалений

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

@ -1756,6 +1756,14 @@ Toolbox.prototype = {
yield this.highlighterUtils.stopPicker();
yield this._inspector.destroy();
if (this._highlighter) {
// Note that if the toolbox is closed, this will work fine, but will fail
// in case the browser is closed and will trigger a noSuchActor message.
// We ignore the promise that |_hideBoxModel| returns, since we should still
// proceed with the rest of destruction if it fails.
// FF42+ now does the cleanup from the actor.
if (!this.highlighter.traits.autoHideOnDestroy) {
this.highlighterUtils.unhighlight();
}
yield this._highlighter.destroy();
}
if (this._selection) {

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

@ -1466,11 +1466,6 @@ MarkupView.prototype = {
this._destroyer = promise.resolve();
// Note that if the toolbox is closed, this will work fine, but will fail
// in case the browser is closed and will trigger a noSuchActor message.
// We ignore the promise that |_hideBoxModel| returns, since we should still
// proceed with the rest of destruction if it fails.
this._hideBoxModel();
this._clearBriefBoxModelTimer();
this._elt.removeEventListener("click", this._onMouseClick, false);

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

@ -158,6 +158,15 @@ let HighlighterActor = exports.HighlighterActor = protocol.ActorClass({
return this._inspector && this._inspector.conn;
},
form: function() {
return {
actor: this.actorID,
traits: {
autoHideOnDestroy: true
}
}
},
_createHighlighter: function() {
this._isPreviousWindowXUL = isXUL(this._tabActor.window);
@ -199,6 +208,7 @@ let HighlighterActor = exports.HighlighterActor = protocol.ActorClass({
destroy: function() {
protocol.Actor.prototype.destroy.call(this);
this.hideBoxModel();
this._destroyHighlighter();
events.off(this._tabActor, "navigate", this._onNavigate);
@ -416,7 +426,14 @@ let HighlighterActor = exports.HighlighterActor = protocol.ActorClass({
})
});
let HighlighterFront = protocol.FrontClass(HighlighterActor, {});
let HighlighterFront = protocol.FrontClass(HighlighterActor, {
// Update the object given a form representation off the wire.
form: function(json) {
this.actorID = json.actor;
// FF42+ HighlighterActors starts exposing custom form, with traits object
this.traits = json.traits || {};
}
});
/**
* A generic highlighter actor class that instantiate a highlighter given its