<commit_before>module Selenium
  module WebDriver
    module Firefox

      # @api private
      class Bridge < Remote::Bridge

        def initialize(opts = {})
          @launcher   = create_launcher(opts)

          http_client = opts.delete(:http_client)

          unless opts.empty?
            raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
          end

          @launcher.launch

          remote_opts = {
            :url                  => @launcher.url,
            :desired_capabilities => :firefox
          }

          remote_opts.merge!(:http_client => http_client) if http_client

          super(remote_opts)
        end

        def browser
          :firefox
        end

        def driver_extensions
          [DriverExtensions::TakesScreenshot]
        end

        def quit
          super
          @launcher.quit

          nil
        end

        private

        def create_launcher(opts)
          Launcher.new(
            Binary.new,
            opts.delete(:port) || DEFAULT_PORT,
            opts.delete(:profile)
          )
        end

      end # Bridge
    end # Firefox
  end # WebDriver
end # Selenium<commit_msg>JariBakken: Improve Firefox::Bridge#create_launcher<commit_after>module Selenium
  module WebDriver
    module Firefox

      # @api private
      class Bridge < Remote::Bridge

        def initialize(opts = {})
          port        = opts.fetch  :port, DEFAULT_PORT)
          profile     = opts.delete :profile
          http_client = opts.delete :http_client

          @launcher   = create_launcher(port, profile)

          unless opts.empty?
            raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
          end

          @launcher.launch

          remote_opts = {
            :url                  => @launcher.url,
            :desired_capabilities => :firefox
          }

          remote_opts.merge!(:http_client => http_client) if http_client

          super(remote_opts)
        end

        def browser
          :firefox
        end

        def driver_extensions
          [DriverExtensions::TakesScreenshot]
        end

        def quit
          super
          @launcher.quit

          nil
        end

        private

        def create_launcher(port, profile)
          Launcher.new Binary.new, port, profile
        end

      end # Bridge
    end # Firefox
  end # WebDriver
end # Selenium
{'fraction_non_alphanumeric': 0.07610474631751228, 'fraction_numerical': 0.0008183306055646482, 'mean_word_length': 1.5258264462809918, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3509876', 'n_tokens_mistral': 702, 'n_tokens_neox': 633, 'n_words': 152}