fletcherm-culerity 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/CHANGES.md +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +102 -0
- data/Rakefile +47 -0
- data/VERSION.yml +5 -0
- data/culerity.gemspec +165 -0
- data/features/fixtures/jquery +4376 -0
- data/features/fixtures/sample_feature +14 -0
- data/features/installing_culerity.feature +36 -0
- data/features/running_cucumber_without_explicitly_running_external_services.feature +23 -0
- data/features/step_definitions/common_steps.rb +175 -0
- data/features/step_definitions/culerity_setup_steps.rb +7 -0
- data/features/step_definitions/jruby_steps.rb +11 -0
- data/features/step_definitions/rails_setup_steps.rb +36 -0
- data/features/support/common.rb +32 -0
- data/features/support/env.rb +24 -0
- data/features/support/matchers.rb +11 -0
- data/init.rb +1 -0
- data/lib/culerity.rb +44 -0
- data/lib/culerity/celerity_server.rb +81 -0
- data/lib/culerity/jruby_runner.rb +13 -0
- data/lib/culerity/remote_browser_proxy.rb +58 -0
- data/lib/culerity/remote_object_proxy.rb +76 -0
- data/rails/init.rb +1 -0
- data/rails_generators/culerity/culerity_generator.rb +28 -0
- data/rails_generators/culerity/templates/config/environments/culerity_continuousintegration.rb +28 -0
- data/rails_generators/culerity/templates/config/environments/culerity_development.rb +17 -0
- data/rails_generators/culerity/templates/features/step_definitions/culerity_steps.rb +109 -0
- data/rails_generators/culerity/templates/features/support/env.rb +9 -0
- data/rails_generators/culerity/templates/lib/tasks/culerity.rake +38 -0
- data/rails_generators/culerity/templates/public/javascripts/culerity.js +27 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/celerity_server_spec.rb +106 -0
- data/spec/culerity_spec.rb +33 -0
- data/spec/jruby_runner_spec.rb +12 -0
- data/spec/remote_browser_proxy_spec.rb +62 -0
- data/spec/remote_object_proxy_spec.rb +63 -0
- data/spec/spec_helper.rb +3 -0
- data/vendor/gems/celerity-0.7.6/HISTORY +111 -0
- data/vendor/gems/celerity-0.7.6/LICENSE +621 -0
- data/vendor/gems/celerity-0.7.6/README.rdoc +80 -0
- data/vendor/gems/celerity-0.7.6/Rakefile +11 -0
- data/vendor/gems/celerity-0.7.6/VERSION.yml +5 -0
- data/vendor/gems/celerity-0.7.6/celerity.gemspec +120 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity.rb +77 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/browser.rb +893 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/clickable_element.rb +73 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/collections.rb +156 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/container.rb +767 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/default_viewer.rb +14 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/disabled_element.rb +40 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/element.rb +298 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/element_collection.rb +107 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/element_locator.rb +159 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/button.rb +54 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/file_field.rb +29 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/form.rb +33 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/frame.rb +86 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/image.rb +89 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/label.rb +16 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/link.rb +43 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/meta.rb +14 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/non_control_elements.rb +116 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/option.rb +38 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/radio_check.rb +114 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/select_list.rb +147 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/table.rb +153 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/table_cell.rb +36 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/table_elements.rb +42 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/table_row.rb +49 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/elements/text_field.rb +168 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/exception.rb +83 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit.rb +64 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/commons-codec-1.4.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/commons-collections-3.2.1.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/commons-httpclient-3.1.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/commons-io-1.4.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/commons-lang-2.4.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/commons-logging-1.1.1.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/cssparser-0.9.5.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/htmlunit-2.7-SNAPSHOT.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/htmlunit-core-js-2.7-SNAPSHOT.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/nekohtml-1.9.14-20091130.152932-3.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/sac-1.3.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/serializer-2.7.1.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/xalan-2.7.1.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/xercesImpl-2.9.1.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/htmlunit/xml-apis-1.3.04.jar +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/identifier.rb +28 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/ignoring_web_connection.rb +15 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/input_element.rb +25 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/javascript_debugger.rb +32 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/listener.rb +143 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/resources/no_viewer.png +0 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/short_inspect.rb +20 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/util.rb +126 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/version.rb +3 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/viewer_connection.rb +89 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/watir_compatibility.rb +70 -0
- data/vendor/gems/celerity-0.7.6/lib/celerity/xpath_support.rb +48 -0
- data/vendor/gems/celerity-0.7.6/tasks/benchmark.rake +4 -0
- data/vendor/gems/celerity-0.7.6/tasks/check.rake +24 -0
- data/vendor/gems/celerity-0.7.6/tasks/clean.rake +3 -0
- data/vendor/gems/celerity-0.7.6/tasks/fix.rake +25 -0
- data/vendor/gems/celerity-0.7.6/tasks/jar.rake +55 -0
- data/vendor/gems/celerity-0.7.6/tasks/jeweler.rake +26 -0
- data/vendor/gems/celerity-0.7.6/tasks/rdoc.rake +4 -0
- data/vendor/gems/celerity-0.7.6/tasks/snapshot.rake +22 -0
- data/vendor/gems/celerity-0.7.6/tasks/spec.rake +26 -0
- data/vendor/gems/celerity-0.7.6/tasks/website.rake +10 -0
- data/vendor/gems/celerity-0.7.6/tasks/yard.rake +16 -0
- data/vendor/jruby/jruby-complete-1.4.0.jar +0 -0
- metadata +194 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
module Celerity
|
2
|
+
module Exception
|
3
|
+
|
4
|
+
#
|
5
|
+
# Superclass for all Celerity exceptions.
|
6
|
+
#
|
7
|
+
|
8
|
+
class CelerityException < StandardError; end
|
9
|
+
|
10
|
+
#
|
11
|
+
# This exception is thrown if an attempt is made to access an object that doesn't exist
|
12
|
+
#
|
13
|
+
|
14
|
+
class UnknownObjectException < CelerityException; end
|
15
|
+
|
16
|
+
#
|
17
|
+
# This exception is thrown if an attempt is made to access an object that is in a disabled state
|
18
|
+
#
|
19
|
+
|
20
|
+
class ObjectDisabledException < CelerityException; end
|
21
|
+
|
22
|
+
#
|
23
|
+
# This exception is thrown if an attempt is made to access a frame that cannot be found
|
24
|
+
#
|
25
|
+
|
26
|
+
class UnknownFrameException < CelerityException; end
|
27
|
+
|
28
|
+
#
|
29
|
+
# This exception is thrown if an attempt is made to access a form that cannot be found
|
30
|
+
#
|
31
|
+
|
32
|
+
class UnknownFormException < CelerityException; end
|
33
|
+
|
34
|
+
#
|
35
|
+
# This exception is thrown if an attempt is made to access an object that is in a read-only state
|
36
|
+
#
|
37
|
+
|
38
|
+
class ObjectReadOnlyException < CelerityException; end
|
39
|
+
|
40
|
+
#
|
41
|
+
# This exception is thrown if an attempt is made to access an object when the specified value cannot be found
|
42
|
+
#
|
43
|
+
|
44
|
+
class NoValueFoundException < CelerityException; end
|
45
|
+
|
46
|
+
#
|
47
|
+
# This exception gets raised if the how argument is wrong.
|
48
|
+
#
|
49
|
+
|
50
|
+
class MissingWayOfFindingObjectException < CelerityException; end
|
51
|
+
|
52
|
+
#
|
53
|
+
# This exception is raised if an attempt is made to access a table row that doesn't exist
|
54
|
+
#
|
55
|
+
|
56
|
+
class UnknownRowException < CelerityException; end
|
57
|
+
|
58
|
+
#
|
59
|
+
# This exception is raised if an attempt is made to access a table cell that doesn't exist
|
60
|
+
#
|
61
|
+
|
62
|
+
class UnknownCellException < CelerityException; end
|
63
|
+
|
64
|
+
#
|
65
|
+
# This exception is thrown if an http error, such as a 404, 500 etc is encountered while navigating
|
66
|
+
#
|
67
|
+
|
68
|
+
class NavigationException < CelerityException; end
|
69
|
+
|
70
|
+
#
|
71
|
+
# This exception is thrown if an unexpected content type is returned by the server.
|
72
|
+
#
|
73
|
+
|
74
|
+
class UnexpectedPageException < CelerityException; end
|
75
|
+
|
76
|
+
#
|
77
|
+
# This exception is thrown if an unexpected content type is returned by the server.
|
78
|
+
#
|
79
|
+
|
80
|
+
class CookieNotFoundError < CelerityException; end
|
81
|
+
|
82
|
+
end # Exception
|
83
|
+
end # Celerity
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Celerity
|
2
|
+
Jars = Dir[File.dirname(__FILE__) + '/htmlunit/*.jar']
|
3
|
+
Jars.each { |jar| require(jar) }
|
4
|
+
|
5
|
+
module JsxHelper
|
6
|
+
def method_missing(meth, *args, &blk)
|
7
|
+
m = ["jsxGet_#{meth}", "jsx_get_#{meth}"].find { |m| respond_to?(m) }
|
8
|
+
m ? __send__(m) : super
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module HtmlUnit
|
14
|
+
include_package 'com.gargoylesoftware.htmlunit'
|
15
|
+
|
16
|
+
module Html
|
17
|
+
include_package 'com.gargoylesoftware.htmlunit.html'
|
18
|
+
end
|
19
|
+
|
20
|
+
module Util
|
21
|
+
include_package 'com.gargoylesoftware.htmlunit.util'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
module Java::OrgW3cDom::NamedNodeMap
|
27
|
+
include Enumerable
|
28
|
+
|
29
|
+
def each
|
30
|
+
0.upto(getLength - 1) do |idx|
|
31
|
+
yield item(idx)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module Java::JavaLang::Iterable
|
37
|
+
include Enumerable
|
38
|
+
|
39
|
+
def each
|
40
|
+
it = iterator
|
41
|
+
yield it.next while it.hasNext
|
42
|
+
end
|
43
|
+
|
44
|
+
end unless Java::JavaLang::Iterable < Enumerable # depends on JRuby version
|
45
|
+
|
46
|
+
class Java::ComGargoylesoftwareHtmlunitHtml::HtmlPage
|
47
|
+
def inspect
|
48
|
+
'#<HtmlPage:0x%s(%s)>' % [self.hash.to_s(16), getWebResponse.getRequestUrl.toString]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class Java::ComGargoylesoftwareHtmlunitHtml::HtmlElement
|
53
|
+
def inspect
|
54
|
+
'#<%s:0x%s>' % [self.class.name.split("::").last, self.hash.to_s(16)]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class Java::ComGargoylesoftwareHtmlunitJavascriptHostHtml::HTMLElement
|
59
|
+
include Celerity::JsxHelper
|
60
|
+
end
|
61
|
+
|
62
|
+
class Java::ComGargoylesoftwareHtmlunitJavascriptHostCss::CSSStyleDeclaration
|
63
|
+
include Celerity::JsxHelper
|
64
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Celerity
|
2
|
+
|
3
|
+
class Identifier
|
4
|
+
attr_accessor :text
|
5
|
+
attr_reader :tag, :attributes
|
6
|
+
|
7
|
+
def initialize(tag, attributes = {})
|
8
|
+
@tag = tag
|
9
|
+
@attributes = attributes
|
10
|
+
@text = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def match?(element)
|
14
|
+
return false unless @tag == element.getTagName
|
15
|
+
|
16
|
+
attr_result = @attributes.all? do |key, values|
|
17
|
+
values.any? { |val| Util.matches?(element.getAttribute(key.to_s), val) }
|
18
|
+
end
|
19
|
+
|
20
|
+
if @text
|
21
|
+
attr_result && Util.matches?(element.asText.strip, @text)
|
22
|
+
else
|
23
|
+
attr_result
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Celerity
|
2
|
+
class IgnoringWebConnection < HtmlUnit::Util::FalsifyingWebConnection
|
3
|
+
|
4
|
+
def initialize(web_client, pattern)
|
5
|
+
super(web_client)
|
6
|
+
@pattern = pattern
|
7
|
+
end
|
8
|
+
|
9
|
+
def getResponse(request_settings)
|
10
|
+
return super unless request_settings.getUrl.toString =~ @pattern
|
11
|
+
createWebResponse(request_settings, "", "text/html")
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Celerity
|
2
|
+
class InputElement < Element
|
3
|
+
include ClickableElement
|
4
|
+
include DisabledElement
|
5
|
+
|
6
|
+
ATTRIBUTES = BASE_ATTRIBUTES | [:type, :name, :value, :checked, :disabled, :readonly, :size, :maxlength,
|
7
|
+
:src, :alt, :usemap, :ismap, :tabindex, :accesskey, :onfocus, :onblur,
|
8
|
+
:onselect, :onchange, :accept, :align]
|
9
|
+
|
10
|
+
def readonly?
|
11
|
+
assert_exists
|
12
|
+
@object.hasAttribute 'readonly'
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def assert_not_readonly
|
18
|
+
if readonly?
|
19
|
+
raise ObjectReadOnlyException,
|
20
|
+
"InputElement #{identifier_string} is read only."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Celerity
|
2
|
+
class JavascriptDebugger
|
3
|
+
include Java::net.sourceforge.htmlunit.corejs.javascript.debug.Debugger
|
4
|
+
|
5
|
+
def handleCompilationDone(ctx, script, source)
|
6
|
+
p debug_info_for(script).merge(:source_code => source)
|
7
|
+
end
|
8
|
+
|
9
|
+
def getFrame(ctx, script)
|
10
|
+
p debug_info_for(script)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def string_for_context(ctx)
|
16
|
+
ctx.toString
|
17
|
+
end
|
18
|
+
|
19
|
+
def string_for_script(script)
|
20
|
+
script.toString
|
21
|
+
end
|
22
|
+
|
23
|
+
def debug_info_for(script)
|
24
|
+
{
|
25
|
+
:source => "#{script.getSourceName}:#{script.getLineNumbers.to_a.join(",")}",
|
26
|
+
:function_name => script.getFunctionName,
|
27
|
+
:params => (0...script.getParamAndVarCount).map { |idx| script.getParamOrVarName(idx) },
|
28
|
+
:function? => script.isFunction,
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
module Celerity
|
2
|
+
|
3
|
+
#
|
4
|
+
# This class is used to wrap some of the listeners available from HtmlUnit's WebClient.
|
5
|
+
#
|
6
|
+
|
7
|
+
class Listener
|
8
|
+
include com.gargoylesoftware.htmlunit.AlertHandler
|
9
|
+
include com.gargoylesoftware.htmlunit.ConfirmHandler
|
10
|
+
include com.gargoylesoftware.htmlunit.PromptHandler
|
11
|
+
include com.gargoylesoftware.htmlunit.html.HTMLParserListener
|
12
|
+
include com.gargoylesoftware.htmlunit.IncorrectnessListener
|
13
|
+
include com.gargoylesoftware.htmlunit.StatusHandler
|
14
|
+
include com.gargoylesoftware.htmlunit.WebWindowListener
|
15
|
+
include com.gargoylesoftware.htmlunit.attachment.AttachmentHandler
|
16
|
+
|
17
|
+
def initialize(webclient)
|
18
|
+
@webclient = webclient
|
19
|
+
@procs = Hash.new { |h, k| h[k] = [] }
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# Add a listener block for one of the available types.
|
24
|
+
# @see Celerity::Browser#add_listener
|
25
|
+
#
|
26
|
+
|
27
|
+
def add_listener(type, &block)
|
28
|
+
case type
|
29
|
+
when :status
|
30
|
+
@webclient.setStatusHandler(self)
|
31
|
+
when :alert
|
32
|
+
@webclient.setAlertHandler(self)
|
33
|
+
when :attachment
|
34
|
+
@webclient.setAttachmentHandler(self)
|
35
|
+
when :web_window_event
|
36
|
+
@webclient.addWebWindowListener(self)
|
37
|
+
when :html_parser
|
38
|
+
@webclient.setHTMLParserListener(self)
|
39
|
+
when :incorrectness
|
40
|
+
@webclient.setIncorrectnessListener(self)
|
41
|
+
when :confirm
|
42
|
+
@webclient.setConfirmHandler(self)
|
43
|
+
when :prompt
|
44
|
+
@webclient.setPromptHandler(self)
|
45
|
+
else
|
46
|
+
raise ArgumentError, "unknown listener type #{type.inspect}"
|
47
|
+
end
|
48
|
+
|
49
|
+
@procs[type] << block
|
50
|
+
end
|
51
|
+
|
52
|
+
def remove_listener(type, proc_or_index)
|
53
|
+
unless @procs.has_key?(type)
|
54
|
+
raise ArgumentError, "unknown listener type #{type.inspect}"
|
55
|
+
end
|
56
|
+
|
57
|
+
procs = @procs[type]
|
58
|
+
|
59
|
+
case proc_or_index
|
60
|
+
when Fixnum
|
61
|
+
procs.delete_at proc_or_index
|
62
|
+
when Proc
|
63
|
+
procs.delete proc_or_index
|
64
|
+
else
|
65
|
+
raise TypeError, "must give proc or index"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
#
|
70
|
+
# interface StatusHandler
|
71
|
+
#
|
72
|
+
|
73
|
+
def statusMessageChanged(page, message)
|
74
|
+
@procs[:status].each { |handler| handler.call(page, message) }
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
# interface AlertHandler
|
79
|
+
#
|
80
|
+
|
81
|
+
def handleAlert(page, message)
|
82
|
+
@procs[:alert].each { |handler| handler.call(page, message) }
|
83
|
+
end
|
84
|
+
|
85
|
+
#
|
86
|
+
# interface ConfirmHandler
|
87
|
+
#
|
88
|
+
# The returned value is determined by the last registered :confirm listener proc.
|
89
|
+
# If it is nil, return true, otherwise return that value as a boolean.
|
90
|
+
#
|
91
|
+
# @see Browser#confirm
|
92
|
+
#
|
93
|
+
|
94
|
+
def handleConfirm(page, message)
|
95
|
+
val = @procs[:confirm].map { |handler| handler.call(page, message) }.last
|
96
|
+
val.nil? || !!val
|
97
|
+
end
|
98
|
+
|
99
|
+
#
|
100
|
+
# interface AttachmentHandler
|
101
|
+
#
|
102
|
+
|
103
|
+
def handleAttachment(page)
|
104
|
+
@procs[:attachment].each { |handler| handler.call(page) }
|
105
|
+
end
|
106
|
+
|
107
|
+
#
|
108
|
+
# interface PromptHandler
|
109
|
+
#
|
110
|
+
|
111
|
+
def handlePrompt(page, message)
|
112
|
+
@procs[:prompt].each { |handler| handler.call(page, message) }
|
113
|
+
end
|
114
|
+
|
115
|
+
#
|
116
|
+
# interface WebWindowListener
|
117
|
+
#
|
118
|
+
|
119
|
+
def webWindowClosed(web_window_event)
|
120
|
+
@procs[:web_window_event].each { |handler| handler.call(web_window_event) }
|
121
|
+
end
|
122
|
+
alias_method :webWindowOpened, :webWindowClosed
|
123
|
+
alias_method :webWindowContentChanged, :webWindowClosed
|
124
|
+
|
125
|
+
#
|
126
|
+
# interface HTMLParserListener
|
127
|
+
#
|
128
|
+
|
129
|
+
def error(message, url, line, column, key)
|
130
|
+
@procs[:html_parser].each { |handler| handler.call(message, url, line, column, key) }
|
131
|
+
end
|
132
|
+
alias_method :warning, :error
|
133
|
+
|
134
|
+
#
|
135
|
+
# interface IncorrectnessListener
|
136
|
+
#
|
137
|
+
|
138
|
+
def notify(message, origin)
|
139
|
+
@procs[:incorrectness].each { |handler| handler.call(message, origin) }
|
140
|
+
end
|
141
|
+
|
142
|
+
end # Listener
|
143
|
+
end # Celerity
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Celerity
|
2
|
+
module ShortInspect
|
3
|
+
|
4
|
+
def short_inspect(opts)
|
5
|
+
if excluded_ivars = opts[:exclude]
|
6
|
+
ivars = (instance_variables - excluded_ivars)
|
7
|
+
elsif included_ivars = opts[:include]
|
8
|
+
ivars = included_ivars
|
9
|
+
else
|
10
|
+
raise ArgumentError, "unknown arg: #{opts.inspect}"
|
11
|
+
end
|
12
|
+
|
13
|
+
ivars.map! { |ivar| "#{ivar}=#{instance_variable_get(ivar).inspect}" }
|
14
|
+
'#<%s:0x%s %s>' % [self.class.name, self.hash.to_s(16), ivars.join(" ")]
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|