mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 10:27:33 +00:00
feat(plugins): turn isolated plugin frames on by default (#36821)
Flips PLUGIN_ISOLATED_FRAMES_DEFAULT. ORCA_PLUGIN_ISOLATED_FRAMES=0 or the experimentalPluginIsolatedFrames: false setting turns it off for one machine; reverting this commit turns it off for everyone.
This commit is contained in:
@@ -110,9 +110,7 @@ Aborting the `signal` rejects the call with `cancelled`. Treat an error `code` y
|
||||
|
||||
#### Files and assets
|
||||
|
||||
Preview: isolated frames are off by default for now (set `ORCA_PLUGIN_ISOLATED_FRAMES=1` to try
|
||||
them); until they ship, desktop frames behave like browser clients below. With them on, in the desktop
|
||||
app each plugin's frames run in their own isolated process, storage and origin,
|
||||
In the desktop app each plugin's frames run in their own isolated process, storage and origin,
|
||||
`orca-plugin-frame://<key>/`, served from your plugin folder. Load scripts, styles, images, fonts,
|
||||
WASM and workers by relative URL (`<script src="lib/app.js">`, `new Worker('worker.js')`,
|
||||
`WebAssembly.instantiateStreaming(fetch('lib/mod.wasm'))`), and `localStorage` and IndexedDB
|
||||
|
||||
@@ -71,9 +71,9 @@ Every plugin frame on desktop is an Electron `<webview>`:
|
||||
- **Input**: Orca's window shortcuts are forwarded from a focused guest through the browser tab path, minus
|
||||
browser-page chords (address bar, find, reload, history, page zoom); a custom editor's save chord still
|
||||
rides `editor.keydown`, so it fires once. Editable fields get Orca's Cut/Copy/Paste context menu.
|
||||
- **Switch (default off)**: isolated guests ship off, so merging changes nothing; a separate one-line PR
|
||||
flips the constant `PLUGIN_ISOLATED_FRAMES_DEFAULT` in `src/main/plugins/panels/plugin-frame-isolation.ts`.
|
||||
`ORCA_PLUGIN_ISOLATED_FRAMES=1` (dev, e2e) turns guests on and `=0` off, overriding the
|
||||
- **Switch (default on)**: rolling back is the constant `PLUGIN_ISOLATED_FRAMES_DEFAULT` in
|
||||
`src/main/plugins/panels/plugin-frame-isolation.ts`. `ORCA_PLUGIN_ISOLATED_FRAMES=0` turns guests off
|
||||
for one machine and `=1` on, overriding the
|
||||
`experimentalPluginIsolatedFrames` setting; all are main-process only. Off, frames use the `srcdoc` iframe
|
||||
(never offered `orca.shell`/`orca.files`), and components panels say they are not available.
|
||||
- **Compatibility**: existing single-file plugins load unchanged. Browser clients (serve/web) have no
|
||||
|
||||
@@ -5,17 +5,24 @@ import {
|
||||
} from './plugin-frame-isolation'
|
||||
|
||||
describe('isolated frames switch', () => {
|
||||
it('defaults off, follows the setting, and lets the env var override either way', () => {
|
||||
expect(PLUGIN_ISOLATED_FRAMES_DEFAULT).toBe(false)
|
||||
expect(isPluginFrameIsolationEnabled({}, {})).toBe(false)
|
||||
expect(isPluginFrameIsolationEnabled({ experimentalPluginIsolatedFrames: true }, {})).toBe(true)
|
||||
expect(isPluginFrameIsolationEnabled({}, { ORCA_PLUGIN_ISOLATED_FRAMES: '1' })).toBe(true)
|
||||
it('defaults on, follows the setting, and lets the env var override either way', () => {
|
||||
expect(PLUGIN_ISOLATED_FRAMES_DEFAULT).toBe(true)
|
||||
expect(isPluginFrameIsolationEnabled({}, {})).toBe(true)
|
||||
expect(isPluginFrameIsolationEnabled({ experimentalPluginIsolatedFrames: false }, {})).toBe(
|
||||
false
|
||||
)
|
||||
expect(
|
||||
isPluginFrameIsolationEnabled(
|
||||
{ experimentalPluginIsolatedFrames: false },
|
||||
{ ORCA_PLUGIN_ISOLATED_FRAMES: '1' }
|
||||
)
|
||||
).toBe(true)
|
||||
expect(
|
||||
isPluginFrameIsolationEnabled(
|
||||
{ experimentalPluginIsolatedFrames: true },
|
||||
{ ORCA_PLUGIN_ISOLATED_FRAMES: '0' }
|
||||
)
|
||||
).toBe(false)
|
||||
expect(isPluginFrameIsolationEnabled(null, { ORCA_PLUGIN_ISOLATED_FRAMES: 'yes' })).toBe(false)
|
||||
expect(isPluginFrameIsolationEnabled(null, { ORCA_PLUGIN_ISOLATED_FRAMES: 'yes' })).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* user-gesture methods are offered); on, a guest that cannot be set up fails closed.
|
||||
*/
|
||||
|
||||
/** Off until the flip PR: flipping (or rolling back) the feature is this one line. */
|
||||
export const PLUGIN_ISOLATED_FRAMES_DEFAULT = false
|
||||
/** Rolling the feature back is this one line. */
|
||||
export const PLUGIN_ISOLATED_FRAMES_DEFAULT = true
|
||||
|
||||
export const PLUGIN_ISOLATED_FRAMES_ENV = 'ORCA_PLUGIN_ISOLATED_FRAMES'
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ test('a multi-file plugin panel runs as an isolated guest with assets by URL', a
|
||||
}
|
||||
})
|
||||
|
||||
test.describe('with isolated frames off (the default)', () => {
|
||||
test.describe('with isolated frames turned off', () => {
|
||||
test.use({ orcaAppExtraEnv: { ORCA_PLUGIN_ISOLATED_FRAMES: '0' } })
|
||||
|
||||
test('a plugin panel keeps the srcdoc iframe and is offered no gesture methods', async ({
|
||||
|
||||
Reference in New Issue
Block a user