aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/extension.lisp4
-rw-r--r--src/main.lisp31
2 files changed, 35 insertions, 0 deletions
diff --git a/src/extension.lisp b/src/extension.lisp
index bc75fb9..9fe258c 100644
--- a/src/extension.lisp
+++ b/src/extension.lisp
@@ -5,6 +5,10 @@
:initarg :id
:reader id
:documentation "The extension's ID.")
+ (url
+ :initarg :url
+ :reader url
+ :documentation "The DevTools Protocol target URL.")
(session-id
:initarg :session-id
:reader session-id
diff --git a/src/main.lisp b/src/main.lisp
index 3bc79c8..8ea05ab 100644
--- a/src/main.lisp
+++ b/src/main.lisp
@@ -72,6 +72,16 @@
(attach-extensions targets extension-ids)))
(when (target-attached-to-target-msg-p response)
+ (when (and (reload-current-tab config)
+ (target-attached-to-target-msg-manifest-v3-extension-p response))
+ ;; response is an extension in *extensions*
+
+ (reload-tab (json-obj-get
+ (json-obj-get response "result")
+ "sessionId"))
+
+ (return-from ws-on-message))
+
(track-service-worker-target response)
(reload-extension (json-obj-get
@@ -198,9 +208,30 @@ the target to reload the current tab."
;; Extension IDs are 32 characters long.
(+ 19 32))
+ :url (json-obj-get target-info "url")
:session-id (json-obj-get params "sessionId"))
*extensions*))))
+(defun target-attached-to-target-msg-manifest-v3-extension-p (msg)
+ "Return true if the Target.attachedToTarget message `msg` corresonds to a
+tracked Manifest V3 extension."
+ (filter
+ #'(lambda (extension)
+ (string= (json-obj-get
+ (json-obj-get
+ (json-obj-get msg "params")
+ "targetInfo")
+ "url")
+ (url extension)))
+ *extensions*))
+
+(defun manifest-v3-extension-p (extension)
+ "Return true if `extension` is in our list of tracked Manifest V3 extensions."
+ (filter
+ #'(lambda (ext)
+ ())
+ *extensions*))
+
(defun websocket-send (client data)
"Send `data` to WebSocket `client` and increment `*wg*`."
(when (debug-output *config*)