Module: Selenium::WebDriver::ProfileHelper::ClassMethods Private
- Defined in:
- lib/selenium/webdriver/common/profile_helper.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #from_json(json) ⇒ Object private
Instance Method Details
#from_json(json) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/selenium/webdriver/common/profile_helper.rb', line 67 def from_json(json) data = WebDriver.json_load(json).fetch('zip') # can't use Tempfile here since it doesn't support File::BINARY mode on 1.8 # can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082 tmp_dir = Dir.mktmpdir begin zip_path = File.join(tmp_dir, "webdriver-profile-duplicate-#{json.hash}.zip") File.open(zip_path, "wb") { |zip_file| zip_file << Base64.decode64(data) } new Zipper.unzip(zip_path) ensure FileUtils.rm_rf tmp_dir end end |