mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 778263 - Clean up SelectionHandler data when we bail in startSelection. r=mfinkle
This commit is contained in:
parent
9f556de8de
commit
1b2c2dc75a
@ -1683,13 +1683,14 @@ var SelectionHandler = {
|
|||||||
selectionController.wordMove(!this._isRTL, true);
|
selectionController.wordMove(!this._isRTL, true);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// If we couldn't select the word at the given point, bail
|
// If we couldn't select the word at the given point, bail
|
||||||
Cu.reportError("Error selecting word: " + e);
|
this._cleanUp();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there isn't an appropriate selection, bail
|
// If there isn't an appropriate selection, bail
|
||||||
if (!selection.rangeCount || !selection.getRangeAt(0) || !selection.toString().trim().length) {
|
if (!selection.rangeCount || !selection.getRangeAt(0) || !selection.toString().trim().length) {
|
||||||
selection.collapseToStart();
|
selection.collapseToStart();
|
||||||
|
this._cleanUp();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1838,13 +1839,17 @@ var SelectionHandler = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._cleanUp();
|
||||||
|
|
||||||
|
return selectedText;
|
||||||
|
},
|
||||||
|
|
||||||
|
_cleanUp: function sh_cleanUp() {
|
||||||
this._view.removeEventListener("pagehide", this, false);
|
this._view.removeEventListener("pagehide", this, false);
|
||||||
this._view = null;
|
this._view = null;
|
||||||
this._target = null;
|
this._target = null;
|
||||||
this._isRTL = false;
|
this._isRTL = false;
|
||||||
this.cache = null;
|
this.cache = null;
|
||||||
|
|
||||||
return selectedText;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_getViewOffset: function sh_getViewOffset() {
|
_getViewOffset: function sh_getViewOffset() {
|
||||||
|
Loading…
Reference in New Issue
Block a user