class Selenium::WebDriver::Firefox::Profile

def read_user_prefs(path)

def read_user_prefs(path)
  prefs = {}
  return prefs unless File.exist?(path)
  File.read(path).split("\n").each do |line|
    next unless line =~ /user_pref\("([^"]+)"\s*,\s*(.+?)\);/
    key = Regexp.last_match(1)&.strip
    value = Regexp.last_match(2)&.strip
    # wrap the value in an array to make it a valid JSON string.
    prefs[key] = JSON.parse("[#{value}]").first
  end
  prefs
end