capybara-simulated 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -274,11 +274,23 @@ module Capybara
274
274
  def visit(path) = current_browser.visit(path)
275
275
  def refresh = current_browser.refresh
276
276
  def reset!
277
+ reset_windows!
278
+ browser.reset!
279
+ end
280
+
281
+ # Dispose every auxiliary window and return focus to the primary — a fresh
282
+ # browsing context has no sibling windows. Disposing each aux Browser tears
283
+ # down its worker / SSE / websocket threads and its V8 isolate eagerly; left
284
+ # alone they pile into V8Runtime's process-wide `@@live` set and are only
285
+ # reclaimed by the at_exit hook, which on a long-lived multi-file session
286
+ # (the WPT runner) means a slow — sometimes minutes-long — process exit. Split
287
+ # out of `reset!` so a caller can drop windows WITHOUT resetting the primary's
288
+ # page state (the WPT runner rebuilds the primary itself, per file, via visit).
289
+ def reset_windows!
277
290
  @aux_windows.each {|w| w[:browser].dispose rescue nil }
278
291
  @aux_windows.clear
279
292
  @active_handle = nil
280
293
  @blob_partitions_lock.synchronize { @blob_partitions.clear }
281
- browser.reset!
282
294
  end
283
295
  def go_back = current_browser.go_back
284
296
  def go_forward = current_browser.go_forward