IHTMLTxtRange findText hangs



Hi,

I'm hosting the WebBrowser control in a C# Windows Forms application. In my
DocumentComplete handler I check that the document is completely loaded
(browser.readyState == READYSTATE_COMPLETE), after which I proceed to create
an IHTMLTxtRange object out of the HTML body object. I then call the
IHTMLTxtRange.findText method in a loop to find all instances of certain
words. Most of the time everything works fine.

The problem is that with some web pages (I have not been able to find any
rule yet) a call to findText occasionally hangs in a busy loop with 100% CPU
utilization and never returns.

I can't find any obvious bugs in my code (and even if I had a bug it surely
should not cause findText to hang). Anybody got any similar experiences?

Curiously, if I navigate to such a page in Internet Explorer, press
control+F and search for the word, IE *also* occasionally hangs. It may have
something to do with invoking the search dialog while the page is still
loading but I'm not sure. An example of such a page is
http://searchenginewatch.com/searchday/article.php/2161381 for the word
'result' (without the quotes).

I might be able to provide a small but complete sample that demonstrates the
problem but I'd first like to see if anybody has run into this before. I'm
running Windows XP with latest patches.

Regards,
Sami


.