[Groonga-commit] ranguba/chupa-text-decomposer-webkit at cf0c40a [master] Try to load directly at first

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jul 12 00:16:54 JST 2017


Kouhei Sutou	2017-07-12 00:16:54 +0900 (Wed, 12 Jul 2017)

  New Revision: cf0c40a8f3cd7b9775cf4faabe8ec92145b49904
  https://github.com/ranguba/chupa-text-decomposer-webkit/commit/cf0c40a8f3cd7b9775cf4faabe8ec92145b49904

  Message:
    Try to load directly at first

  Modified files:
    lib/chupa-text/decomposers/webkit.rb

  Modified: lib/chupa-text/decomposers/webkit.rb (+17 -4)
===================================================================
--- lib/chupa-text/decomposers/webkit.rb    2017-07-11 23:43:22 +0900 (a35f796)
+++ lib/chupa-text/decomposers/webkit.rb    2017-07-12 00:16:54 +0900 (7b34808)
@@ -68,19 +68,31 @@ module ChupaText
 
         status = {
           finished: false,
+          load_failed: false,
           screenshot: nil,
         }
         prepare_screenshot(data, view, status)
-        debug do
-          "#{log_tag}[load][html] #{data.uri}"
-        end
-        view.load_html(data.body, data.uri.to_s)
 
         main_context = GLib::MainContext.default
         timeout(compute_timeout_second, view, main_context, status) do
+          debug do
+            "#{log_tag}[load][URI] #{data.uri}"
+          end
+          view.load_uri(data.uri.to_s)
           until status[:finished]
             main_context.iteration(true)
           end
+
+          if status[:load_failed]
+            status[:finished] = false
+            debug do
+              "#{log_tag}[load][HTML] #{data.uri}"
+            end
+            view.load_html(data.body, data.uri.to_s)
+            until status[:finished]
+              main_context.iteration(true)
+            end
+          end
         end
 
         window.destroy
@@ -138,6 +150,7 @@ module ChupaText
         end
         view.signal_connect("load-failed") do |_, _, failed_uri, error|
           status[:finished] = true
+          status[:load_failed] = true
           error do
             message = "failed to load URI: #{failed_uri}: "
             message << "#{error.class}(#{error.code}): #{error.message}"
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index