dommy-rack 0.14.0 → 0.15.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c903e2991f9a93d3e48e9d4593bd5278162f9f0de627a7e79a550103df5b7d7e
|
|
4
|
+
data.tar.gz: 316aa5115842aa327ae70b31a56c11086dbf99d7db1b695998cf2895be04b69d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dba6c23e0b36cc2dc0a163bb669fc36fc985168e7fb6d436a03827cc21093a4419fc02ddfe11de971d78aa420c14827d5150ae12390f45b4d0f026ef4a044d22
|
|
7
|
+
data.tar.gz: 066b2f2401b36c0b8dbf8f4cbb218e9f0b55c2923f1d87bb449f1ddef1c229401c2aed7c33bfdba903994b186d356c8e190f5b9583fa2260cffe5a296724c6df
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.15.0 — 2026-10-04
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- A session's runtimes preload a page's big ES modules as bytecode when `Dommy::Js::ModulePreload.enabled` is set, so with Turbo served as an ES module a page after the second boots in about 11 ms instead of 24 ms.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Requires dommy ~> 0.15.0.
|
|
12
|
+
- A transport reports to its `WebSocket` or `EventSource` through `__internal_transport_open__`, `__internal_transport_message__`, `__internal_transport_error__` and `__internal_transport_closed__`; the `__transport_*__` names are gone.
|
|
13
|
+
- The session's navigation hooks are named with the `__internal_` prefix (`__internal_enqueue_page_navigation__` and the like); a custom navigation delegate calling the old names has to follow.
|
|
14
|
+
|
|
3
15
|
## 0.14.0 — 2026-10-01
|
|
4
16
|
|
|
5
17
|
### Added
|
|
@@ -69,17 +69,17 @@ module Dommy
|
|
|
69
69
|
status, _headers, body = @app.call(env)
|
|
70
70
|
@body = body
|
|
71
71
|
if status >= 400
|
|
72
|
-
post { @es.
|
|
72
|
+
post { @es.__internal_transport_error__ }
|
|
73
73
|
return
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
post { @es.
|
|
76
|
+
post { @es.__internal_transport_open__ }
|
|
77
77
|
body.each { |chunk| feed(chunk) unless @closed }
|
|
78
|
-
post { @es.
|
|
78
|
+
post { @es.__internal_transport_closed__ } unless @closed
|
|
79
79
|
rescue IOError, Errno::EPIPE, Errno::ECONNRESET
|
|
80
80
|
nil
|
|
81
81
|
rescue StandardError
|
|
82
|
-
post { @es.
|
|
82
|
+
post { @es.__internal_transport_error__ } unless @closed
|
|
83
83
|
ensure
|
|
84
84
|
close_body
|
|
85
85
|
end
|
|
@@ -143,7 +143,7 @@ module Dommy
|
|
|
143
143
|
id = @id
|
|
144
144
|
@data = nil
|
|
145
145
|
@event = nil
|
|
146
|
-
post { @es.
|
|
146
|
+
post { @es.__internal_transport_message__(data, event: event, id: id) }
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
def close_body
|
data/lib/dommy/rack/session.rb
CHANGED
|
@@ -17,14 +17,14 @@ module Dommy
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def navigate(url:, source:, method: "GET", body: nil, params: nil, enctype: nil, target: nil, headers: {}, replace: false)
|
|
20
|
-
@session.
|
|
20
|
+
@session.__internal_enqueue_page_navigation__(@window, {
|
|
21
21
|
url: url, method: method, body: body, params: params, enctype: enctype,
|
|
22
22
|
target: target, headers: headers, replace: replace, source: source
|
|
23
23
|
})
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def traverse(delta)
|
|
27
|
-
@session.
|
|
27
|
+
@session.__internal_enqueue_page_traverse__(@window, delta)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -196,7 +196,7 @@ module Dommy
|
|
|
196
196
|
# #advance_time.
|
|
197
197
|
def settle
|
|
198
198
|
require_js!.settle
|
|
199
|
-
|
|
199
|
+
__internal_flush_page_navigation__
|
|
200
200
|
check_js_errors!
|
|
201
201
|
self
|
|
202
202
|
end
|
|
@@ -443,18 +443,18 @@ module Dommy
|
|
|
443
443
|
# performing it synchronously could dispose the JS realm still on the
|
|
444
444
|
# stack, so it is recorded and performed at the next drain (#after_interaction
|
|
445
445
|
# / #settle), exactly like the standalone Browser.
|
|
446
|
-
def
|
|
446
|
+
def __internal_navigation_delegate_for__(window)
|
|
447
447
|
PageNavigationDelegate.new(self, window)
|
|
448
448
|
end
|
|
449
449
|
|
|
450
|
-
def
|
|
450
|
+
def __internal_enqueue_page_navigation__(window, nav)
|
|
451
451
|
# A retained handle to a navigated-away page must not steer the session.
|
|
452
452
|
return unless window.equal?(@current_window)
|
|
453
453
|
|
|
454
454
|
@pending_navigation = nav
|
|
455
455
|
end
|
|
456
456
|
|
|
457
|
-
def
|
|
457
|
+
def __internal_enqueue_page_traverse__(window, delta)
|
|
458
458
|
return unless window.equal?(@current_window)
|
|
459
459
|
|
|
460
460
|
@pending_navigation = {traverse: delta}
|
|
@@ -463,7 +463,7 @@ module Dommy
|
|
|
463
463
|
# Perform a recorded page navigation, if any. Called after the JS runtime
|
|
464
464
|
# drains so the document/realm swap never runs with the outgoing realm's
|
|
465
465
|
# JS on the stack.
|
|
466
|
-
def
|
|
466
|
+
def __internal_flush_page_navigation__
|
|
467
467
|
nav = @pending_navigation
|
|
468
468
|
return unless nav
|
|
469
469
|
|
|
@@ -953,7 +953,7 @@ module Dommy
|
|
|
953
953
|
# before the next line. A no-op when JS is disabled (the mixin default).
|
|
954
954
|
def after_interaction
|
|
955
955
|
@js_runtime&.drain
|
|
956
|
-
|
|
956
|
+
__internal_flush_page_navigation__
|
|
957
957
|
check_js_errors!
|
|
958
958
|
end
|
|
959
959
|
|
|
@@ -145,7 +145,7 @@ module Dommy
|
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
def build_runtime(doc)
|
|
148
|
-
rt = Dommy::Js.build_runtime
|
|
148
|
+
rt = Dommy::Js::ModulePreload.build_runtime(doc)
|
|
149
149
|
window = doc&.default_view
|
|
150
150
|
# Uncaught errors and unhandled rejections reach us through the window's
|
|
151
151
|
# WHATWG report funnel, so the page's own `window.onerror` /
|
|
@@ -173,7 +173,7 @@ module Dommy
|
|
|
173
173
|
# Page-initiated navigations (JS location.href=, form submit, activated
|
|
174
174
|
# <a>) route through the core NavigationDelegate port to the session,
|
|
175
175
|
# which defers and performs them at the next drain.
|
|
176
|
-
window.navigation_delegate = @session.
|
|
176
|
+
window.navigation_delegate = @session.__internal_navigation_delegate_for__(window)
|
|
177
177
|
resources = ::Dommy::Rack::Resources.new(@session)
|
|
178
178
|
# Off-thread network is opt-in: with a session executor, fetch / XHR
|
|
179
179
|
# resolve through a DeferredResponse on this window's scheduler;
|
data/lib/dommy/rack/version.rb
CHANGED
|
@@ -123,8 +123,8 @@ module Dommy
|
|
|
123
123
|
@closed = true
|
|
124
124
|
@client_io.close
|
|
125
125
|
@scheduler.queue_microtask(proc do
|
|
126
|
-
@ws.
|
|
127
|
-
@ws.
|
|
126
|
+
@ws.__internal_transport_error__
|
|
127
|
+
@ws.__internal_transport_closed__(1006, "", was_clean: false)
|
|
128
128
|
end)
|
|
129
129
|
end
|
|
130
130
|
|
|
@@ -132,13 +132,13 @@ module Dommy
|
|
|
132
132
|
|
|
133
133
|
def run_reader
|
|
134
134
|
protocol = read_handshake_response!
|
|
135
|
-
post { @ws.
|
|
135
|
+
post { @ws.__internal_transport_open__(protocol) }
|
|
136
136
|
read_frames
|
|
137
137
|
rescue HandshakeFailed
|
|
138
|
-
post { @ws.
|
|
139
|
-
post { @ws.
|
|
138
|
+
post { @ws.__internal_transport_error__ }
|
|
139
|
+
post { @ws.__internal_transport_closed__(1006, "", was_clean: false) }
|
|
140
140
|
rescue IOError, EOFError, Errno::ECONNRESET, Errno::EPIPE
|
|
141
|
-
post { @ws.
|
|
141
|
+
post { @ws.__internal_transport_closed__(1006, "", was_clean: false) } unless @closed
|
|
142
142
|
ensure
|
|
143
143
|
@client_io.close rescue nil
|
|
144
144
|
end
|
|
@@ -164,12 +164,12 @@ module Dommy
|
|
|
164
164
|
case opcode
|
|
165
165
|
when WebSocketFrame::TEXT, WebSocketFrame::BINARY # continuation frames unsupported: cable messages are single-frame
|
|
166
166
|
data = opcode == WebSocketFrame::TEXT ? payload.force_encoding(Encoding::UTF_8) : payload
|
|
167
|
-
post { @ws.
|
|
167
|
+
post { @ws.__internal_transport_message__(data) }
|
|
168
168
|
when WebSocketFrame::CLOSE # complete the handshake, then report
|
|
169
169
|
code, reason = WebSocketFrame.parse_close(payload)
|
|
170
170
|
send_close_frame(code == 1005 ? 1000 : code, "")
|
|
171
171
|
@closed = true
|
|
172
|
-
post { @ws.
|
|
172
|
+
post { @ws.__internal_transport_closed__(code, reason, was_clean: true) }
|
|
173
173
|
break
|
|
174
174
|
when WebSocketFrame::PING
|
|
175
175
|
write_frame(WebSocketFrame::PONG, payload)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dommy-rack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- takahashim
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.15.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.15.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rack
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|