34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/watir-classic/cookies.rb', line 34
def delete name
options = {:expires => ::Time.now - 60 * 60 * 24}
delete_with_options name, options
uri = URI.parse(@page_container.url)
domain = uri.host
paths = uri.path.split("/").reduce([]) do |paths, path|
paths << "#{paths.last}/#{path}".squeeze("/")
end << "/"
subdomains = domain.split(".").reverse.reduce([]) do |subdomains, part|
subdomain = "#{part}#{subdomains.last}"
subdomain = "." + subdomain unless subdomain == domain
subdomains << subdomain
end
subdomains.each do |subdomain|
domain_options = options.merge :domain => subdomain
delete_with_options name, domain_options
delete_with_options name, domain_options.merge(:secure => true)
paths.each do |path|
path_options = options.merge :path => path
delete_with_options name, path_options
delete_with_options name, path_options.merge(:secure => true)
path_domain_options = domain_options.merge :path => path
delete_with_options name, path_domain_options
delete_with_options name, path_domain_options.merge(:secure => true)
end
end
end
|