File tree Expand file tree Collapse file tree 2 files changed +2
-16
lines changed
rb/lib/selenium/webdriver/common Expand file tree Collapse file tree 2 files changed +2
-16
lines changed Original file line number Diff line number Diff line change @@ -73,16 +73,10 @@ module ClassMethods
73
73
def from_json ( json )
74
74
data = decoded ( json )
75
75
76
- # can't use Tempfile here since it doesn't support File::BINARY mode on 1.8
77
- # can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082
78
- tmp_dir = Dir . mktmpdir
79
- begin
80
- zip_path = File . join ( tmp_dir , "webdriver-profile-duplicate-#{ json . hash } .zip" )
76
+ Tempfile . create do |zip_path |
81
77
File . open ( zip_path , 'wb' ) { |zip_file | zip_file << Base64 . decode64 ( data ) }
82
78
83
79
new Zipper . unzip ( zip_path )
84
- ensure
85
- FileUtils . rm_rf tmp_dir
86
80
end
87
81
end
88
82
end # ClassMethods
Original file line number Diff line number Diff line change @@ -72,16 +72,8 @@ def zip_file(path)
72
72
private
73
73
74
74
def with_tmp_zip ( &blk )
75
- # can't use Tempfile here since it doesn't support File::BINARY mode on 1.8
76
- # can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082
77
- tmp_dir = Dir . mktmpdir
78
- zip_path = File . join ( tmp_dir , 'webdriver-zip' )
79
-
80
- begin
75
+ Tempfile . create do |zip_path |
81
76
Zip ::File . open ( zip_path , Zip ::File ::CREATE , &blk )
82
- ensure
83
- FileUtils . rm_rf tmp_dir
84
- FileUtils . rm_rf zip_path
85
77
end
86
78
end
87
79
You can’t perform that action at this time.
0 commit comments