Преглед на файлове

Stop trying to close the browser during global destruction

It relies on objects being around on $self that there is no guarantee of
us having.
Daniel Gempesaw преди 10 години
родител
ревизия
940bf140a1
променени са 1 файла, в които са добавени 8 реда и са изтрити 2 реда
  1. 8 2
      lib/Selenium/Remote/Driver.pm

+ 8 - 2
lib/Selenium/Remote/Driver.pm

@@ -487,8 +487,9 @@ sub new_from_caps {
 }
 
 sub DEMOLISH {
-    my ($self) = @_;
+    my ($self, $in_global_destruction) = @_;
     return if $$ != $self->pid;
+    return if $in_global_destruction;
     $self->quit() if ( $self->auto_close && defined $self->session_id );
 }
 
@@ -986,7 +987,12 @@ sub close {
 =head2 quit
 
  Description:
-    Delete the session & close open browsers.
+    Delete the session & close open browsers. We will try to call this
+    on our down when we get DEMOLISHed, but in the event that we are
+    only demolished during global destruction, we will not be able to
+    close the browser. For your own unattended and/or complicated tests,
+    we recommend explicitly calling quit to make sure you're not leaving
+    orphan browsers around.
 
  Usage:
     $driver->quit();