emacs-devel
[Top][All Lists]
Advanced

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

[PATCH 05/15] xwidget: Get title via asynchronous JavaScript.


From: Ricardo Wurmus
Subject: [PATCH 05/15] xwidget: Get title via asynchronous JavaScript.
Date: Mon, 24 Oct 2016 18:40:51 +0200

* lisp/xwidget.el (xwidget-webkit-callback): Get document title
asynchronously.
---
 lisp/xwidget.el | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index a252fd7..1333365 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -194,13 +194,14 @@ XWIDGET instance, XWIDGET-EVENT-TYPE depends on the 
originating xwidget."
        "error: callback called for xwidget with dead buffer")
     (with-current-buffer (xwidget-buffer xwidget)
       (cond ((eq xwidget-event-type 'load-changed)
-             (xwidget-log "webkit finished loading: '%s'"
-                          (xwidget-webkit-get-title xwidget))
-             ;;TODO - check the native/internal scroll
-             ;;(xwidget-adjust-size-to-content xwidget)
-             (xwidget-webkit-adjust-size-dispatch) ;;TODO xwidget arg
-             (rename-buffer (format "*xwidget webkit: %s *"
-                                    (xwidget-webkit-get-title xwidget)))
+             (xwidget-webkit-execute-script
+              xwidget "document.title"
+              (lambda (title)
+                (xwidget-log "webkit finished loading: '%s'" title)
+                ;;TODO - check the native/internal scroll
+                ;;(xwidget-adjust-size-to-content xwidget)
+                (xwidget-webkit-adjust-size-dispatch) ;;TODO xwidget arg
+                (rename-buffer (format "*xwidget webkit: %s *" title))))
              (pop-to-buffer (current-buffer)))
             ((eq xwidget-event-type 'decide-policy)
              (let ((strarg  (nth 3 last-input-event)))
-- 
2.10.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]