/// <summary> /// Refreshes the specified page using the specified URL after the specified number of seconds. /// @throws IOException if the refresh fails /// </summary> /// <param name="page">the page that is going to be refreshed</param> /// <param name="url">the URL where the new page will be loaded</param> /// <param name="requestedWait">the number of seconds to wait before reloading the page; if this is greater than <tt>maxwait</tt> then <tt>maxwait</tt> will be used instead</param> public void HandleRefresh(AbstractPage page, URL url, int requestedWait) { int seconds = requestedWait; if (seconds > maxwait_ && maxwait_ > 0) { seconds = maxwait_; } try { Thread.Sleep(seconds * 1000); } catch (/*InterruptedException*/Exception e) { /* This can happen when the refresh is happening from a navigation that started * from a setTimeout or setInterval. The navigation will cause all threads to get * interrupted, including the current thread in this case. It should be safe to * ignore it since this is the thread now doing the navigation. Eventually we should * refactor to force all navigation to happen back on the main thread. */ if (LOG.IsDebugEnabled) { LOG.Debug("Waiting thread was interrupted. Ignoring interruption to continue navigation."); } } IWebWindow window = page.EnclosingWindow; if (window == null) { return; } WebClient client = window.WebClient; client.getPage(window, new WebRequest(url)); }