internal string GetDocument()
{
comm.JSCall (GeckoFunctions.GetPage, "DocumentReturn", null);
int counter = 0;
do {
//only allow JS 5 seconds to return value
if (counter > 50) throw new Exception ("Mozilla did not return value during 5 seconds");
System.Threading.Thread.Sleep (100);
counter++;
}
while (outDocument == null);
System.Diagnostics.Trace.WriteLine ("Retrieved document from Gecko in ~" + (100*counter).ToString () + "ms.");
System.Diagnostics.Trace.WriteLine ("Document: " + outDocument);
string d = outDocument;
outDocument = null;
return d;
}