Skip to content

Commit 4030b3a

Browse files
committed
check if Inspector.targetCrashed is available
from #45 (comment)
1 parent d42fa91 commit 4030b3a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

R/chromote_session.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ ChromoteSession <- R6Class(
8888
# When a target crashes, raise a warning.
8989
# The session cannot be closed because no session id is returned by the
9090
# Inspector.targetCrashed event
91-
p <- p$
92-
then(function(value) {
93-
self$Inspector$targetCrashed(timeout_ = NULL, wait_ = FALSE, function(value) {
94-
warning("Chromote has received a Inspector.targetCrashed event. This means that the ChromoteSession has probably crashed.")
91+
if (!is.null(self$Inspector$targetCrashed)) {
92+
p <- p$
93+
then(function(value) {
94+
self$Inspector$targetCrashed(timeout_ = NULL, wait_ = FALSE, function(value) {
95+
warning("Chromote has received a Inspector.targetCrashed event. This means that the ChromoteSession has probably crashed.")
96+
})
9597
})
96-
})
98+
}
9799

98100
if (wait_) {
99101
self$wait_for(p)

0 commit comments

Comments
 (0)