@ai-ecoverse/slicc-browsers 1.51.0 → 1.52.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 +2 -2
- package/engine/builtins.mjs +34 -0
- package/engine/engine-js.mjs +1 -0
- package/engine/runtime.mjs +12 -0
- package/engine.mjs +38 -28
- package/guard-vectors.json +1 -1
- package/package.json +12 -6
- package/protected-js.mjs +1 -0
- package/protected.mjs +1 -1
package/README.md
CHANGED
|
@@ -75,11 +75,11 @@ npm install @ai-ecoverse/slicc-browsers
|
|
|
75
75
|
| `./guard-runner`, `./guard-driver.mjs` | the guard vector runner and its helpers |
|
|
76
76
|
| `./fixture`, `./fixture-client` | the test server (Node only) and a client for a remote one |
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Only `./fixture` requires Node. MV3 extension pages using wasm need `'wasm-unsafe-eval'`. Use `./protected-js.mjs` or `./engine-js` for page contexts whose CSP forbids WebAssembly. Inject the JS bundle before page scripts run so it can capture the original built-ins.
|
|
79
79
|
|
|
80
80
|
## Engine
|
|
81
81
|
|
|
82
|
-
One rules engine classifies protected origins, targets, cookie domains, storage keys and HAR request URLs. Use Rust's `slicc_browsers::engine::Engine::embedded()?` (feature `engine`), import `engine` or async `loadEngine` from `@ai-ecoverse/slicc-browsers/engine` in JS, or call `engine.Default()` in Go's `github.com/ai-ecoverse/slicc-browsers/engine`. JS and Go run the same import-free wasm (under 512 KiB); on macOS, Go defaults to wazero’s interpreter for hardened-runtime compatibility (wazero issue 2393). Bindings check ABI 1; only incompatible request or answer changes bump it. Treat errors as refusals. `refusal(key)` returns the shared text from `catalog.json`’s `refusals` or errors on an unknown key.
|
|
82
|
+
One rules engine classifies protected origins, targets, cookie domains, storage keys and HAR request URLs. Use Rust's `slicc_browsers::engine::Engine::embedded()?` (feature `engine`), import `engine` or async `loadEngine` from `@ai-ecoverse/slicc-browsers/engine` in JS, or call `engine.Default()` in Go's `github.com/ai-ecoverse/slicc-browsers/engine`. The default JS and Go bindings run the same import-free wasm (under 512 KiB); on macOS, Go defaults to wazero’s interpreter for hardened-runtime compatibility (wazero issue 2393). Bindings check ABI 1; only incompatible request or answer changes bump it. Treat errors as refusals. `refusal(key)` returns the shared text from `catalog.json`’s `refusals` or errors on an unknown key.
|
|
83
83
|
|
|
84
84
|
## The catalog
|
|
85
85
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const { Array, Map, Object, Reflect, RegExp, String, Uint8Array, WeakMap } = globalThis;
|
|
2
|
+
const { apply } = Reflect;
|
|
3
|
+
export const method =
|
|
4
|
+
(fn) =>
|
|
5
|
+
(self, ...args) =>
|
|
6
|
+
apply(fn, self, args);
|
|
7
|
+
const getter = (prototype, key) => method(Object.getOwnPropertyDescriptor(prototype, key).get);
|
|
8
|
+
export const typedLength = getter(Object.getPrototypeOf(Uint8Array.prototype), 'length');
|
|
9
|
+
export const byteLength = getter(globalThis.ArrayBuffer.prototype, 'byteLength');
|
|
10
|
+
export const typedSet = method(Uint8Array.prototype.set);
|
|
11
|
+
export const copyWithin = method(Uint8Array.prototype.copyWithin);
|
|
12
|
+
export const fill = method(Uint8Array.prototype.fill);
|
|
13
|
+
export const charCodeAt = method(String.prototype.charCodeAt);
|
|
14
|
+
export const wellFormed = method(String.prototype.toWellFormed);
|
|
15
|
+
export const startsWith = method(String.prototype.startsWith);
|
|
16
|
+
export const exec = method(RegExp.prototype.exec);
|
|
17
|
+
export const includes = method(Array.prototype.includes);
|
|
18
|
+
export const every = method(Array.prototype.every);
|
|
19
|
+
export const weakGet = method(WeakMap.prototype.get);
|
|
20
|
+
export const weakSet = method(WeakMap.prototype.set);
|
|
21
|
+
export const mapGet = method(Map.prototype.get);
|
|
22
|
+
export const mapSet = method(Map.prototype.set);
|
|
23
|
+
export const mapDelete = method(Map.prototype.delete);
|
|
24
|
+
export const forEachEntry = method(Map.prototype.forEach);
|
|
25
|
+
export const deref = method(globalThis.WeakRef.prototype.deref);
|
|
26
|
+
const { setPrototypeOf } = Object;
|
|
27
|
+
export function list(values, convert, accept = () => true) {
|
|
28
|
+
const out = setPrototypeOf([], null);
|
|
29
|
+
for (let i = 0; i < values.length; i++) {
|
|
30
|
+
const v = values[i];
|
|
31
|
+
if (accept(v)) out[out.length] = convert(v);
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|