Bug 1008450 - Bail on _findIterator when we lack a body node. r=mikedeboer
authorAdam Dane [:hobophobe] <unusualtears@gmail.com>
Wed, 14 May 2014 15:16:03 -0500
changeset 183208 f692d3faf83ca87890f2d1f966d603b4db646447
parent 183207 ee05aeba30f7fe5d3a41d322e4e73397ce7bdfff
child 183209 28e4d5e18cf40ef6b6cf2ebe00856540d90be663
push idunknown
push userunknown
push dateunknown
reviewersmikedeboer
bugs1008450
milestone32.0a1
Bug 1008450 - Bail on _findIterator when we lack a body node. r=mikedeboer
toolkit/modules/Finder.jsm
--- a/toolkit/modules/Finder.jsm
+++ b/toolkit/modules/Finder.jsm
@@ -353,16 +353,19 @@ Finder.prototype = {
    *        returned, the find operation will be stopped and the Function will
    *        not be invoked again.
    */
   _findIterator: function(aWord, aWindow, aOnFind) {
     let doc = aWindow.document;
     let body = (doc instanceof Ci.nsIDOMHTMLDocument && doc.body) ?
                doc.body : doc.documentElement;
 
+    if (!body)
+      return;
+
     let searchRange = doc.createRange();
     searchRange.selectNodeContents(body);
 
     let startPt = searchRange.cloneRange();
     startPt.collapse(true);
 
     let endPt = searchRange.cloneRange();
     endPt.collapse(false);