experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(ipc): route about:blank through tile-preload (Cat 4 IZUI fix)

+40 -2
+30 -1
backend/electron/ipc.ts
··· 1135 1135 DEBUG && console.log(`[window-open] cmd-ui window (${cmdUiEntry}): assigned trustedBuiltin tile-preload token`); 1136 1136 } 1137 1137 1138 + // Special-case: about:blank is opened by IZUI tests (and potentially other 1139 + // callers) as an empty child window. Under v1 preload.js, all windows 1140 + // received a preload unconditionally. Now that preload.js is deleted, 1141 + // about:blank gets nothing — window.app is undefined in the renderer. 1142 + // Mint a trustedBuiltin token so tile-preload is injected and window.app 1143 + // is available (matches the same pattern as diagnostic, settings, hud-overlay, cmd-ui). 1144 + if (!tileWebPrefs && url === 'about:blank') { 1145 + const BLANK_ID = 'about-blank'; 1146 + const BLANK_ENTRY = 'main'; 1147 + const blankGrant = createTrustedBuiltinGrant(BLANK_ID); 1148 + const blankToken = generateToken(BLANK_ID, BLANK_ENTRY, blankGrant); 1149 + tileWebPrefs = { 1150 + preload: getTilePreloadPath(), 1151 + additionalArguments: [ 1152 + `--tile-id=${BLANK_ID}`, 1153 + `--tile-entry=${BLANK_ENTRY}`, 1154 + `--tile-token=${blankToken}`, 1155 + ], 1156 + tileId: BLANK_ID, 1157 + entryId: BLANK_ENTRY, 1158 + }; 1159 + DEBUG && console.log('[window-open] about:blank window: assigned trustedBuiltin tile-preload token'); 1160 + } 1161 + 1138 1162 // Canvas page host windows use tile-preload with a trustedBuiltin grant so 1139 1163 // page.js can use api.window.*, api.datastore.*, api.context.*, api.profiles.*, 1140 1164 // api.chromeExtensions.*, api.app.*, api.subscribe/publish, etc. The token is ··· 1212 1236 // they're just the IPC sender. Only content windows count as parents for 1213 1237 // IZUI child-window semantics (ESC closes child, focuses parent). 1214 1238 const openerWindow = BrowserWindow.fromWebContents(ev.sender); 1239 + // Internal/infrastructure windows are not real parents for IZUI child-window semantics. 1240 + // The test-fixture window (peek://test/) is also internal — it acts as bgWindow in tests. 1215 1241 const INTERNAL_URLS = ['peek://app/background.html']; 1242 + const INTERNAL_URL_PREFIXES = ['peek://test/']; 1216 1243 const openerUrl = openerWindow && !openerWindow.isDestroyed() ? openerWindow.webContents?.getURL() ?? '' : ''; 1217 - const isRealParent = openerWindow && !openerWindow.isDestroyed() && !INTERNAL_URLS.some(u => openerUrl === u); 1244 + const isRealParent = openerWindow && !openerWindow.isDestroyed() && 1245 + !INTERNAL_URLS.some(u => openerUrl === u) && 1246 + !INTERNAL_URL_PREFIXES.some(p => openerUrl.startsWith(p)); 1218 1247 1219 1248 // Center window on parent if opener exists and no explicit position 1220 1249 // Priority: explicit x/y > center on parent > center on screen
+8
backend/electron/tile-ipc.ts
··· 92 92 getRunningExtensions, 93 93 getAllRegisteredExtensions, 94 94 reloadExtension, 95 + getWindowInfo, 95 96 } from './main.js'; 96 97 import { 97 98 registerGlobalShortcut, ··· 2575 2576 2576 2577 ipcMain.handle('tile:window:list', async (_event, args: { 2577 2578 token: string; 2579 + includeInternal?: boolean; 2578 2580 }) => { 2579 2581 const grant = getGrantForToken(args.token); 2580 2582 const check = checkWindowAllowed(grant, 'list'); ··· 2590 2592 title: string; 2591 2593 focused: boolean; 2592 2594 visible: boolean; 2595 + params: Record<string, unknown>; 2593 2596 }> = []; 2594 2597 for (const win of BrowserWindow.getAllWindows()) { 2595 2598 if (win.isDestroyed()) continue; 2599 + const info = getWindowInfo(win.id); 2600 + // When includeInternal is false/absent, skip windows without registry 2601 + // entries (e.g. purely internal Electron windows). When true, include all. 2602 + if (!args.includeInternal && !info) continue; 2596 2603 windows.push({ 2597 2604 id: win.id, 2598 2605 url: win.webContents.getURL(), 2599 2606 title: win.getTitle(), 2600 2607 focused: win.isFocused(), 2601 2608 visible: win.isVisible(), 2609 + params: info ? info.params : {}, 2602 2610 }); 2603 2611 } 2604 2612 return { success: true, windows };
+2 -1
backend/electron/tile-preload.cts
··· 565 565 * List open windows. Strict-only — requires `window.query`. In 566 566 * v1-compat mode this falls back to `window-list` for parity. 567 567 */ 568 - list: () => { 568 + list: (opts?: { includeInternal?: boolean }) => { 569 569 if (hasWindowCapability()) { 570 570 return ipcRenderer.invoke('tile:window:list', { 571 571 token: tileToken, 572 + includeInternal: opts?.includeInternal, 572 573 }); 573 574 } 574 575 return ipcRenderer.invoke('window-list', {});