webkit2-gtk 3.1.3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cca91e59a12307acb699b2ee456735fc67ba274b
4
- data.tar.gz: 02e5e9a2ce39072c7ffe67251f26758013e8bd3c
3
+ metadata.gz: 266cd1a1720986f15405e36674522de99f90b63d
4
+ data.tar.gz: b33cb2c0dd4eef325d0438d46a9ff387a94b92dc
5
5
  SHA512:
6
- metadata.gz: 27ecea74762ceb34b553d98d4fff7f4d1f547a2bd251ffea00bedcc4d0b5d050c05c56eaea97ab20e5f74c1370c47e4e5ec81f2848463cda217aa0cf4984b809
7
- data.tar.gz: 93004136c2bdc18b002885753cb50a0db63a4135bb47c30a4192de932fb7861244438c0ce7b6a2079727cc7d667093320c3387f2e97a0a82ad0ecd09d5dd9557
6
+ metadata.gz: d1f3cf8e88e9b507148cf8cf27270af5198d92ef522294cc8eb1d36300aea15573236e215b0db3ce6da73e6a6d78b9a072bd67082ce21408970abf510b52f87a
7
+ data.tar.gz: 1a75deffe8a9190553d9ff971f0ea9981f255237acf5cbffe8c595b957b30651a08b3caf9aec19c73cb5e013fd3a5df5f0c6615ffe4a5f63fe3d76b78e19464d
@@ -17,8 +17,7 @@
17
17
  require "pkg-config"
18
18
  require "native-package-installer"
19
19
 
20
- case RUBY_PLATFORM
21
- when /mingw|mswin/
20
+ if File.exist?(File.join(__dir__, "..", "vendor"))
22
21
  task :default => "nothing"
23
22
  else
24
23
  task :default => "dependency:check"
@@ -0,0 +1,54 @@
1
+ # Copyright (C) 2015-2017 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module WebKit2Gtk
18
+ class Loader < GObjectIntrospection::Loader
19
+ NAMESPACE = "WebKit2"
20
+
21
+ def load
22
+ super(NAMESPACE)
23
+ end
24
+
25
+ private
26
+ def pre_load(repository, namespace)
27
+ define_version_module
28
+ end
29
+
30
+ def post_load(repository, namespace)
31
+ require_libraries
32
+ end
33
+
34
+ def define_version_module
35
+ @version_module = Module.new
36
+ @base_module.const_set("Version", @version_module)
37
+ end
38
+
39
+ def require_libraries
40
+ require "webkit2-gtk/version" if @version_module.const_defined?(:MAJOR)
41
+
42
+ require "webkit2-gtk/web-view"
43
+ end
44
+
45
+ def load_constant_info(info)
46
+ case info.name
47
+ when /_VERSION\z/
48
+ @version_module.const_set($PREMATCH, info.value)
49
+ else
50
+ super
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,71 @@
1
+ # Copyright (C) 2017 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module WebKit2Gtk
18
+ class WebView
19
+ class << self
20
+ def new(*args)
21
+ return super unless args.size == 1
22
+ return super unless args[0].is_a?(Hash)
23
+
24
+ related_view = args[0][:related_view]
25
+ return super unless related_view
26
+ # TODO: Workaround for webkit_web_view_new_with_related_view is
27
+ # handled as method not constructor.
28
+ related_view.new_with_related_view
29
+ end
30
+ end
31
+
32
+ alias_method :initialize_raw, :initialize
33
+ def initialize(*args)
34
+ case args.size
35
+ when 1
36
+ case args[0]
37
+ when Hash
38
+ initialize_with_hash(args[0])
39
+ when WebContext
40
+ message = "#{caller[0]}: #{self.class}.new(context) is deprecated. "
41
+ message << "Use #{self.class}.new(:context => context) instead."
42
+ warn(message)
43
+ initialize_raw(args[0])
44
+ else
45
+ raise ArgumentError, "must be options: #{args[0].inspect}"
46
+ end
47
+ else
48
+ initialize_raw(*args)
49
+ end
50
+ end
51
+
52
+ def initialize_with_hash(options)
53
+ context = options[:context]
54
+ settings = options[:settings]
55
+ user_content_manager = options[:user_content_manager]
56
+
57
+ if context
58
+ initialize_new_with_context(context)
59
+ elsif settings
60
+ initialize_new_with_settings(settings)
61
+ elsif user_content_manager
62
+ initialize_new_with_user_content_manager(user_content_manager)
63
+ else
64
+ message =
65
+ "must specify :context, :settings, :user_content_manager or :related_view"
66
+ raise ArgumentError, message
67
+ end
68
+ end
69
+ private :initialize_with_hash
70
+ end
71
+ end
data/lib/webkit2-gtk.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2015-2017 Ruby-GNOME2 Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -22,6 +22,8 @@ vendor_dir = base_dir + "vendor" + "local"
22
22
  vendor_bin_dir = vendor_dir + "bin"
23
23
  GLib.prepend_dll_path(vendor_bin_dir)
24
24
 
25
+ require "webkit2-gtk/loader"
26
+
25
27
  module WebKit2Gtk
26
28
  class << self
27
29
  def const_missing(name)
@@ -43,39 +45,4 @@ module WebKit2Gtk
43
45
  loader.load
44
46
  end
45
47
  end
46
-
47
- class Loader < GObjectIntrospection::Loader
48
- NAMESPACE = "WebKit2"
49
-
50
- def load
51
- super(NAMESPACE)
52
- end
53
-
54
- private
55
- def pre_load(repository, namespace)
56
- define_version_module
57
- end
58
-
59
- def post_load(repository, namespace)
60
- require_libraries
61
- end
62
-
63
- def define_version_module
64
- @version_module = Module.new
65
- @base_module.const_set("Version", @version_module)
66
- end
67
-
68
- def require_libraries
69
- require "webkit2-gtk/version" if @version_module.const_defined?(:MAJOR)
70
- end
71
-
72
- def load_constant_info(info)
73
- case info.name
74
- when /_VERSION\z/
75
- @version_module.const_set($PREMATCH, info.value)
76
- else
77
- super
78
- end
79
- end
80
- end
81
48
  end
data/test/run-test.rb CHANGED
@@ -43,7 +43,7 @@ modules = [
43
43
  [webkit2_gtk_base, "webkit2-gtk"],
44
44
  ]
45
45
  modules.each do |target, module_name|
46
- if File.exist?("Makefile") and system("which make > /dev/null")
46
+ if File.exist?("#{target}/Makefile") and system("which make > /dev/null")
47
47
  `make -C #{target.dump} > /dev/null` or exit(false)
48
48
  end
49
49
  $LOAD_PATH.unshift(File.join(target, "ext", module_name))
@@ -15,47 +15,97 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  class TestWebKit2GtkWebView < Test::Unit::TestCase
18
- def setup
19
- @view = WebKit2Gtk::WebView.new
20
- @http_server = WEBrick::HTTPServer.new(:Port => 0)
21
- @http_server.mount_proc("/") do |request, response|
22
- response.body = "Hello"
23
- end
24
- @http_server_thread = Thread.new do
25
- @http_server.start
18
+ include WebKit2GtkTestUtils
19
+
20
+ sub_test_case(".new") do
21
+ sub_test_case("Hash form") do
22
+ test "with context" do
23
+ only_webkit2_gtk_version(2, 8)
24
+ context = WebKit2Gtk::WebContext.new
25
+ webview = WebKit2Gtk::WebView.new(context: context)
26
+ assert_equal(context, webview.context)
27
+ assert_nil(webview.user_content_manager)
28
+ end
29
+
30
+ test "with settings" do
31
+ settings = WebKit2Gtk::Settings.new
32
+ webview = WebKit2Gtk::WebView.new(settings: settings)
33
+ assert_equal(settings, webview.settings)
34
+ assert_nil(webview.user_content_manager)
35
+ end
36
+
37
+ test "with user content manager" do
38
+ manager = WebKit2Gtk::UserContentManager.new
39
+ webview = WebKit2Gtk::WebView.new(user_content_manager: manager)
40
+ assert_equal(manager, webview.user_content_manager)
41
+ end
42
+
43
+ test "with related view" do
44
+ settings = WebKit2Gtk::Settings.new
45
+ related = WebKit2Gtk::WebView.new(settings: settings)
46
+ webview = related.new_with_related_view
47
+ assert_equal(settings, webview.settings)
48
+ end
49
+
50
+ test "with unknown option" do
51
+ assert_raises do
52
+ WebKit2Gtk::WebView.new(foo: 'bar')
53
+ end
54
+ end
26
55
  end
27
- end
28
56
 
29
- def teardown
30
- @http_server.shutdown
31
- @http_server_thread.join
57
+ sub_test_case("legacy form") do
58
+ test "with unknown argument" do
59
+ assert_raises ArgumentError do
60
+ WebKit2Gtk::WebView.new('foo')
61
+ end
62
+ end
63
+ end
32
64
  end
33
65
 
34
- def http_url
35
- port = @http_server[:Port]
36
- "http://127.0.0.1:#{port}/"
37
- end
66
+ sub_test_case("#load_uri") do
67
+ def setup
68
+ @view = WebKit2Gtk::WebView.new
69
+ @http_server = WEBrick::HTTPServer.new(:Port => 0)
70
+ @http_server.mount_proc("/") do |request, response|
71
+ response.body = "Hello"
72
+ end
73
+ @http_server_thread = Thread.new do
74
+ @http_server.start
75
+ end
76
+ end
38
77
 
39
- test "#load_uri" do
40
- loaded = false
78
+ def teardown
79
+ @http_server.shutdown
80
+ @http_server_thread.join
81
+ end
41
82
 
42
- loop = GLib::MainLoop.new
43
- timeout_id = GLib::Timeout.add(5000) do
44
- timeout_id = nil
45
- loop.quit
46
- GLib::Source::REMOVE
83
+ def http_url
84
+ port = @http_server[:Port]
85
+ "http://127.0.0.1:#{port}/"
47
86
  end
48
- @view.signal_connect("load-changed") do |view, event|
49
- case event
50
- when WebKit2Gtk::LoadEvent::FINISHED
51
- GLib::Source.remove(timeout_id) if timeout_id
52
- loaded = true
87
+
88
+ test "#load_uri" do
89
+ loaded = false
90
+
91
+ loop = GLib::MainLoop.new
92
+ timeout_id = GLib::Timeout.add(5000) do
93
+ timeout_id = nil
53
94
  loop.quit
95
+ GLib::Source::REMOVE
54
96
  end
55
- end
56
- @view.load_uri(http_url)
57
- loop.run
97
+ @view.signal_connect("load-changed") do |view, event|
98
+ case event
99
+ when WebKit2Gtk::LoadEvent::FINISHED
100
+ GLib::Source.remove(timeout_id) if timeout_id
101
+ loaded = true
102
+ loop.quit
103
+ end
104
+ end
105
+ @view.load_uri(http_url)
106
+ loop.run
58
107
 
59
- assert_true(loaded)
108
+ assert_true(loaded)
109
+ end
60
110
  end
61
111
  end
@@ -21,7 +21,7 @@ require "webrick"
21
21
  module WebKit2GtkTestUtils
22
22
  def only_webkit2_gtk_version(major, minor, micro=nil)
23
23
  micro ||= 0
24
- unless WebKit2Gtk.or_later?(major, minor, micro)
24
+ unless WebKit2Gtk::Version.or_later?(major, minor, micro)
25
25
  omit("Require WebKit2Gtk >= #{major}.#{minor}.#{micro}")
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webkit2-gtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.3
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-27 00:00:00.000000000 Z
11
+ date: 2017-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gobject-introspection
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.3
19
+ version: 3.1.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.1.3
26
+ version: 3.1.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gtk3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.3
33
+ version: 3.1.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.3
40
+ version: 3.1.4
41
41
  description: Ruby/WebKit2GTK is a Ruby binding of WebKit2GTK+.
42
42
  email: ruby-gnome2-devel-en@lists.sourceforge.net
43
43
  executables: []
@@ -48,7 +48,9 @@ files:
48
48
  - Rakefile
49
49
  - dependency-check/Rakefile
50
50
  - lib/webkit2-gtk.rb
51
+ - lib/webkit2-gtk/loader.rb
51
52
  - lib/webkit2-gtk/version.rb
53
+ - lib/webkit2-gtk/web-view.rb
52
54
  - sample/browser.rb
53
55
  - test/run-test.rb
54
56
  - test/test-webkit2-gtk-webview.rb