@celljs/ta-web 4.34.0 → 4.36.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.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/apps/app-icon.d.ts +23 -0
- package/esm/browser/apps/app-icon.js +98 -0
- package/esm/browser/apps/app-settings.d.ts +6 -0
- package/esm/browser/apps/app-settings.js +67 -0
- package/esm/browser/apps/app-window-util.d.ts +23 -0
- package/esm/browser/apps/app-window-util.js +27 -0
- package/esm/browser/apps/app-window.d.ts +9 -0
- package/esm/browser/apps/app-window.js +90 -0
- package/esm/browser/apps/web-apps.d.ts +29 -0
- package/esm/browser/apps/web-apps.js +57 -0
- package/esm/browser/assistant/assistant-thread.js +2 -2
- package/esm/browser/assistant/call-keeper.d.ts +2 -5
- package/esm/browser/assistant/call-keeper.js +7 -11
- package/esm/browser/assistant/mic-capture.d.ts +34 -0
- package/esm/browser/assistant/mic-capture.js +87 -0
- package/esm/browser/assistant/realtime-voice.d.ts +2 -2
- package/esm/browser/assistant/realtime-voice.js +6 -15
- package/esm/browser/components/access-settings.d.ts +6 -0
- package/esm/browser/components/access-settings.js +52 -0
- package/esm/browser/components/app-root.d.ts +6 -0
- package/esm/browser/components/app-root.js +34 -0
- package/esm/browser/components/app-view.d.ts +8 -2
- package/esm/browser/components/app-view.js +1 -25
- package/esm/browser/components/board.d.ts +2 -2
- package/esm/browser/components/board.js +2 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-box-hooks.d.ts +12 -0
- package/esm/browser/components/composer-box-hooks.js +12 -0
- package/esm/browser/components/composer-box-protocol.d.ts +12 -1
- package/esm/browser/components/composer-box.js +14 -11
- package/esm/browser/components/composer.js +69 -3
- package/esm/browser/components/extension-settings.d.ts +7 -0
- package/esm/browser/components/extension-settings.js +32 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-list.js +3 -3
- package/esm/browser/components/message-steps.js +3 -3
- package/esm/browser/components/phone-shell.d.ts +2 -2
- package/esm/browser/components/request-error.d.ts +9 -0
- package/esm/browser/components/request-error.js +21 -0
- package/esm/browser/components/settings-more.js +13 -24
- package/esm/browser/components/storage-settings.d.ts +17 -0
- package/esm/browser/components/storage-settings.js +145 -0
- package/esm/browser/device/screen-awake.d.ts +16 -0
- package/esm/browser/device/screen-awake.js +37 -0
- package/esm/browser/device/sheet-swipe.js +4 -0
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-access.d.ts +16 -0
- package/esm/browser/extension/web-access.js +75 -0
- package/esm/browser/extension/web-api-contributions.d.ts +6 -7
- package/esm/browser/extension/web-api-desktop.d.ts +23 -0
- package/esm/browser/extension/web-api-spec.d.ts +70 -0
- package/esm/browser/extension/web-api-spec.js +225 -0
- package/esm/browser/extension/web-api-targets.d.ts +11 -0
- package/esm/browser/extension/web-api-targets.js +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +11 -1
- package/esm/browser/extension/web-extension-context.d.ts +3 -2
- package/esm/browser/extension/web-extension-context.js +22 -17
- package/esm/browser/extension/web-extension-run.d.ts +8 -1
- package/esm/browser/extension/web-extension-run.js +37 -0
- package/esm/browser/extension/web-extensions-running.d.ts +20 -1
- package/esm/browser/extension/web-extensions-running.js +107 -9
- package/esm/browser/extension/web-extensions.js +1 -0
- package/esm/browser/extension/web-pages.d.ts +5 -0
- package/esm/browser/extension/web-pages.js +3 -0
- package/esm/browser/game/game-control.d.ts +6 -0
- package/esm/browser/game/game-control.js +28 -0
- package/esm/browser/game/game-host.d.ts +9 -2
- package/esm/browser/game/game-host.js +5 -1
- package/esm/browser/game/game-protocol.d.ts +8 -0
- package/esm/browser/game/game-runner.d.ts +7 -1
- package/esm/browser/game/game-runner.js +24 -2
- package/esm/browser/game/game-target.d.ts +22 -0
- package/esm/browser/game/game-target.js +84 -0
- package/esm/browser/game/game-util.d.ts +2 -0
- package/esm/browser/game/game-util.js +2 -0
- package/esm/browser/game/game-view.d.ts +5 -2
- package/esm/browser/game/game-view.js +4 -4
- package/esm/browser/game/game3d-protocol.d.ts +3 -1
- package/esm/browser/game/game3d-runner.d.ts +6 -1
- package/esm/browser/game/game3d-runner.js +26 -2
- package/esm/browser/i18n/en/chat.d.ts +4 -0
- package/esm/browser/i18n/en/chat.js +4 -0
- package/esm/browser/i18n/en/common.d.ts +1 -0
- package/esm/browser/i18n/en/common.js +1 -0
- package/esm/browser/i18n/en/discover.d.ts +11 -0
- package/esm/browser/i18n/en/discover.js +11 -0
- package/esm/browser/i18n/en/settings.d.ts +43 -0
- package/esm/browser/i18n/en/settings.js +43 -0
- package/esm/browser/i18n/ja/chat.js +4 -0
- package/esm/browser/i18n/ja/common.js +1 -0
- package/esm/browser/i18n/ja/discover.js +11 -0
- package/esm/browser/i18n/ja/settings.js +43 -0
- package/esm/browser/i18n/locales.d.ts +60 -3
- package/esm/browser/i18n/messages.d.ts +59 -2
- package/esm/browser/i18n/zh/chat.js +4 -0
- package/esm/browser/i18n/zh/common.js +1 -0
- package/esm/browser/i18n/zh/discover.js +11 -0
- package/esm/browser/i18n/zh/settings.js +43 -0
- package/esm/browser/i18n/zh-tw/chat.js +4 -0
- package/esm/browser/i18n/zh-tw/common.js +1 -0
- package/esm/browser/i18n/zh-tw/discover.js +11 -0
- package/esm/browser/i18n/zh-tw/settings.js +43 -0
- package/esm/browser/index.d.ts +3 -0
- package/esm/browser/index.js +3 -0
- package/esm/browser/notices/notices.js +1 -0
- package/esm/browser/sandbox/channel/channel.d.ts +56 -0
- package/esm/browser/sandbox/channel/channel.js +124 -0
- package/esm/browser/sandbox/channel/codec.d.ts +80 -0
- package/esm/browser/sandbox/channel/codec.js +251 -0
- package/esm/browser/sandbox/hook-host.d.ts +23 -0
- package/esm/browser/sandbox/hook-host.js +61 -0
- package/esm/browser/sandbox/isolated-host.d.ts +105 -0
- package/esm/browser/sandbox/isolated-host.js +395 -0
- package/esm/browser/sandbox/remote/remote-copy.d.ts +57 -0
- package/esm/browser/sandbox/remote/remote-copy.js +318 -0
- package/esm/browser/sandbox/remote/remote-mirror.d.ts +61 -0
- package/esm/browser/sandbox/remote/remote-mirror.js +341 -0
- package/esm/browser/sandbox/remote/remote-protocol.d.ts +79 -0
- package/esm/browser/sandbox/remote/remote-protocol.js +54 -0
- package/esm/browser/sandbox/remote/remote-styles.d.ts +10 -0
- package/esm/browser/sandbox/remote/remote-styles.js +113 -0
- package/esm/browser/sandbox/remote-root.d.ts +11 -0
- package/esm/browser/sandbox/remote-root.js +81 -0
- package/esm/browser/sandbox/runtime/frame-api.d.ts +28 -0
- package/esm/browser/sandbox/runtime/frame-api.js +147 -0
- package/esm/browser/sandbox/runtime/frame-features.d.ts +6 -0
- package/esm/browser/sandbox/runtime/frame-features.js +50 -0
- package/esm/browser/sandbox/runtime/frame-parts.d.ts +36 -0
- package/esm/browser/sandbox/runtime/frame-parts.js +69 -0
- package/esm/browser/sandbox/runtime/frame-roots.d.ts +26 -0
- package/esm/browser/sandbox/runtime/frame-roots.js +76 -0
- package/esm/browser/sandbox/runtime/frame-store.d.ts +9 -0
- package/esm/browser/sandbox/runtime/frame-store.js +18 -0
- package/esm/browser/sandbox/runtime/sandbox-runtime.d.ts +11 -0
- package/esm/browser/sandbox/runtime/sandbox-runtime.js +45 -0
- package/esm/browser/sandbox/sandbox-features.d.ts +25 -0
- package/esm/browser/sandbox/sandbox-features.js +32 -0
- package/esm/browser/sandbox/sandbox-frame.d.ts +21 -0
- package/esm/browser/sandbox/sandbox-frame.js +75 -0
- package/esm/browser/sandbox/sandbox-guards.d.ts +19 -0
- package/esm/browser/sandbox/sandbox-guards.js +74 -0
- package/esm/browser/sandbox/sandbox-protocol.d.ts +57 -0
- package/esm/browser/sandbox/sandbox-protocol.js +49 -0
- package/esm/browser/sandbox/sandbox-runtime-code.d.ts +1 -0
- package/esm/browser/sandbox/sandbox-runtime-code.js +3 -0
- package/esm/browser/sandbox/web-sandbox.d.ts +28 -0
- package/esm/browser/sandbox/web-sandbox.js +44 -0
- package/esm/browser/settings/agent-settings.js +5 -1
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +2 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +4 -0
- package/esm/browser/style/tints.d.ts +2 -0
- package/esm/browser/style/tints.js +10 -0
- package/esm/browser/targets/targets-protocol.d.ts +54 -0
- package/esm/browser/targets/targets-protocol.js +34 -0
- package/esm/browser/targets/targets.d.ts +13 -0
- package/esm/browser/targets/targets.js +64 -0
- package/esm/browser/util/composer.d.ts +4 -2
- package/esm/browser/util/composer.js +7 -1
- package/esm/browser/util/desktop.d.ts +31 -1
- package/esm/browser/util/desktop.js +20 -0
- package/esm/browser/util/message.d.ts +6 -0
- package/esm/browser/util/message.js +21 -0
- package/esm/browser/util/process.d.ts +1 -0
- package/esm/browser/util/process.js +6 -1
- package/esm/browser/util/progress.d.ts +2 -1
- package/esm/browser/util/progress.js +2 -11
- package/esm/browser/view.js +1 -1
- package/lib/browser/apps/app-icon.d.ts +24 -0
- package/lib/browser/apps/app-icon.js +134 -0
- package/lib/browser/apps/app-settings.d.ts +7 -0
- package/lib/browser/apps/app-settings.js +103 -0
- package/lib/browser/apps/app-window-util.d.ts +24 -0
- package/lib/browser/apps/app-window-util.js +30 -0
- package/lib/browser/apps/app-window.d.ts +10 -0
- package/lib/browser/apps/app-window.js +126 -0
- package/lib/browser/apps/web-apps.d.ts +30 -0
- package/lib/browser/apps/web-apps.js +61 -0
- package/lib/browser/assistant/assistant-thread.js +2 -2
- package/lib/browser/assistant/call-keeper.d.ts +2 -5
- package/lib/browser/assistant/call-keeper.js +6 -10
- package/lib/browser/assistant/mic-capture.d.ts +35 -0
- package/lib/browser/assistant/mic-capture.js +91 -0
- package/lib/browser/assistant/realtime-voice.d.ts +2 -2
- package/lib/browser/assistant/realtime-voice.js +6 -15
- package/lib/browser/components/access-settings.d.ts +7 -0
- package/lib/browser/components/access-settings.js +88 -0
- package/lib/browser/components/app-root.d.ts +7 -0
- package/lib/browser/components/app-root.js +70 -0
- package/lib/browser/components/app-view.d.ts +8 -2
- package/lib/browser/components/app-view.js +1 -25
- package/lib/browser/components/board.d.ts +2 -2
- package/lib/browser/components/board.js +2 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-box-hooks.d.ts +12 -0
- package/lib/browser/components/composer-box-hooks.js +13 -0
- package/lib/browser/components/composer-box-protocol.d.ts +12 -1
- package/lib/browser/components/composer-box.js +13 -10
- package/lib/browser/components/composer.js +69 -3
- package/lib/browser/components/extension-settings.d.ts +8 -0
- package/lib/browser/components/extension-settings.js +69 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-list.js +3 -3
- package/lib/browser/components/message-steps.js +3 -3
- package/lib/browser/components/phone-shell.d.ts +2 -2
- package/lib/browser/components/request-error.d.ts +10 -0
- package/lib/browser/components/request-error.js +57 -0
- package/lib/browser/components/settings-more.js +12 -23
- package/lib/browser/components/storage-settings.d.ts +18 -0
- package/lib/browser/components/storage-settings.js +182 -0
- package/lib/browser/device/screen-awake.d.ts +16 -0
- package/lib/browser/device/screen-awake.js +39 -1
- package/lib/browser/device/sheet-swipe.js +4 -0
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-access.d.ts +17 -0
- package/lib/browser/extension/web-access.js +78 -0
- package/lib/browser/extension/web-api-contributions.d.ts +6 -7
- package/lib/browser/extension/web-api-desktop.d.ts +23 -0
- package/lib/browser/extension/web-api-spec.d.ts +71 -0
- package/lib/browser/extension/web-api-spec.js +228 -0
- package/lib/browser/extension/web-api-targets.d.ts +12 -0
- package/lib/browser/extension/web-api-targets.js +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +11 -1
- package/lib/browser/extension/web-extension-context.d.ts +3 -2
- package/lib/browser/extension/web-extension-context.js +22 -17
- package/lib/browser/extension/web-extension-run.d.ts +8 -1
- package/lib/browser/extension/web-extension-run.js +37 -0
- package/lib/browser/extension/web-extensions-running.d.ts +20 -1
- package/lib/browser/extension/web-extensions-running.js +107 -9
- package/lib/browser/extension/web-extensions.js +1 -0
- package/lib/browser/extension/web-pages.d.ts +5 -0
- package/lib/browser/extension/web-pages.js +3 -0
- package/lib/browser/game/game-control.d.ts +6 -0
- package/lib/browser/game/game-control.js +28 -0
- package/lib/browser/game/game-host.d.ts +9 -2
- package/lib/browser/game/game-host.js +5 -1
- package/lib/browser/game/game-protocol.d.ts +8 -0
- package/lib/browser/game/game-runner.d.ts +7 -1
- package/lib/browser/game/game-runner.js +24 -2
- package/lib/browser/game/game-target.d.ts +23 -0
- package/lib/browser/game/game-target.js +87 -0
- package/lib/browser/game/game-util.d.ts +2 -0
- package/lib/browser/game/game-util.js +2 -0
- package/lib/browser/game/game-view.d.ts +5 -2
- package/lib/browser/game/game-view.js +4 -4
- package/lib/browser/game/game3d-protocol.d.ts +3 -1
- package/lib/browser/game/game3d-runner.d.ts +6 -1
- package/lib/browser/game/game3d-runner.js +26 -2
- package/lib/browser/i18n/en/chat.d.ts +4 -0
- package/lib/browser/i18n/en/chat.js +4 -0
- package/lib/browser/i18n/en/common.d.ts +1 -0
- package/lib/browser/i18n/en/common.js +1 -0
- package/lib/browser/i18n/en/discover.d.ts +11 -0
- package/lib/browser/i18n/en/discover.js +11 -0
- package/lib/browser/i18n/en/settings.d.ts +43 -0
- package/lib/browser/i18n/en/settings.js +43 -0
- package/lib/browser/i18n/ja/chat.js +4 -0
- package/lib/browser/i18n/ja/common.js +1 -0
- package/lib/browser/i18n/ja/discover.js +11 -0
- package/lib/browser/i18n/ja/settings.js +43 -0
- package/lib/browser/i18n/locales.d.ts +60 -3
- package/lib/browser/i18n/messages.d.ts +59 -2
- package/lib/browser/i18n/zh/chat.js +4 -0
- package/lib/browser/i18n/zh/common.js +1 -0
- package/lib/browser/i18n/zh/discover.js +11 -0
- package/lib/browser/i18n/zh/settings.js +43 -0
- package/lib/browser/i18n/zh-tw/chat.js +4 -0
- package/lib/browser/i18n/zh-tw/common.js +1 -0
- package/lib/browser/i18n/zh-tw/discover.js +11 -0
- package/lib/browser/i18n/zh-tw/settings.js +43 -0
- package/lib/browser/index.d.ts +3 -0
- package/lib/browser/index.js +3 -0
- package/lib/browser/notices/notices.js +1 -0
- package/lib/browser/sandbox/channel/channel.d.ts +57 -0
- package/lib/browser/sandbox/channel/channel.js +128 -0
- package/lib/browser/sandbox/channel/codec.d.ts +81 -0
- package/lib/browser/sandbox/channel/codec.js +256 -0
- package/lib/browser/sandbox/hook-host.d.ts +24 -0
- package/lib/browser/sandbox/hook-host.js +98 -0
- package/lib/browser/sandbox/isolated-host.d.ts +106 -0
- package/lib/browser/sandbox/isolated-host.js +432 -0
- package/lib/browser/sandbox/remote/remote-copy.d.ts +58 -0
- package/lib/browser/sandbox/remote/remote-copy.js +322 -0
- package/lib/browser/sandbox/remote/remote-mirror.d.ts +62 -0
- package/lib/browser/sandbox/remote/remote-mirror.js +345 -0
- package/lib/browser/sandbox/remote/remote-protocol.d.ts +80 -0
- package/lib/browser/sandbox/remote/remote-protocol.js +57 -0
- package/lib/browser/sandbox/remote/remote-styles.d.ts +11 -0
- package/lib/browser/sandbox/remote/remote-styles.js +116 -0
- package/lib/browser/sandbox/remote-root.d.ts +12 -0
- package/lib/browser/sandbox/remote-root.js +117 -0
- package/lib/browser/sandbox/runtime/frame-api.d.ts +29 -0
- package/lib/browser/sandbox/runtime/frame-api.js +183 -0
- package/lib/browser/sandbox/runtime/frame-features.d.ts +7 -0
- package/lib/browser/sandbox/runtime/frame-features.js +53 -0
- package/lib/browser/sandbox/runtime/frame-parts.d.ts +37 -0
- package/lib/browser/sandbox/runtime/frame-parts.js +106 -0
- package/lib/browser/sandbox/runtime/frame-roots.d.ts +27 -0
- package/lib/browser/sandbox/runtime/frame-roots.js +113 -0
- package/lib/browser/sandbox/runtime/frame-store.d.ts +10 -0
- package/lib/browser/sandbox/runtime/frame-store.js +22 -0
- package/lib/browser/sandbox/runtime/sandbox-runtime.d.ts +12 -0
- package/lib/browser/sandbox/runtime/sandbox-runtime.js +47 -0
- package/lib/browser/sandbox/sandbox-features.d.ts +26 -0
- package/lib/browser/sandbox/sandbox-features.js +35 -0
- package/lib/browser/sandbox/sandbox-frame.d.ts +22 -0
- package/lib/browser/sandbox/sandbox-frame.js +79 -0
- package/lib/browser/sandbox/sandbox-guards.d.ts +20 -0
- package/lib/browser/sandbox/sandbox-guards.js +77 -0
- package/lib/browser/sandbox/sandbox-protocol.d.ts +58 -0
- package/lib/browser/sandbox/sandbox-protocol.js +52 -0
- package/lib/browser/sandbox/sandbox-runtime-code.d.ts +2 -0
- package/lib/browser/sandbox/sandbox-runtime-code.js +6 -0
- package/lib/browser/sandbox/web-sandbox.d.ts +29 -0
- package/lib/browser/sandbox/web-sandbox.js +47 -0
- package/lib/browser/settings/agent-settings.js +5 -1
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +2 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +4 -0
- package/lib/browser/style/tints.d.ts +2 -0
- package/lib/browser/style/tints.js +10 -0
- package/lib/browser/targets/targets-protocol.d.ts +55 -0
- package/lib/browser/targets/targets-protocol.js +37 -0
- package/lib/browser/targets/targets.d.ts +14 -0
- package/lib/browser/targets/targets.js +67 -0
- package/lib/browser/util/composer.d.ts +4 -2
- package/lib/browser/util/composer.js +7 -1
- package/lib/browser/util/desktop.d.ts +31 -1
- package/lib/browser/util/desktop.js +20 -0
- package/lib/browser/util/message.d.ts +6 -0
- package/lib/browser/util/message.js +21 -0
- package/lib/browser/util/process.d.ts +1 -0
- package/lib/browser/util/process.js +6 -1
- package/lib/browser/util/progress.d.ts +2 -1
- package/lib/browser/util/progress.js +2 -11
- package/lib/browser/view.js +2 -2
- package/package.json +8 -8
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A value the sandbox keeps of the page's, which hooks read and which changes as the page says. */
|
|
2
|
+
export declare class FrameStore<T> {
|
|
3
|
+
protected value: T;
|
|
4
|
+
protected readonly listeners: Set<() => void>;
|
|
5
|
+
constructor(value: T);
|
|
6
|
+
readonly subscribe: (listener: () => void) => () => undefined;
|
|
7
|
+
readonly get: () => T;
|
|
8
|
+
set(value: T): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=frame-store.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FrameStore = void 0;
|
|
4
|
+
/** A value the sandbox keeps of the page's, which hooks read and which changes as the page says. */
|
|
5
|
+
class FrameStore {
|
|
6
|
+
constructor(value) {
|
|
7
|
+
this.value = value;
|
|
8
|
+
this.listeners = new Set();
|
|
9
|
+
this.subscribe = (listener) => {
|
|
10
|
+
this.listeners.add(listener);
|
|
11
|
+
return () => void this.listeners.delete(listener);
|
|
12
|
+
};
|
|
13
|
+
this.get = () => this.value;
|
|
14
|
+
}
|
|
15
|
+
set(value) {
|
|
16
|
+
this.value = value;
|
|
17
|
+
for (const listener of this.listeners)
|
|
18
|
+
listener();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.FrameStore = FrameStore;
|
|
22
|
+
//# sourceMappingURL=frame-store.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SandboxBoot } from '../sandbox-protocol';
|
|
2
|
+
/**
|
|
3
|
+
* A sandbox's runtime (docs/design/ta-extension-access.md 3.3): its own React, the extension's `pi` made from the
|
|
4
|
+
* spec, its features, its module run once, and the roots the page shows copied there. Bundled whole into
|
|
5
|
+
* SANDBOX_RUNTIME (scripts/sandbox-runtime.ts).
|
|
6
|
+
*/
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
__taSandbox?: SandboxBoot;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=sandbox-runtime.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const channel_1 = require("../channel/channel");
|
|
5
|
+
const codec_1 = require("../channel/codec");
|
|
6
|
+
const frame_api_1 = require("./frame-api");
|
|
7
|
+
const frame_features_1 = require("./frame-features");
|
|
8
|
+
const frame_parts_1 = require("./frame-parts");
|
|
9
|
+
const frame_roots_1 = require("./frame-roots");
|
|
10
|
+
const frame_store_1 = require("./frame-store");
|
|
11
|
+
const boot = window.__taSandbox;
|
|
12
|
+
delete window.__taSandbox;
|
|
13
|
+
const channel = new channel_1.Channel(boot.port);
|
|
14
|
+
let codec;
|
|
15
|
+
const getCodec = () => codec;
|
|
16
|
+
const parts = new frame_parts_1.FrameParts(channel, getCodec);
|
|
17
|
+
codec = new codec_1.Codec(channel, { partOf: value => parts.pathOf(value) });
|
|
18
|
+
new frame_roots_1.FrameRoots(channel, getCodec);
|
|
19
|
+
const values = new frame_store_1.FrameStore((_a = boot.values) !== null && _a !== void 0 ? _a : {});
|
|
20
|
+
channel.on('values', body => { var _a; return values.set(((_a = getCodec().decode(body)) !== null && _a !== void 0 ? _a : {})); });
|
|
21
|
+
async function main() {
|
|
22
|
+
var _a;
|
|
23
|
+
const pi = frame_api_1.FrameApi.create({
|
|
24
|
+
channel,
|
|
25
|
+
codec: getCodec,
|
|
26
|
+
parts,
|
|
27
|
+
name: boot.name,
|
|
28
|
+
access: boot.access,
|
|
29
|
+
absent: new Set(boot.absent),
|
|
30
|
+
icons: boot.icons,
|
|
31
|
+
values,
|
|
32
|
+
parts_on: 'parts' in boot.features,
|
|
33
|
+
});
|
|
34
|
+
for (const [name, given] of Object.entries(boot.features)) {
|
|
35
|
+
(_a = frame_features_1.FRAME_FEATURES[name]) === null || _a === void 0 ? void 0 : _a.call(frame_features_1.FRAME_FEATURES, given, pi);
|
|
36
|
+
}
|
|
37
|
+
const url = URL.createObjectURL(new Blob([boot.code], { type: 'text/javascript' }));
|
|
38
|
+
const module = (await import(/* @vite-ignore */ url));
|
|
39
|
+
URL.revokeObjectURL(url);
|
|
40
|
+
if (typeof module.default !== 'function') {
|
|
41
|
+
throw new Error('A web extension exports a function as its default export.');
|
|
42
|
+
}
|
|
43
|
+
module.default(pi);
|
|
44
|
+
await channel.request('ready');
|
|
45
|
+
}
|
|
46
|
+
main().catch(error => void channel.request('failed', error instanceof Error ? error.message : String(error)).catch(() => undefined));
|
|
47
|
+
//# sourceMappingURL=sandbox-runtime.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { WebExtensionAPI } from '../extension/web-extension-api';
|
|
2
|
+
import type { SandboxOptions } from './sandbox-protocol';
|
|
3
|
+
/**
|
|
4
|
+
* What a sandbox can do besides the API, each a feature of its own the user turns on or off (docs/design/ta-extension-access.md
|
|
5
|
+
* 3.6): its name, the option that turns it on, what of the API is not there without it. Its half in the sandbox is the
|
|
6
|
+
* entry of the same name in FRAME_FEATURES (runtime/frame-features.ts); one off is not given to the sandbox at all.
|
|
7
|
+
*/
|
|
8
|
+
export interface SandboxFeature {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly option: Exclude<keyof SandboxOptions, 'isolate'>;
|
|
11
|
+
/** The members of the API not there while it is off. */
|
|
12
|
+
absent?(): string[];
|
|
13
|
+
/** What the page gives its half in the sandbox as it starts. */
|
|
14
|
+
boot?(pi: WebExtensionAPI): Promise<unknown>;
|
|
15
|
+
}
|
|
16
|
+
/** The key of the extension's storage that keeps its `localStorage`. */
|
|
17
|
+
export declare const LOCAL_KEY = "local:";
|
|
18
|
+
export declare const SANDBOX_FEATURES: readonly SandboxFeature[];
|
|
19
|
+
export declare namespace SandboxFeatureUtil {
|
|
20
|
+
/** What the features on give the sandbox, by name, and the members of the API those off take away. */
|
|
21
|
+
function of(options: SandboxOptions, pi: WebExtensionAPI): Promise<{
|
|
22
|
+
features: Record<string, unknown>;
|
|
23
|
+
absent: string[];
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=sandbox-features.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxFeatureUtil = exports.SANDBOX_FEATURES = exports.LOCAL_KEY = void 0;
|
|
4
|
+
const web_api_spec_1 = require("../extension/web-api-spec");
|
|
5
|
+
/** The key of the extension's storage that keeps its `localStorage`. */
|
|
6
|
+
exports.LOCAL_KEY = 'local:';
|
|
7
|
+
exports.SANDBOX_FEATURES = [
|
|
8
|
+
// A localStorage of its own, kept with its storage (3.5).
|
|
9
|
+
{ name: 'local', option: 'local', boot: pi => pi.storage.get(exports.LOCAL_KEY) },
|
|
10
|
+
// Ta's components drawn for it (3.4); off, it draws only its own DOM.
|
|
11
|
+
{
|
|
12
|
+
name: 'parts',
|
|
13
|
+
option: 'parts',
|
|
14
|
+
absent: () => {
|
|
15
|
+
const paths = [];
|
|
16
|
+
web_api_spec_1.WebApiSpecUtil.each((path, entry) => (entry.form === 'component' || entry.form === 'components') && paths.push(path));
|
|
17
|
+
return paths;
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
var SandboxFeatureUtil;
|
|
22
|
+
(function (SandboxFeatureUtil) {
|
|
23
|
+
/** What the features on give the sandbox, by name, and the members of the API those off take away. */
|
|
24
|
+
async function of(options, pi) {
|
|
25
|
+
const on = exports.SANDBOX_FEATURES.filter(feature => options[feature.option]);
|
|
26
|
+
const off = exports.SANDBOX_FEATURES.filter(feature => !options[feature.option]);
|
|
27
|
+
const given = await Promise.all(on.map(feature => (feature.boot ? feature.boot(pi).catch(() => undefined) : undefined)));
|
|
28
|
+
return {
|
|
29
|
+
features: Object.fromEntries(on.map((feature, index) => { var _a; return [feature.name, (_a = given[index]) !== null && _a !== void 0 ? _a : null]; })),
|
|
30
|
+
absent: off.flatMap(feature => { var _a; var _b; return (_b = (_a = feature.absent) === null || _a === void 0 ? void 0 : _a.call(feature)) !== null && _b !== void 0 ? _b : []; }),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
SandboxFeatureUtil.of = of;
|
|
34
|
+
})(SandboxFeatureUtil || (exports.SandboxFeatureUtil = SandboxFeatureUtil = {}));
|
|
35
|
+
//# sourceMappingURL=sandbox-features.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type SandboxBoot } from './sandbox-protocol';
|
|
2
|
+
/** The runtime of sandboxes, loaded the first time one starts: the page never loads it otherwise. */
|
|
3
|
+
export declare namespace SandboxRuntime {
|
|
4
|
+
function load(): Promise<string>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The frame of a sandbox (docs/design/ta-extension-access.md 3.3): hidden, of no origin, sandboxed before it is in the
|
|
8
|
+
* document, booted with the runtime and a port, the one way the page and the sandbox talk from then on. It knows nothing
|
|
9
|
+
* of what crosses the port.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SandboxFrame {
|
|
12
|
+
protected readonly element: HTMLIFrameElement;
|
|
13
|
+
protected stopped: boolean;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Starts it with what `boot` says, and resolves with its port once it said hello; rejects when it did not in time
|
|
17
|
+
* (a device that cannot run one, the setting that turns them off).
|
|
18
|
+
*/
|
|
19
|
+
start(boot: Omit<SandboxBoot, 'ta' | 'type' | 'runtime' | 'port'>): Promise<MessagePort>;
|
|
20
|
+
stop(): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=sandbox-frame.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxFrame = exports.SandboxRuntime = void 0;
|
|
4
|
+
const sandbox_protocol_1 = require("./sandbox-protocol");
|
|
5
|
+
/** The runtime of sandboxes, loaded the first time one starts: the page never loads it otherwise. */
|
|
6
|
+
var SandboxRuntime;
|
|
7
|
+
(function (SandboxRuntime) {
|
|
8
|
+
let runtime;
|
|
9
|
+
function load() {
|
|
10
|
+
runtime !== null && runtime !== void 0 ? runtime : (runtime = import('./sandbox-runtime-code.js').then(module => module.SANDBOX_RUNTIME));
|
|
11
|
+
return runtime;
|
|
12
|
+
}
|
|
13
|
+
SandboxRuntime.load = load;
|
|
14
|
+
})(SandboxRuntime || (exports.SandboxRuntime = SandboxRuntime = {}));
|
|
15
|
+
/**
|
|
16
|
+
* The frame of a sandbox (docs/design/ta-extension-access.md 3.3): hidden, of no origin, sandboxed before it is in the
|
|
17
|
+
* document, booted with the runtime and a port, the one way the page and the sandbox talk from then on. It knows nothing
|
|
18
|
+
* of what crosses the port.
|
|
19
|
+
*/
|
|
20
|
+
class SandboxFrame {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.stopped = false;
|
|
23
|
+
const element = document.createElement('iframe');
|
|
24
|
+
element.setAttribute('sandbox', sandbox_protocol_1.SandboxDocs.SANDBOX);
|
|
25
|
+
element.setAttribute('referrerpolicy', 'no-referrer');
|
|
26
|
+
element.setAttribute('allow', '');
|
|
27
|
+
element.setAttribute('aria-hidden', 'true');
|
|
28
|
+
element.tabIndex = -1;
|
|
29
|
+
// As wide as the page, so that what the extension measures there is near what its copies are; never seen.
|
|
30
|
+
element.style.cssText = 'position:fixed;left:0;top:0;width:100vw;height:100vh;border:0;opacity:0;pointer-events:none;z-index:-1;contain:strict';
|
|
31
|
+
this.element = element;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Starts it with what `boot` says, and resolves with its port once it said hello; rejects when it did not in time
|
|
35
|
+
* (a device that cannot run one, the setting that turns them off).
|
|
36
|
+
*/
|
|
37
|
+
start(boot) {
|
|
38
|
+
const { element } = this;
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
const late = setTimeout(() => done(new Error('The sandbox did not start.')), sandbox_protocol_1.SandboxLimits.READY_MS);
|
|
41
|
+
const heard = (event) => {
|
|
42
|
+
const data = event.data;
|
|
43
|
+
if (!element.contentWindow || event.source !== element.contentWindow || (data === null || data === void 0 ? void 0 : data.ta) !== 'sbx' || data.type !== 'hello') {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
void SandboxRuntime.load().then(runtime => {
|
|
47
|
+
var _a;
|
|
48
|
+
if (this.stopped) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// Its own document loaded again (it navigated): nothing of before crosses to it.
|
|
52
|
+
removeEventListener('message', heard);
|
|
53
|
+
const channel = new MessageChannel();
|
|
54
|
+
(_a = element.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ ...boot, ta: 'sbx', type: 'boot', runtime }, '*', [channel.port2]);
|
|
55
|
+
done(undefined, channel.port1);
|
|
56
|
+
}, done);
|
|
57
|
+
};
|
|
58
|
+
const done = (error, port) => {
|
|
59
|
+
clearTimeout(late);
|
|
60
|
+
removeEventListener('message', heard);
|
|
61
|
+
if (port) {
|
|
62
|
+
resolve(port);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
addEventListener('message', heard);
|
|
69
|
+
element.srcdoc = sandbox_protocol_1.SandboxDocs.document();
|
|
70
|
+
document.body.appendChild(element);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
stop() {
|
|
74
|
+
this.stopped = true;
|
|
75
|
+
this.element.remove();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.SandboxFrame = SandboxFrame;
|
|
79
|
+
//# sourceMappingURL=sandbox-frame.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** What a guard knows of the extension whose sandbox asks. */
|
|
2
|
+
export interface SandboxGuardContext {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
}
|
|
5
|
+
/** A check of what a sandbox passes a member, and a change of what it gets back, before and after the page calls it. */
|
|
6
|
+
export interface SandboxGuard {
|
|
7
|
+
args?(args: unknown[], context: SandboxGuardContext): unknown[];
|
|
8
|
+
result?(value: unknown, context: SandboxGuardContext): unknown;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The checks of what crosses from a sandbox (docs/design/ta-extension-access.md 3.2), by the path of the member: the
|
|
12
|
+
* API cut to the extension's access already says what it may use; these say how. A path of no member does not pass the
|
|
13
|
+
* spec below.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SANDBOX_GUARDS: Readonly<Record<string, SandboxGuard>>;
|
|
16
|
+
export declare namespace SandboxGuardUtil {
|
|
17
|
+
/** The paths of SANDBOX_GUARDS that are no member, which the spec of the guards lists as wrong. */
|
|
18
|
+
function strays(): string[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=sandbox-guards.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxGuardUtil = exports.SANDBOX_GUARDS = void 0;
|
|
4
|
+
const web_api_spec_1 = require("../extension/web-api-spec");
|
|
5
|
+
const sandbox_protocol_1 = require("./sandbox-protocol");
|
|
6
|
+
function text(value) {
|
|
7
|
+
if (typeof value !== 'string' || value === '') {
|
|
8
|
+
throw new Error('A sandbox asked with a value that is not text.');
|
|
9
|
+
}
|
|
10
|
+
return value.slice(0, sandbox_protocol_1.SandboxLimits.TEXT);
|
|
11
|
+
}
|
|
12
|
+
/** The id of a view of its own, or the name of the extension. */
|
|
13
|
+
function own(value, { name }) {
|
|
14
|
+
const id = text(value);
|
|
15
|
+
if (id !== name && !id.startsWith(`${name}/`)) {
|
|
16
|
+
throw new Error(`A sandbox of ${name} reaches only its own views.`);
|
|
17
|
+
}
|
|
18
|
+
return id;
|
|
19
|
+
}
|
|
20
|
+
const first = (check) => (args, context) => [check(args[0], context), ...args.slice(1)];
|
|
21
|
+
/**
|
|
22
|
+
* The checks of what crosses from a sandbox (docs/design/ta-extension-access.md 3.2), by the path of the member: the
|
|
23
|
+
* API cut to the extension's access already says what it may use; these say how. A path of no member does not pass the
|
|
24
|
+
* spec below.
|
|
25
|
+
*/
|
|
26
|
+
exports.SANDBOX_GUARDS = {
|
|
27
|
+
openLink: {
|
|
28
|
+
args: first(value => {
|
|
29
|
+
const url = text(value);
|
|
30
|
+
if (!/^https?:\/\//i.test(url)) {
|
|
31
|
+
throw new Error('A sandbox opens only links of the web (http, https).');
|
|
32
|
+
}
|
|
33
|
+
return url;
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
fileUrl: { args: first(text) },
|
|
37
|
+
'ui.showView': { args: first(own) },
|
|
38
|
+
'ui.stopExtension': { args: first(own) },
|
|
39
|
+
'ui.forgetPage': { args: first(own) },
|
|
40
|
+
'ui.apps.install': { args: first(own) },
|
|
41
|
+
'ui.apps.remove': { args: first(own) },
|
|
42
|
+
'ui.apps.open': { args: first(own) },
|
|
43
|
+
// Of the apps of the computer, its own: the names of the others are none of its business.
|
|
44
|
+
'ui.apps.list': {
|
|
45
|
+
result: (value, context) => (Array.isArray(value) ? value : []).filter(app => {
|
|
46
|
+
try {
|
|
47
|
+
return own(app === null || app === void 0 ? void 0 : app.id, context) !== undefined;
|
|
48
|
+
}
|
|
49
|
+
catch (_a) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
'ui.notify': { args: args => [text(args[0]), args[1] === 'warning' || args[1] === 'error' ? args[1] : 'info', args[2]] },
|
|
55
|
+
'ui.confirm': { args: first(text) },
|
|
56
|
+
'ui.input': { args: first(text) },
|
|
57
|
+
'ui.editor': { args: first(text) },
|
|
58
|
+
'storage.get': { args: first(text) },
|
|
59
|
+
'storage.set': { args: first(text) },
|
|
60
|
+
'ui.saveFile': {
|
|
61
|
+
args: args => {
|
|
62
|
+
if (!(args[0] instanceof Blob)) {
|
|
63
|
+
throw new Error('A sandbox saves a Blob.');
|
|
64
|
+
}
|
|
65
|
+
return [args[0], text(args[1])];
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
var SandboxGuardUtil;
|
|
70
|
+
(function (SandboxGuardUtil) {
|
|
71
|
+
/** The paths of SANDBOX_GUARDS that are no member, which the spec of the guards lists as wrong. */
|
|
72
|
+
function strays() {
|
|
73
|
+
return Object.keys(exports.SANDBOX_GUARDS).filter(path => !web_api_spec_1.WebApiSpecUtil.find(path));
|
|
74
|
+
}
|
|
75
|
+
SandboxGuardUtil.strays = strays;
|
|
76
|
+
})(SandboxGuardUtil || (exports.SandboxGuardUtil = SandboxGuardUtil = {}));
|
|
77
|
+
//# sourceMappingURL=sandbox-guards.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { TaExtensionAccess } from '@celljs/ta-protocol';
|
|
2
|
+
import type { StateSpec } from '../state/state-protocol';
|
|
3
|
+
/**
|
|
4
|
+
* Another's web extension that the user allowed less than full access runs in a sandbox (docs/design/ta-extension-access.md
|
|
5
|
+
* 3): a hidden frame of no origin, scripts only, the web beyond; what it draws is copied into the page (remote/), and the
|
|
6
|
+
* rest of Ta it reaches only through the channel (channel/), as far as the user allowed.
|
|
7
|
+
*/
|
|
8
|
+
export declare namespace SandboxDocs {
|
|
9
|
+
const SANDBOX = "allow-scripts";
|
|
10
|
+
const CSP = "default-src 'none'; script-src 'unsafe-inline' blob:; style-src 'unsafe-inline' blob:; img-src data: blob: https:; media-src data: blob: https:; font-src data: https:; connect-src https: wss: blob:; frame-src 'none'; form-action 'none'; base-uri 'none'";
|
|
11
|
+
/** What a frame is first: a few lines that wait for the runtime and run it, with the port of its channel. */
|
|
12
|
+
function document(): string;
|
|
13
|
+
}
|
|
14
|
+
/** The page's first message to a sandbox, once it said hello; its channel is the port that comes with it. */
|
|
15
|
+
export interface SandboxBoot {
|
|
16
|
+
ta: 'sbx';
|
|
17
|
+
type: 'boot';
|
|
18
|
+
runtime: string;
|
|
19
|
+
/** The extension's module. */
|
|
20
|
+
code: string;
|
|
21
|
+
name: string;
|
|
22
|
+
access: TaExtensionAccess;
|
|
23
|
+
/** The selector of its copies in the page, which its styles are scoped to. */
|
|
24
|
+
scope: string;
|
|
25
|
+
/** The members of the API this page has not (an older app, a mini program): not there in the sandbox either. */
|
|
26
|
+
absent: string[];
|
|
27
|
+
/** The values and the hooks read at once (`value`, `read`, `hook` with `peek`), by their paths. */
|
|
28
|
+
values: Record<string, unknown>;
|
|
29
|
+
/** The names of `ui.icons`. */
|
|
30
|
+
icons: string[];
|
|
31
|
+
/** What each feature on gives the sandbox (SandboxFeature.boot), by its name; one off is not there. */
|
|
32
|
+
features: Record<string, unknown>;
|
|
33
|
+
port?: MessagePort;
|
|
34
|
+
}
|
|
35
|
+
/** What the user set of sandboxes on this device (Settings, Extensions). */
|
|
36
|
+
export interface SandboxOptions {
|
|
37
|
+
/** Runs extensions in a sandbox here; off, those that need one do not run on this device. */
|
|
38
|
+
isolate: boolean;
|
|
39
|
+
/** A `localStorage` in the sandbox, kept with the extension's storage (3.5). */
|
|
40
|
+
local: boolean;
|
|
41
|
+
/** Ta's components (`ui.Markdown`, `ui.Dialog`…) drawn for the extension (3.4). */
|
|
42
|
+
parts: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare namespace SandboxOptionsUtil {
|
|
45
|
+
const DEFAULT: SandboxOptions;
|
|
46
|
+
const SPEC: StateSpec<SandboxOptions>;
|
|
47
|
+
}
|
|
48
|
+
export declare namespace SandboxLimits {
|
|
49
|
+
/** The largest file a sandbox is given by fileUrl. */
|
|
50
|
+
const FILE_BYTES: number;
|
|
51
|
+
/** The longest text of a call (a notice, a title, a key). */
|
|
52
|
+
const TEXT = 4000;
|
|
53
|
+
/** How long the page waits for a sandbox to start and register what it has. */
|
|
54
|
+
const READY_MS = 15000;
|
|
55
|
+
/** What the `localStorage` of a sandbox holds at most, in characters. */
|
|
56
|
+
const LOCAL_CHARS: number;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=sandbox-protocol.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxLimits = exports.SandboxOptionsUtil = exports.SandboxDocs = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Another's web extension that the user allowed less than full access runs in a sandbox (docs/design/ta-extension-access.md
|
|
6
|
+
* 3): a hidden frame of no origin, scripts only, the web beyond; what it draws is copied into the page (remote/), and the
|
|
7
|
+
* rest of Ta it reaches only through the channel (channel/), as far as the user allowed.
|
|
8
|
+
*/
|
|
9
|
+
var SandboxDocs;
|
|
10
|
+
(function (SandboxDocs) {
|
|
11
|
+
SandboxDocs.SANDBOX = 'allow-scripts';
|
|
12
|
+
SandboxDocs.CSP = "default-src 'none'; script-src 'unsafe-inline' blob:; style-src 'unsafe-inline' blob:; img-src data: blob: https:; media-src data: blob: https:; font-src data: https:; connect-src https: wss: blob:; frame-src 'none'; form-action 'none'; base-uri 'none'";
|
|
13
|
+
/** What a frame is first: a few lines that wait for the runtime and run it, with the port of its channel. */
|
|
14
|
+
function document() {
|
|
15
|
+
return `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${SandboxDocs.CSP}"><meta name="viewport" content="width=device-width, initial-scale=1"><script>${BOOT}</script></head><body></body></html>`;
|
|
16
|
+
}
|
|
17
|
+
SandboxDocs.document = document;
|
|
18
|
+
/** Runs the runtime once the page sends it; ES5, it must never throw. */
|
|
19
|
+
const BOOT = "(function(){addEventListener('message',function b(e){var d=e.data;if(e.source!==parent||!d||d.ta!=='sbx'||d.type!=='boot'||!e.ports[0])return;removeEventListener('message',b);d.port=e.ports[0];window.__taSandbox=d;var s=document.createElement('script');s.src=URL.createObjectURL(new Blob([d.runtime],{type:'text/javascript'}));document.head.appendChild(s);});parent.postMessage({ta:'sbx',type:'hello'},'*');})();";
|
|
20
|
+
})(SandboxDocs || (exports.SandboxDocs = SandboxDocs = {}));
|
|
21
|
+
var SandboxOptionsUtil;
|
|
22
|
+
(function (SandboxOptionsUtil) {
|
|
23
|
+
SandboxOptionsUtil.DEFAULT = { isolate: true, local: true, parts: true };
|
|
24
|
+
SandboxOptionsUtil.SPEC = {
|
|
25
|
+
key: 'sandbox.options',
|
|
26
|
+
tier: 'device',
|
|
27
|
+
initial: SandboxOptionsUtil.DEFAULT,
|
|
28
|
+
parse: value => {
|
|
29
|
+
if (!value || typeof value !== 'object') {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const kept = value;
|
|
33
|
+
return {
|
|
34
|
+
isolate: typeof kept.isolate === 'boolean' ? kept.isolate : SandboxOptionsUtil.DEFAULT.isolate,
|
|
35
|
+
local: typeof kept.local === 'boolean' ? kept.local : SandboxOptionsUtil.DEFAULT.local,
|
|
36
|
+
parts: typeof kept.parts === 'boolean' ? kept.parts : SandboxOptionsUtil.DEFAULT.parts,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
})(SandboxOptionsUtil || (exports.SandboxOptionsUtil = SandboxOptionsUtil = {}));
|
|
41
|
+
var SandboxLimits;
|
|
42
|
+
(function (SandboxLimits) {
|
|
43
|
+
/** The largest file a sandbox is given by fileUrl. */
|
|
44
|
+
SandboxLimits.FILE_BYTES = 32 * 1024 * 1024;
|
|
45
|
+
/** The longest text of a call (a notice, a title, a key). */
|
|
46
|
+
SandboxLimits.TEXT = 4000;
|
|
47
|
+
/** How long the page waits for a sandbox to start and register what it has. */
|
|
48
|
+
SandboxLimits.READY_MS = 15000;
|
|
49
|
+
/** What the `localStorage` of a sandbox holds at most, in characters. */
|
|
50
|
+
SandboxLimits.LOCAL_CHARS = 1024 * 1024;
|
|
51
|
+
})(SandboxLimits || (exports.SandboxLimits = SandboxLimits = {}));
|
|
52
|
+
//# sourceMappingURL=sandbox-protocol.js.map
|