selenium-webdriver 2.46.2 → 2.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +6 -0
 - data/Gemfile.lock +11 -8
 - data/lib/selenium/webdriver/firefox/extension/prefs.json +2 -0
 - data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
 - data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
 - data/lib/selenium/webdriver/safari.rb +0 -1
 - data/lib/selenium/webdriver/safari/bridge.rb +0 -4
 - data/lib/selenium/webdriver/safari/options.rb +0 -38
 - data/lib/selenium/webdriver/safari/resources/client.js +1454 -1192
 - data/selenium-webdriver.gemspec +1 -1
 - metadata +2 -4
 - data/lib/selenium/webdriver/firefox/socket_lock.rb +0 -78
 - data/lib/selenium/webdriver/safari/extensions.rb +0 -189
 
    
        data/selenium-webdriver.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            name: selenium-webdriver
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
4 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       5 
     | 
    
         
            -
              version: 2. 
     | 
| 
      
 5 
     | 
    
         
            +
              version: 2.47.0
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors: 
         
     | 
| 
       8 
8 
     | 
    
         
             
              - Jari Bakken
         
     | 
| 
         @@ -10,7 +10,7 @@ autorequire: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2015-07-29 00:00:00 -05:00
         
     | 
| 
       14 
14 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       16 
16 
     | 
    
         
             
              - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -205,7 +205,6 @@ files: 
     | 
|
| 
       205 
205 
     | 
    
         
             
              - lib/selenium/webdriver/firefox/launcher.rb
         
     | 
| 
       206 
206 
     | 
    
         
             
              - lib/selenium/webdriver/firefox/profile.rb
         
     | 
| 
       207 
207 
     | 
    
         
             
              - lib/selenium/webdriver/firefox/profiles_ini.rb
         
     | 
| 
       208 
     | 
    
         
            -
              - lib/selenium/webdriver/firefox/socket_lock.rb
         
     | 
| 
       209 
208 
     | 
    
         
             
              - lib/selenium/webdriver/firefox/util.rb
         
     | 
| 
       210 
209 
     | 
    
         
             
              - lib/selenium/webdriver/firefox/extension/prefs.json
         
     | 
| 
       211 
210 
     | 
    
         
             
              - lib/selenium/webdriver/firefox/extension/webdriver.xpi
         
     | 
| 
         @@ -227,7 +226,6 @@ files: 
     | 
|
| 
       227 
226 
     | 
    
         
             
              - lib/selenium/webdriver/remote/http/persistent.rb
         
     | 
| 
       228 
227 
     | 
    
         
             
              - lib/selenium/webdriver/safari/bridge.rb
         
     | 
| 
       229 
228 
     | 
    
         
             
              - lib/selenium/webdriver/safari/browser.rb
         
     | 
| 
       230 
     | 
    
         
            -
              - lib/selenium/webdriver/safari/extensions.rb
         
     | 
| 
       231 
229 
     | 
    
         
             
              - lib/selenium/webdriver/safari/options.rb
         
     | 
| 
       232 
230 
     | 
    
         
             
              - lib/selenium/webdriver/safari/server.rb
         
     | 
| 
       233 
231 
     | 
    
         
             
              - lib/selenium/webdriver/safari/resources/client.js
         
     | 
| 
         @@ -1,78 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Licensed to the Software Freedom Conservancy (SFC) under one
         
     | 
| 
       2 
     | 
    
         
            -
            # or more contributor license agreements.  See the NOTICE file
         
     | 
| 
       3 
     | 
    
         
            -
            # distributed with this work for additional information
         
     | 
| 
       4 
     | 
    
         
            -
            # regarding copyright ownership.  The SFC licenses this file
         
     | 
| 
       5 
     | 
    
         
            -
            # to you under the Apache License, Version 2.0 (the
         
     | 
| 
       6 
     | 
    
         
            -
            # "License"); you may not use this file except in compliance
         
     | 
| 
       7 
     | 
    
         
            -
            # with the License.  You may obtain a copy of the License at
         
     | 
| 
       8 
     | 
    
         
            -
            #
         
     | 
| 
       9 
     | 
    
         
            -
            #   http://www.apache.org/licenses/LICENSE-2.0
         
     | 
| 
       10 
     | 
    
         
            -
            #
         
     | 
| 
       11 
     | 
    
         
            -
            # Unless required by applicable law or agreed to in writing,
         
     | 
| 
       12 
     | 
    
         
            -
            # software distributed under the License is distributed on an
         
     | 
| 
       13 
     | 
    
         
            -
            # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         
     | 
| 
       14 
     | 
    
         
            -
            # KIND, either express or implied.  See the License for the
         
     | 
| 
       15 
     | 
    
         
            -
            # specific language governing permissions and limitations
         
     | 
| 
       16 
     | 
    
         
            -
            # under the License.
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            module Selenium
         
     | 
| 
       19 
     | 
    
         
            -
              module WebDriver
         
     | 
| 
       20 
     | 
    
         
            -
                module Firefox
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  #
         
     | 
| 
       23 
     | 
    
         
            -
                  # @api private
         
     | 
| 
       24 
     | 
    
         
            -
                  #
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                  class SocketLock
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                    def initialize(port, timeout)
         
     | 
| 
       29 
     | 
    
         
            -
                      @port    = port
         
     | 
| 
       30 
     | 
    
         
            -
                      @timeout = timeout
         
     | 
| 
       31 
     | 
    
         
            -
                    end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                    def locked(&blk)
         
     | 
| 
       34 
     | 
    
         
            -
                      lock
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                      begin
         
     | 
| 
       37 
     | 
    
         
            -
                        yield
         
     | 
| 
       38 
     | 
    
         
            -
                      ensure
         
     | 
| 
       39 
     | 
    
         
            -
                        release
         
     | 
| 
       40 
     | 
    
         
            -
                      end
         
     | 
| 
       41 
     | 
    
         
            -
                    end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                    private
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                    def lock
         
     | 
| 
       46 
     | 
    
         
            -
                      max_time = Time.now + @timeout
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                      until can_lock? || Time.now >= max_time
         
     | 
| 
       49 
     | 
    
         
            -
                        sleep 0.1
         
     | 
| 
       50 
     | 
    
         
            -
                      end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                      unless did_lock?
         
     | 
| 
       53 
     | 
    
         
            -
                        raise Error::WebDriverError, "unable to bind to locking port #{@port} within #{@timeout} seconds"
         
     | 
| 
       54 
     | 
    
         
            -
                      end
         
     | 
| 
       55 
     | 
    
         
            -
                    end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                    def release
         
     | 
| 
       58 
     | 
    
         
            -
                      @server && @server.close
         
     | 
| 
       59 
     | 
    
         
            -
                    end
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                    def can_lock?
         
     | 
| 
       62 
     | 
    
         
            -
                      @server = TCPServer.new(Platform.localhost, @port)
         
     | 
| 
       63 
     | 
    
         
            -
                      ChildProcess.close_on_exec @server
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                      true
         
     | 
| 
       66 
     | 
    
         
            -
                    rescue SocketError, Errno::EADDRINUSE, Errno::EBADF => ex
         
     | 
| 
       67 
     | 
    
         
            -
                      $stderr.puts "#{self}: #{ex.message}" if $DEBUG
         
     | 
| 
       68 
     | 
    
         
            -
                      false
         
     | 
| 
       69 
     | 
    
         
            -
                    end
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
                    def did_lock?
         
     | 
| 
       72 
     | 
    
         
            -
                      !!@server
         
     | 
| 
       73 
     | 
    
         
            -
                    end
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                  end # SocketLock
         
     | 
| 
       76 
     | 
    
         
            -
                end # Firefox
         
     | 
| 
       77 
     | 
    
         
            -
              end # WebDriver
         
     | 
| 
       78 
     | 
    
         
            -
            end # Selenium
         
     | 
| 
         @@ -1,189 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # encoding: utf-8
         
     | 
| 
       2 
     | 
    
         
            -
            #
         
     | 
| 
       3 
     | 
    
         
            -
            # Licensed to the Software Freedom Conservancy (SFC) under one
         
     | 
| 
       4 
     | 
    
         
            -
            # or more contributor license agreements.  See the NOTICE file
         
     | 
| 
       5 
     | 
    
         
            -
            # distributed with this work for additional information
         
     | 
| 
       6 
     | 
    
         
            -
            # regarding copyright ownership.  The SFC licenses this file
         
     | 
| 
       7 
     | 
    
         
            -
            # to you under the Apache License, Version 2.0 (the
         
     | 
| 
       8 
     | 
    
         
            -
            # "License"); you may not use this file except in compliance
         
     | 
| 
       9 
     | 
    
         
            -
            # with the License.  You may obtain a copy of the License at
         
     | 
| 
       10 
     | 
    
         
            -
            #
         
     | 
| 
       11 
     | 
    
         
            -
            #   http://www.apache.org/licenses/LICENSE-2.0
         
     | 
| 
       12 
     | 
    
         
            -
            #
         
     | 
| 
       13 
     | 
    
         
            -
            # Unless required by applicable law or agreed to in writing,
         
     | 
| 
       14 
     | 
    
         
            -
            # software distributed under the License is distributed on an
         
     | 
| 
       15 
     | 
    
         
            -
            # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         
     | 
| 
       16 
     | 
    
         
            -
            # KIND, either express or implied.  See the License for the
         
     | 
| 
       17 
     | 
    
         
            -
            # specific language governing permissions and limitations
         
     | 
| 
       18 
     | 
    
         
            -
            # under the License.
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            module Selenium
         
     | 
| 
       21 
     | 
    
         
            -
              module WebDriver
         
     | 
| 
       22 
     | 
    
         
            -
                module Safari
         
     | 
| 
       23 
     | 
    
         
            -
                  #
         
     | 
| 
       24 
     | 
    
         
            -
                  # @api private
         
     | 
| 
       25 
     | 
    
         
            -
                  #
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                  class Extensions
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                    PLIST = <<-XML
         
     | 
| 
       30 
     | 
    
         
            -
                      <?xml version="1.0" encoding="UTF-8"?>
         
     | 
| 
       31 
     | 
    
         
            -
                      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
         
     | 
| 
       32 
     | 
    
         
            -
                      <plist version="1.0">
         
     | 
| 
       33 
     | 
    
         
            -
                      <dict>
         
     | 
| 
       34 
     | 
    
         
            -
                        <key>Available Updates</key>
         
     | 
| 
       35 
     | 
    
         
            -
                        <dict>
         
     | 
| 
       36 
     | 
    
         
            -
                          <key>Last Update Check Time</key>
         
     | 
| 
       37 
     | 
    
         
            -
                          <real>370125644.75941497</real>
         
     | 
| 
       38 
     | 
    
         
            -
                          <key>Updates List</key>
         
     | 
| 
       39 
     | 
    
         
            -
                          <array/>
         
     | 
| 
       40 
     | 
    
         
            -
                        </dict>
         
     | 
| 
       41 
     | 
    
         
            -
                        <key>Installed Extensions</key>
         
     | 
| 
       42 
     | 
    
         
            -
                        <array>
         
     | 
| 
       43 
     | 
    
         
            -
                          %s
         
     | 
| 
       44 
     | 
    
         
            -
                        </array>
         
     | 
| 
       45 
     | 
    
         
            -
                        <key>Version</key>
         
     | 
| 
       46 
     | 
    
         
            -
                        <integer>1</integer>
         
     | 
| 
       47 
     | 
    
         
            -
                      </dict>
         
     | 
| 
       48 
     | 
    
         
            -
                      </plist>
         
     | 
| 
       49 
     | 
    
         
            -
                    XML
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                    PLIST_EXTENSION_LINE = <<-XML
         
     | 
| 
       52 
     | 
    
         
            -
                      <dict>
         
     | 
| 
       53 
     | 
    
         
            -
                        <key>Added Non-Default Toolbar Items</key>
         
     | 
| 
       54 
     | 
    
         
            -
                        <array/>
         
     | 
| 
       55 
     | 
    
         
            -
                        <key>Archive File Name</key>
         
     | 
| 
       56 
     | 
    
         
            -
                        <string>%s.safariextz</string>
         
     | 
| 
       57 
     | 
    
         
            -
                        <key>Bundle Directory Name</key>
         
     | 
| 
       58 
     | 
    
         
            -
                        <string>%s.safariextension</string>
         
     | 
| 
       59 
     | 
    
         
            -
                        <key>Enabled</key>
         
     | 
| 
       60 
     | 
    
         
            -
                        <true/>
         
     | 
| 
       61 
     | 
    
         
            -
                        <key>Hidden Bars</key>
         
     | 
| 
       62 
     | 
    
         
            -
                        <array/>
         
     | 
| 
       63 
     | 
    
         
            -
                        <key>Removed Default Toolbar Items</key>
         
     | 
| 
       64 
     | 
    
         
            -
                        <array/>
         
     | 
| 
       65 
     | 
    
         
            -
                      </dict>
         
     | 
| 
       66 
     | 
    
         
            -
                    XML
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                    def initialize(opts = {})
         
     | 
| 
       69 
     | 
    
         
            -
                      @data_dir   = opts.data_dir || safari_data_dir
         
     | 
| 
       70 
     | 
    
         
            -
                      @skip       = opts.skip_extension_installation?
         
     | 
| 
       71 
     | 
    
         
            -
                      @extensions = opts.extensions
         
     | 
| 
       72 
     | 
    
         
            -
                      @backup     = Backup.new
         
     | 
| 
       73 
     | 
    
         
            -
                      @installed  = false
         
     | 
| 
       74 
     | 
    
         
            -
                    end
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                    def install
         
     | 
| 
       77 
     | 
    
         
            -
                      return if @installed
         
     | 
| 
       78 
     | 
    
         
            -
                      installed_extensions = []
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                      if install_directory.exist?
         
     | 
| 
       81 
     | 
    
         
            -
                        @backup.backup install_directory
         
     | 
| 
       82 
     | 
    
         
            -
                      end
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
                      install_directory.mkpath
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                      unless @skip
         
     | 
| 
       87 
     | 
    
         
            -
                        extension_destination.rmtree if extension_destination.exist?
         
     | 
| 
       88 
     | 
    
         
            -
                        FileUtils.cp extension_source.to_s, extension_destination.to_s
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                        installed_extensions << extension_destination
         
     | 
| 
       91 
     | 
    
         
            -
                      end
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
                      @extensions.each do |extension|
         
     | 
| 
       94 
     | 
    
         
            -
                        target = install_directory.join(extension.basename)
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                        if extension.expand_path == target.expand_path
         
     | 
| 
       97 
     | 
    
         
            -
                          @backup.backup(target)
         
     | 
| 
       98 
     | 
    
         
            -
                        else
         
     | 
| 
       99 
     | 
    
         
            -
                          FileUtils.cp extension, target
         
     | 
| 
       100 
     | 
    
         
            -
                        end
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
                        installed_extensions << target
         
     | 
| 
       103 
     | 
    
         
            -
                      end
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                      plist_destination.open('w') do |io|
         
     | 
| 
       106 
     | 
    
         
            -
                        extension_lines = installed_extensions.map do |ext|
         
     | 
| 
       107 
     | 
    
         
            -
                          name = ext.basename('.safariextz').to_s
         
     | 
| 
       108 
     | 
    
         
            -
                          PLIST_EXTENSION_LINE % [name, name]
         
     | 
| 
       109 
     | 
    
         
            -
                        end
         
     | 
| 
       110 
     | 
    
         
            -
                        io << PLIST % extension_lines.join("\n")
         
     | 
| 
       111 
     | 
    
         
            -
                      end
         
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
                      Platform.exit_hook { uninstall }
         
     | 
| 
       114 
     | 
    
         
            -
                      @installed = true
         
     | 
| 
       115 
     | 
    
         
            -
                    end
         
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
                    def uninstall
         
     | 
| 
       118 
     | 
    
         
            -
                      return unless @installed
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                      install_directory.rmtree if install_directory.exist?
         
     | 
| 
       121 
     | 
    
         
            -
                      @backup.restore_all
         
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
                      nil
         
     | 
| 
       124 
     | 
    
         
            -
                    ensure
         
     | 
| 
       125 
     | 
    
         
            -
                      @installed = false
         
     | 
| 
       126 
     | 
    
         
            -
                    end
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
                    def extension_source
         
     | 
| 
       129 
     | 
    
         
            -
                      Safari.resource_path.join('SafariDriver.safariextz')
         
     | 
| 
       130 
     | 
    
         
            -
                    end
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                    def extension_destination
         
     | 
| 
       133 
     | 
    
         
            -
                      install_directory.join('WebDriver.safariextz')
         
     | 
| 
       134 
     | 
    
         
            -
                    end
         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
                    def plist_destination
         
     | 
| 
       137 
     | 
    
         
            -
                      install_directory.join('Extensions.plist')
         
     | 
| 
       138 
     | 
    
         
            -
                    end
         
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
                    def install_directory
         
     | 
| 
       141 
     | 
    
         
            -
                      @install_directory ||= (
         
     | 
| 
       142 
     | 
    
         
            -
                        data_dir = Pathname.new(@data_dir || safari_data_dir)
         
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
                        unless data_dir.exist? && data_dir.directory?
         
     | 
| 
       145 
     | 
    
         
            -
                          raise Errno::ENOENT, "Safari data directory not found at #{data_dir.to_s}"
         
     | 
| 
       146 
     | 
    
         
            -
                        end
         
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
       148 
     | 
    
         
            -
                        data_dir.join('Extensions')
         
     | 
| 
       149 
     | 
    
         
            -
                      )
         
     | 
| 
       150 
     | 
    
         
            -
                    end
         
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
                    def safari_data_dir
         
     | 
| 
       153 
     | 
    
         
            -
                      current = Platform.os
         
     | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
                      case current
         
     | 
| 
       156 
     | 
    
         
            -
                      when :macosx
         
     | 
| 
       157 
     | 
    
         
            -
                        Pathname.new(Platform.home).join('Library/Safari')
         
     | 
| 
       158 
     | 
    
         
            -
                      when :windows
         
     | 
| 
       159 
     | 
    
         
            -
                        Pathname.new(ENV['APPDATA']).join('Apple Computer/Safari')
         
     | 
| 
       160 
     | 
    
         
            -
                      else
         
     | 
| 
       161 
     | 
    
         
            -
                        raise Error::WebDriverError, "unsupported platform: #{current}"
         
     | 
| 
       162 
     | 
    
         
            -
                      end
         
     | 
| 
       163 
     | 
    
         
            -
                    end
         
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
                    class Backup
         
     | 
| 
       166 
     | 
    
         
            -
                      def initialize
         
     | 
| 
       167 
     | 
    
         
            -
                        @dir     = Pathname.new(Dir.mktmpdir('webdriver-safari-backups'))
         
     | 
| 
       168 
     | 
    
         
            -
                        @backups = {}
         
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
                        FileReaper << @dir.to_s
         
     | 
| 
       171 
     | 
    
         
            -
                      end
         
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
                      def backup(file)
         
     | 
| 
       174 
     | 
    
         
            -
                        src = file
         
     | 
| 
       175 
     | 
    
         
            -
                        dst = @dir.join(file.basename).to_s
         
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
                        FileUtils.cp_r src.to_s, dst.to_s
         
     | 
| 
       178 
     | 
    
         
            -
                        @backups[src] = dst
         
     | 
| 
       179 
     | 
    
         
            -
                      end
         
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
                      def restore_all
         
     | 
| 
       182 
     | 
    
         
            -
                        @backups.each {|src, dst| FileUtils.cp_r dst.to_s, src.to_s }
         
     | 
| 
       183 
     | 
    
         
            -
                      end
         
     | 
| 
       184 
     | 
    
         
            -
                    end
         
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
                  end # Extensions
         
     | 
| 
       187 
     | 
    
         
            -
                end # Safari
         
     | 
| 
       188 
     | 
    
         
            -
              end # WebDriver
         
     | 
| 
       189 
     | 
    
         
            -
            end # Selenium
         
     |