Bug 903871 - JS crash in SelectionHandler during longtap text select on target page, r=margaret

This commit is contained in:
Mark Capella 2013-08-13 14:51:26 -04:00
parent 4f6106a065
commit aecc09afa2

View File

@ -192,14 +192,14 @@ var SelectionHandler = {
this._contentWindow.getSelection().removeAllRanges();
if (!this._domWinUtils.selectAtPoint(aX, aY, Ci.nsIDOMWindowUtils.SELECT_WORDNOSPACE)) {
this._onFail("failed to set selection at point");
this._closeSelection();
return;
}
let selection = this._getSelection();
// If the range didn't have any text, let's bail
if (!selection) {
this._onFail("no selection was present");
if (!selection || selection.rangeCount == 0) {
this._closeSelection();
return;
}
@ -452,16 +452,6 @@ var SelectionHandler = {
this._closeSelection();
},
/*
* Called if for any reason we fail during the selection
* process. Cancels the selection.
*/
_onFail: function sh_onFail(aDbgMessage) {
if (aDbgMessage && aDbgMessage.length > 0)
Cu.reportError("SelectionHandler - " + aDbgMessage);
this._closeSelection();
},
/*
* Shuts SelectionHandler down.
*/