Skip to content

Commit d0bf8d7

Browse files
committed
docs: several pages can be open at once now
The one-page limit came from obscura #756, which upstream fixed in #824. tests/pages.cfm keeps three live pages, closes them in turn, and runs a second browser alongside the first.
1 parent 5bccafd commit d0bf8d7

2 files changed

Lines changed: 44 additions & 14 deletions

File tree

‎README.md‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -347,20 +347,18 @@ allowed`, which is the guard doing its job rather than a bug.
347347

348348
## Notes and limits
349349

350-
- **Use one page at a time.** This is a correctness limit, not a speed one: in
351-
the underlying engine, dropping a page while a second one is alive aborts the
352-
process with a V8 fatal (`heap->isolate() == Isolate::TryGetCurrent()`), because
353-
each page owns its own isolate and the realm is destroyed without entering it.
354-
One page is completely stable; two is not. Reported upstream as
355-
[#756](https://github.com/h4ckf0r0day/obscura/issues/756). Until it is fixed,
356-
treat this as suited to tests, reports and sequential scraping — not to a pool
357-
of concurrent pages.
358-
- All browser work also runs on one service thread, so concurrent requests queue
359-
behind each other. That part is only a throughput limit, and the design is not
360-
forced: pages are pinned to a thread because an isolate cannot move between
361-
threads, but a pool of service threads with each browser pinned to one would
362-
work. It is not worth building until the isolate lifecycle above is fixed —
363-
more live isolates is precisely what triggers the abort.
350+
- **Several pages can be open at once.** Older builds aborted the process with a
351+
V8 fatal (`heap->isolate() == Isolate::TryGetCurrent()`) when a page was dropped
352+
while another was alive
353+
([#756](https://github.com/h4ckf0r0day/obscura/issues/756)). Upstream fixed
354+
that in [#824](https://github.com/h4ckf0r0day/obscura/pull/824), and with
355+
obscura v0.2.5 three live pages, closed in any order, and two browsers side
356+
by side all run cleanly.
357+
- All browser work runs on one service thread, so concurrent requests queue
358+
behind each other. That is a throughput limit, not a correctness one, and the
359+
design is not forced: pages are pinned to a thread because an isolate cannot
360+
move between threads, but a pool of service threads with each browser pinned
361+
to one would work.
364362
- Every call has a deadline. A wedged page raises a catchable CFML error rather
365363
than hanging the request.
366364
- A page handle is `Send`, so it is safe to keep in `application` scope and to

‎tests/pages.cfm‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<cfscript>
2+
// Several live pages at once. Before obscura #824 (issue #756), dropping a page
3+
// while another was alive aborted the whole process with a V8 fatal, so this
4+
// file either prints its summary or does not finish at all.
5+
here = "file://#getDirectoryFromPath( getCurrentTemplatePath() )#";
6+
fails = 0;
7+
function check( label, got, want ) {
8+
if ( got == want ) { writeOutput( " ok " & label & chr(10) ); }
9+
else { writeOutput( " FAIL " & label & " -> got [" & got & "], want [" & want & "]" & chr(10) ); fails++; }
10+
}
11+
12+
b = Browser();
13+
for ( round = 1; round <= 3; round++ ) {
14+
first = b.newPage().goto( here & "two.html" );
15+
second = b.newPage().goto( here & "hist.html" );
16+
third = b.newPage().goto( here & "app.html" );
17+
first.close();
18+
check( "round #round#: pages outlive a closed sibling", second.title() & "/" & third.title(), "one/app" );
19+
third.close();
20+
check( "round #round#: and the last one still works", second.title(), "one" );
21+
second.close();
22+
}
23+
24+
other = Browser();
25+
mine = b.newPage().goto( here & "two.html" );
26+
theirs = other.newPage().goto( here & "two.html" );
27+
mine.close();
28+
check( "a page in a second browser outlives one in the first", theirs.title(), "two" );
29+
theirs.close();
30+
31+
writeOutput( fails ? "SOME FAILED" & chr(10) : "ALL PAGES OK" & chr(10) );
32+
</cfscript>

0 commit comments

Comments
 (0)