@botiverse/porthole 0.14.12 → 0.14.14
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.
- package/CHANGELOG.md +46 -0
- package/dist/annotate/types.d.ts +10 -4
- package/dist/annotate/types.js +4 -1
- package/dist/annotate/validate.js +19 -4
- package/dist/check/page-source.js +1 -1
- package/dist/conformance/harness-source.js +1 -1
- package/dist/host/create-host.js +2 -1
- package/dist/host/types.d.ts +9 -0
- package/dist/isolation/types.d.ts +6 -0
- package/dist/isolation/types.js +6 -0
- package/dist/platform/web.js +6 -1
- package/dist/react/frame.d.ts +4 -1
- package/dist/shell/annotate.d.ts +12 -1
- package/dist/shell/annotate.js +39 -5
- package/dist/shell/frame.d.ts +6 -1
- package/dist/shell/frame.js +45 -5
- package/docs/ADOPTING.md +53 -4
- package/docs/ARCHITECTURE.md +1 -0
- package/docs/DECISIONS.md +454 -4
- package/docs/DESIGN.md +21 -5
- package/docs/THREAT_MODEL.md +51 -8
- package/package.json +1 -1
- package/src/annotate/types.ts +10 -4
- package/src/annotate/validate.ts +23 -4
- package/src/host/create-host.ts +2 -1
- package/src/host/types.ts +9 -0
- package/src/isolation/types.ts +7 -0
- package/src/platform/web.ts +6 -0
- package/src/react/frame.tsx +4 -1
- package/src/shell/annotate.ts +40 -5
- package/src/shell/frame.ts +45 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,52 @@
|
|
|
4
4
|
section); the reasons for every change are in [docs/DECISIONS.md](docs/DECISIONS.md), by the
|
|
5
5
|
P-numbers below.
|
|
6
6
|
|
|
7
|
+
## 0.14.14
|
|
8
|
+
|
|
9
|
+
- **Nested pages: `display.focus()` reaches the page (P136).** It stopped at the page's shell on every
|
|
10
|
+
engine, for a page that never had the focus as much as one that did, and took the keyboard out of
|
|
11
|
+
a page that held it on Chromium and WebKit. So P135's fallback, `display.focus()` and `focusMark(id)`
|
|
12
|
+
again, now works on a nested page, and the known gap from 0.14.13 goes. Two cases stay, in
|
|
13
|
+
ADOPTING: the frame's own `focus()` still stops at the shell, which is the React step on a nested
|
|
14
|
+
page; and on Firefox `display.focus()` inside a key's own handler moves nothing, so call it from a
|
|
15
|
+
task. Upgrade the content server and the host together: either alone behaves as before.
|
|
16
|
+
- **Security (P136):** a new host-to-shell word, `porthole/shell/focus`, sent only by
|
|
17
|
+
`display.focus()`. The shell acts on it only while the focus is on its own document, and no page
|
|
18
|
+
can say it (control `shell-focus-held`). `marker-late` now covers nested pages too. No CSP, sandbox,
|
|
19
|
+
egress or gate changes; the focus guard is untouched.
|
|
20
|
+
- **Annotations: a `focusMark` that came late (P137).** 0.14.13's promise held only for a word that
|
|
21
|
+
waited for marks. A word a busy page took late landed unasked, and on a frame out of process it
|
|
22
|
+
pulled the keyboard off a host's button the person had gone on to. `createHost` now stamps the
|
|
23
|
+
word, and one 100 ms old or more is dropped unless the focus is in the frame, as a parked one is. A
|
|
24
|
+
calm close still lands from your `<body>`, and a second call after your own move still lands. So
|
|
25
|
+
P135's fallback covers a busy page too (ADOPTING). Upgrade the content server and the host
|
|
26
|
+
together: a newer shell takes an older host's word, which has no stamp, as late, so without
|
|
27
|
+
the fallback it stops landing from `<body>`.
|
|
28
|
+
- **Security (P137):** the shell's clock is `Date.now`, kept before content runs, so a page that stops
|
|
29
|
+
its own clock can't make a late word look fresh (controls `marker-busy`, `marker-clock`;
|
|
30
|
+
`marker-has-focus` covers this test too). No CSP, sandbox, egress or gate changes; the focus guard
|
|
31
|
+
is untouched.
|
|
32
|
+
- **Annotations: a last line comes with its scroll (P137).** A report with `lastLineDocumentRect` and
|
|
33
|
+
no `scroll` is dropped, so ADOPTING's sample can't throw on a forged one. Only a forged one goes:
|
|
34
|
+
`scroll` without a last line still passes on `tracked` and `anchored`, as older shells send it.
|
|
35
|
+
- **Docs (P137):** the second exception to "takes no focus" now names keys: if you move the focus into
|
|
36
|
+
a view on `activated`, the view's key handlers and your page-wide shortcuts that write need the
|
|
37
|
+
same gate as its controls (THREAT_MODEL §6, ADOPTING).
|
|
38
|
+
|
|
39
|
+
## 0.14.13
|
|
40
|
+
|
|
41
|
+
- **Annotations: a `focusMark` that had to wait (P135).** While the frame finds its marks, `focusMark`
|
|
42
|
+
waits, and is now dropped unless the focus is in the frame by then, so it takes no keyboard from a
|
|
43
|
+
person who moved on. (Corrected: that held for a word that waited, not for one a busy page took
|
|
44
|
+
late, which could still take it. P137.) A call on a calm page is unchanged. After your card closes
|
|
45
|
+
the focus is on your `<body>`, so a call that waited is dropped: if the focus is still there a
|
|
46
|
+
moment later, call
|
|
47
|
+
`display.focus()` and `focusMark(id)` again (ADOPTING). Known gap: on a nested page that had the
|
|
48
|
+
focus, `display.focus()` doesn't bring it back, so a call that waits is dropped even then.
|
|
49
|
+
- **Security (P135):** the shell asks through the platform's `hasFocus`, kept before content runs
|
|
50
|
+
(controls `marker-late`, `marker-has-focus`). No CSP, sandbox, egress or gate changes; the focus
|
|
51
|
+
guard is untouched.
|
|
52
|
+
|
|
7
53
|
## 0.14.12
|
|
8
54
|
|
|
9
55
|
- **Annotations: the keyboard back on a marker (P134).** `annotations.focusMark(id)` (React:
|
package/dist/annotate/types.d.ts
CHANGED
|
@@ -125,7 +125,8 @@ export interface AnchorResult {
|
|
|
125
125
|
* Where its last line is in the document (P133), in the coordinates of `documentRect` and as
|
|
126
126
|
* unclamped: its last line with words on it for text, its whole box for an element, which has no
|
|
127
127
|
* lines of its own. For a host's UI after the last line (its right, or its bottom). Absent from
|
|
128
|
-
* an older shell, and where nothing of the mark is drawn.
|
|
128
|
+
* an older shell, and where nothing of the mark is drawn. Never without its report's `scroll`
|
|
129
|
+
* (a report that tries is dropped, P137). The page's word.
|
|
129
130
|
*/
|
|
130
131
|
readonly lastLineDocumentRect?: AnnotationRect;
|
|
131
132
|
/**
|
|
@@ -141,7 +142,8 @@ export type AnnotationReport =
|
|
|
141
142
|
* The person pointed at an element or settled a text selection. A newer shell (P133) adds where
|
|
142
143
|
* it ends, for a host's UI after its last line: `lastLineDocumentRect` as a result's is, with
|
|
143
144
|
* how far the document was scrolled as it was read (so its place in the frame's viewport is the
|
|
144
|
-
* one less the other, unclamped). Both absent from an older shell
|
|
145
|
+
* one less the other, unclamped). Both absent from an older shell, and never one alone (a report
|
|
146
|
+
* that tries is dropped, P137).
|
|
145
147
|
*/
|
|
146
148
|
{
|
|
147
149
|
readonly type: "selected";
|
|
@@ -187,7 +189,8 @@ export type AnnotationReport =
|
|
|
187
189
|
* document scrolls, so a host following one mark hears the scroll at every animation frame where
|
|
188
190
|
* it changed, whether that mark is in the frame or not, and places every mark it holds a
|
|
189
191
|
* `documentRect` for (an `anchored` report's) without asking again. A newer one still (P133) adds
|
|
190
|
-
* its `lastLineDocumentRect
|
|
192
|
+
* its `lastLineDocumentRect`, never without `scroll` (a report that tries is dropped, P137), though
|
|
193
|
+
* `scroll` comes without it.
|
|
191
194
|
*/
|
|
192
195
|
| {
|
|
193
196
|
readonly type: "tracked";
|
|
@@ -234,7 +237,10 @@ export declare const ANNOTATE_METHODS: {
|
|
|
234
237
|
readonly tracked: "porthole/annotate.tracked";
|
|
235
238
|
/** Host → frame: take the page's text selection away, telling nothing back (P115). */
|
|
236
239
|
readonly clearSelection: "porthole/annotate.clearSelection";
|
|
237
|
-
/**
|
|
240
|
+
/**
|
|
241
|
+
* Host → frame: put the focus on one mark's marker (`{ id }`), telling nothing back (P134); one
|
|
242
|
+
* that waited for the marks is dropped unless the focus is in the frame's document by then (P135).
|
|
243
|
+
*/
|
|
238
244
|
readonly focusMark: "porthole/annotate.focusMark";
|
|
239
245
|
};
|
|
240
246
|
/** The most of each part of an anchor or report the host takes. */
|
package/dist/annotate/types.js
CHANGED
|
@@ -36,7 +36,10 @@ export const ANNOTATE_METHODS = {
|
|
|
36
36
|
tracked: "porthole/annotate.tracked",
|
|
37
37
|
/** Host → frame: take the page's text selection away, telling nothing back (P115). */
|
|
38
38
|
clearSelection: "porthole/annotate.clearSelection",
|
|
39
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Host → frame: put the focus on one mark's marker (`{ id }`), telling nothing back (P134); one
|
|
41
|
+
* that waited for the marks is dropped unless the focus is in the frame's document by then (P135).
|
|
42
|
+
*/
|
|
40
43
|
focusMark: "porthole/annotate.focusMark",
|
|
41
44
|
};
|
|
42
45
|
/** The most of each part of an anchor or report the host takes. */
|
|
@@ -157,6 +157,13 @@ function results(value) {
|
|
|
157
157
|
}
|
|
158
158
|
return out;
|
|
159
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* A last line with nothing to read it by (P137): its place in the frame's viewport is its own less
|
|
162
|
+
* the scroll it was read at, so a shell sends no last line without one, and a host needn't test for
|
|
163
|
+
* both. The scroll alone is a shell's own: 0.14.10's `tracked` and `anchored` (P132, no last line yet),
|
|
164
|
+
* and a newer one's where nothing of the mark is drawn.
|
|
165
|
+
*/
|
|
166
|
+
const lineWithoutScroll = (line, scroll) => line !== undefined && scroll === undefined;
|
|
160
167
|
/** A report from the frame, checked; null if malformed (it is then dropped). */
|
|
161
168
|
export function parseReport(value) {
|
|
162
169
|
if (!isRecord(value)) {
|
|
@@ -174,6 +181,10 @@ export function parseReport(value) {
|
|
|
174
181
|
if (anchor === null || rect === null || lastLineDocumentRect === null || scroll === null) {
|
|
175
182
|
return null;
|
|
176
183
|
}
|
|
184
|
+
// A pair, here (P137): a selection has never had one without the other.
|
|
185
|
+
if ((lastLineDocumentRect === undefined) !== (scroll === undefined)) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
177
188
|
return {
|
|
178
189
|
type: "selected",
|
|
179
190
|
anchor,
|
|
@@ -189,9 +200,12 @@ export function parseReport(value) {
|
|
|
189
200
|
case "anchored": {
|
|
190
201
|
const checked = results(value.results);
|
|
191
202
|
const scroll = value.scroll === undefined ? undefined : parseScroll(value.scroll);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
203
|
+
if (checked === null ||
|
|
204
|
+
scroll === null ||
|
|
205
|
+
checked.some((each) => lineWithoutScroll(each.lastLineDocumentRect, scroll))) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
return { type: "anchored", results: checked, ...(scroll === undefined ? {} : { scroll }) };
|
|
195
209
|
}
|
|
196
210
|
case "activated": {
|
|
197
211
|
const rect = parseRect(value.rect);
|
|
@@ -209,7 +223,8 @@ export function parseReport(value) {
|
|
|
209
223
|
rect === null ||
|
|
210
224
|
documentRect === null ||
|
|
211
225
|
lastLineDocumentRect === null ||
|
|
212
|
-
scroll === null
|
|
226
|
+
scroll === null ||
|
|
227
|
+
lineWithoutScroll(lastLineDocumentRect, scroll)) {
|
|
213
228
|
return null;
|
|
214
229
|
}
|
|
215
230
|
return {
|