Bug 778263 - Clean up SelectionHandler data when we bail in startSelection. r=mfinkle

This commit is contained in:
Margaret Leibovic 2012-08-07 11:20:11 -07:00
parent bd8aac38bd
commit 9eb4b7cf5e

View File

@ -1683,13 +1683,14 @@ var SelectionHandler = {
selectionController.wordMove(!this._isRTL, true);
} catch(e) {
// If we couldn't select the word at the given point, bail
Cu.reportError("Error selecting word: " + e);
this._cleanUp();
return;
}
// If there isn't an appropriate selection, bail
if (!selection.rangeCount || !selection.getRangeAt(0) || !selection.toString().trim().length) {
selection.collapseToStart();
this._cleanUp();
return;
}
@ -1838,13 +1839,17 @@ var SelectionHandler = {
}
}
this._cleanUp();
return selectedText;
},
_cleanUp: function sh_cleanUp() {
this._view.removeEventListener("pagehide", this, false);
this._view = null;
this._target = null;
this._isRTL = false;
this.cache = null;
return selectedText;
},
_getViewOffset: function sh_getViewOffset() {