소스 검색

Firefox attaches marionette server to proper port

Vangelis Katsikaros 9 년 전
부모
커밋
ed023ce13a
3개의 변경된 파일16개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      lib/Selenium/CanStartBinary.pm
  2. 2 1
      lib/Selenium/Firefox/Binary.pm
  3. 13 0
      lib/Selenium/Firefox/Profile.pm

+ 1 - 1
lib/Selenium/CanStartBinary.pm

@@ -280,7 +280,7 @@ sub _build_binary_mode {
     $self->marionette_port : 0;
 
     if ($self->isa('Selenium::Firefox')) {
-        my @args = ($port);
+        my @args = ($port, $marionette_port);
 
         if ($self->has_firefox_profile) {
             push @args, $self->firefox_profile;

+ 2 - 1
lib/Selenium/Firefox/Binary.pm

@@ -64,10 +64,11 @@ sub firefox_path {
 # the end of this function.
 my $profile;
 sub setup_firefox_binary_env {
-    my ($port, $caller_profile) = @_;
+    my ($port, $marionette_port, $caller_profile) = @_;
 
     $profile = $caller_profile || Selenium::Firefox::Profile->new;
     $profile->add_webdriver($port);
+    $profile->add_marionette($marionette_port);
 
     $ENV{'XRE_PROFILE_PATH'} = $profile->_layout_on_disk;
     $ENV{'MOZ_NO_REMOTE'} = '1';             # able to launch multiple instances

+ 13 - 0
lib/Selenium/Firefox/Profile.pm

@@ -217,6 +217,19 @@ sub add_webdriver {
     $self->set_preference('webdriver_firefox_port', $port);
 }
 
+=method add_marionette
+
+Primarily for internal use, configure Marionette to the
+current Firefox profile.
+
+=cut
+
+sub add_marionette {
+    my ($self, $port) = @_;
+    return if !$port;
+    $self->set_preference('marionette.defaultPrefs.port', $port);
+}
+
 sub _encode {
     my $self = shift;