[yelp] yelp-view: Don't spin loading cursor forever



commit 9dcb90e3d9d4b34d8c363f53bb4e1c39da7317c5
Author: Shaun McCance <shaunm gnome org>
Date:   Sat Apr 16 13:26:39 2011 -0400

    yelp-view: Don't spin loading cursor forever

 libyelp/yelp-view.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 79f9b92..15f6c9f 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -2084,8 +2084,17 @@ document_callback (YelpDocument       *document,
          * let the main loop run through.
          */
         if (priv->vadjust > 0 || priv->hadjust > 0 || priv->page_title == NULL)
-            while (g_main_context_pending (NULL))
+            while (g_main_context_pending (NULL)) {
+                WebKitLoadStatus status;
+                status = webkit_web_view_get_load_status (WEBKIT_WEB_VIEW (view));
                 g_main_context_iteration (NULL, FALSE);
+                /* Sometimes some runaway JavaScript causes there to always
+                 * be pending sources. Break out of the document is loaded.
+                 */
+                if (status == WEBKIT_LOAD_FINISHED ||
+                    status == WEBKIT_LOAD_FAILED)
+                    break;
+            }
 
         /* Setting adjustments only work after the page is loaded. These
          * are set by view_history_action, and they're reset to 0 after



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]