Skip to content

Commit

Permalink
fix: Errno::ENOENT on browser start
Browse files Browse the repository at this point in the history
  • Loading branch information
route committed Jan 3, 2024
1 parent 352e142 commit 927281f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/ferrum/browser/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Options
attr_reader :window_size, :logger, :ws_max_receive_size,
:js_errors, :base_url, :slowmo, :pending_connection_errors,
:url, :env, :process_timeout, :browser_name, :browser_path,
:save_path, :extensions, :proxy, :port, :host, :headless,
:ignore_default_browser_options, :browser_options, :xvfb
:save_path, :proxy, :port, :host, :headless, :browser_options,
:ignore_default_browser_options, :xvfb
attr_accessor :timeout, :ws_url, :default_user_agent

def initialize(options = nil)
Expand All @@ -43,9 +43,6 @@ def initialize(options = nil)
@logger = parse_logger(@options[:logger])
@base_url = parse_base_url(@options[:base_url]) if @options[:base_url]
@url = @options[:url].to_s if @options[:url]
@extensions = Array(@options[:extensions]).map do |extension|
(extension.is_a?(Hash) && extension[:source]) || File.read(extension)
end

@options.freeze
@browser_options.freeze
Expand All @@ -55,6 +52,12 @@ def base_url=(value)
@base_url = parse_base_url(value)
end

def extensions
@extensions ||= Array(@options[:extensions]).map do |extension|
(extension.is_a?(Hash) && extension[:source]) || File.read(extension)
end
end

def validate_proxy(options)
return unless options

Expand Down

0 comments on commit 927281f

Please sign in to comment.