@ai-ecoverse/slicc-browsers 1.52.0 → 1.54.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.
- package/README.md +8 -6
- package/catalog.json +81 -0
- package/engine/engine-js.mjs +1 -1
- package/engine/engine-wasm.mjs +1 -1
- package/engine/engine.wasm +0 -0
- package/engine-vectors.json +11317 -1306
- package/engine.mjs +26 -23
- package/guard-vectors.json +650 -18
- package/package.json +7 -4
- package/protected-error-page.mjs +250 -28
- package/protected-js.mjs +1 -1
- package/protected-worker.mjs +24 -7
- package/protected.json +329 -11
- package/protected.mjs +1 -1
- package/schema/catalog.schema.json +28 -0
- package/schema/engine-vectors.schema.json +160 -14
- package/schema/protected.schema.json +3 -0
- package/sealed-event-rules.mjs +18 -0
- package/sealed-events.mjs +8 -0
package/engine.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
every,
|
|
3
3
|
exec,
|
|
4
4
|
includes,
|
|
5
|
-
list,
|
|
6
5
|
method,
|
|
7
6
|
startsWith,
|
|
8
7
|
typedLength,
|
|
@@ -35,6 +34,7 @@ function valid(request, result) {
|
|
|
35
34
|
case 'frameClass':
|
|
36
35
|
case 'urlClass':
|
|
37
36
|
return (
|
|
37
|
+
(request.op === 'urlClass' || typeof result?.sealed === 'boolean') &&
|
|
38
38
|
typeof result?.protected === 'boolean' &&
|
|
39
39
|
includes(roles, result.role) &&
|
|
40
40
|
(result.origin === null || typeof result.origin === 'string')
|
|
@@ -46,6 +46,25 @@ function valid(request, result) {
|
|
|
46
46
|
typeof result.digest === 'string' &&
|
|
47
47
|
exec(/^[0-9a-f]{16}$/, result.digest) !== null
|
|
48
48
|
);
|
|
49
|
+
case 'command':
|
|
50
|
+
return (
|
|
51
|
+
record(result) &&
|
|
52
|
+
((result.action === 'allow' &&
|
|
53
|
+
(Object.keys(result).length === 1 ||
|
|
54
|
+
(Object.keys(result).length === 2 && typeof result.replyFilter === 'string'))) ||
|
|
55
|
+
(result.action === 'refuse' &&
|
|
56
|
+
Object.keys(result).length === 2 &&
|
|
57
|
+
typeof result.reason === 'string'))
|
|
58
|
+
);
|
|
59
|
+
case 'event':
|
|
60
|
+
return (
|
|
61
|
+
record(result) &&
|
|
62
|
+
((Object.keys(result).length === 1 &&
|
|
63
|
+
includes(['pass', 'drop', 'internal'], result.action)) ||
|
|
64
|
+
(Object.keys(result).length === 2 &&
|
|
65
|
+
result.action === 'rewrite' &&
|
|
66
|
+
record(result.params)))
|
|
67
|
+
);
|
|
49
68
|
case 'page':
|
|
50
69
|
return (
|
|
51
70
|
typeof result?.mixed === 'boolean' &&
|
|
@@ -56,6 +75,7 @@ function valid(request, result) {
|
|
|
56
75
|
Object.values(result.frames),
|
|
57
76
|
(v) =>
|
|
58
77
|
typeof v?.protected === 'boolean' &&
|
|
78
|
+
typeof v.sealed === 'boolean' &&
|
|
59
79
|
includes(roles, v.role) &&
|
|
60
80
|
captureDecision(v.capture)
|
|
61
81
|
)
|
|
@@ -106,22 +126,6 @@ function encode(value) {
|
|
|
106
126
|
);
|
|
107
127
|
}
|
|
108
128
|
|
|
109
|
-
function preserveFailedURL(request) {
|
|
110
|
-
if (
|
|
111
|
-
!includes(['target', 'frame', 'targetClass', 'frameClass'], request?.op) ||
|
|
112
|
-
typeof request.url !== 'string'
|
|
113
|
-
)
|
|
114
|
-
return request;
|
|
115
|
-
const failed = request.unreachableURL ?? request.unreachableUrl;
|
|
116
|
-
if (
|
|
117
|
-
typeof failed !== 'string' ||
|
|
118
|
-
failed === request.url ||
|
|
119
|
-
wellFormed(failed) !== wellFormed(request.url)
|
|
120
|
-
)
|
|
121
|
-
return request;
|
|
122
|
-
return { ...request, documentURL: undefined };
|
|
123
|
-
}
|
|
124
|
-
|
|
125
129
|
export function engine(config = {}) {
|
|
126
130
|
const input = encode(config);
|
|
127
131
|
function create() {
|
|
@@ -135,11 +139,7 @@ export function engine(config = {}) {
|
|
|
135
139
|
function call(request) {
|
|
136
140
|
try {
|
|
137
141
|
instance ??= create();
|
|
138
|
-
const
|
|
139
|
-
request.op === 'batch' && Array.isArray(request.calls)
|
|
140
|
-
? { ...request, calls: list(request.calls, preserveFailedURL) }
|
|
141
|
-
: preserveFailedURL(request);
|
|
142
|
-
const result = exchange(instance, 'engine_call', encode(wire));
|
|
142
|
+
const result = exchange(instance, 'engine_call', encode(request));
|
|
143
143
|
const ok =
|
|
144
144
|
request.op === 'batch'
|
|
145
145
|
? Array.isArray(result) &&
|
|
@@ -158,12 +158,15 @@ export function engine(config = {}) {
|
|
|
158
158
|
urlReadOnly: (url) => call({ op: 'url', url, readOnly: true }),
|
|
159
159
|
urlClass: (url) => call({ op: 'urlClass', url }),
|
|
160
160
|
target: (facts) => call({ ...facts, op: 'target' }),
|
|
161
|
+
command: (facts) => call({ ...facts, op: 'command' }),
|
|
162
|
+
event: (facts) => call({ ...facts, op: 'event' }),
|
|
161
163
|
page: (facts) => call({ ...facts, op: 'page' }),
|
|
162
164
|
capture: (facts) => call({ ...facts, op: 'capture' }),
|
|
163
165
|
reply: (facts) => call({ ...facts, op: 'reply' }),
|
|
164
166
|
frame: (facts) => call({ ...facts, op: 'frame' }),
|
|
165
167
|
targetClass: (facts) => call({ ...facts, op: 'targetClass' }),
|
|
166
168
|
frameClass: (facts) => call({ ...facts, op: 'frameClass' }),
|
|
169
|
+
sealed: (facts) => call({ ...facts, op: 'sealed' }),
|
|
167
170
|
kept: (url) => call({ op: 'kept', url }),
|
|
168
171
|
keptTarget: (facts) => call({ ...facts, op: 'keptTarget' }),
|
|
169
172
|
unparseable: (url) => call({ op: 'unparseable', url }),
|
|
@@ -171,7 +174,7 @@ export function engine(config = {}) {
|
|
|
171
174
|
storageKey: (key) => call({ op: 'storageKey', key }),
|
|
172
175
|
foreignWorld: (origin) => call({ op: 'foreignWorld', origin }),
|
|
173
176
|
extensionFrame: (url) => call({ op: 'extensionFrame', url }),
|
|
174
|
-
har: (url) => call({ op: 'har', url }),
|
|
177
|
+
har: (url, ownerProtected) => call({ op: 'har', url, ownerProtected }),
|
|
175
178
|
zoneHost: (host) => call({ op: 'zoneHost', host }),
|
|
176
179
|
inheriting: (url) => call({ op: 'inheriting', url }),
|
|
177
180
|
refusal: (key) => call({ op: 'refusal', key }),
|