Skip to content

Commit 4bce61c

Browse files
authored
Merge pull request #45 from RLesur/fix-44
2 parents 7868180 + 889eb07 commit 4bce61c

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

R/chromote.R

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,6 @@ Chromote <- R6Class(
302302
private$sessions[[sid]] <- NULL
303303
session$mark_closed()
304304
})
305-
306-
# When a target crashes, raise a warning.
307-
# The session cannot be closed because no session id is returned by the
308-
# Inspector.targetCrashed event
309-
self$protocol$Inspector$targetCrashed(function(msg) {
310-
warning("Chromote has received a Inspector.targetCrashed event. This means that the ChromoteSession has probably crashed.")
311-
})
312305
},
313306

314307
# =========================================================================

R/chromote_session.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ ChromoteSession <- R6Class(
8585
private$pixel_ratio <- value$result$value
8686
})
8787

88+
# When a target crashes, raise a warning.
89+
if (!is.null(self$Inspector$targetCrashed)) {
90+
p <- p$
91+
then(function(value) {
92+
self$Inspector$targetCrashed(timeout_ = NULL, wait_ = FALSE, function(value) {
93+
warning("Chromote has received a Inspector.targetCrashed event. This means that the ChromoteSession has probably crashed.")
94+
# Even if no targetId nor sessionId is returned by Inspector.targetCashed
95+
# mark the session as closed. This will close all sessions..
96+
self$mark_closed()
97+
})
98+
})
99+
}
100+
88101
if (wait_) {
89102
self$wait_for(p)
90103
} else {

0 commit comments

Comments
 (0)