@glittering0717/ai-browser 2.1.15 → 2.1.16
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/package.json +1 -1
- package/src/main/page_manager.js +22 -33
- package/src/shared/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glittering0717/ai-browser",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.16",
|
|
4
4
|
"description": "AI-native browser — renders pixels for humans, structured semantic-tree API for agents. No screenshots, no OCR, no coordinate guessing.",
|
|
5
5
|
"main": "src/main/index.js",
|
|
6
6
|
"bin": {
|
package/src/main/page_manager.js
CHANGED
|
@@ -707,7 +707,10 @@ class PageManager {
|
|
|
707
707
|
} catch (e) {
|
|
708
708
|
return this._navigateFailure(e, view, tid, waitUntil);
|
|
709
709
|
}
|
|
710
|
-
|
|
710
|
+
// 这里**不做**重绘(2026-10-25 修)。以前每次 navigate 结束都调 repaint(),
|
|
711
|
+
// 而 repaint() 走 webContents.invalidate() —— 在新页面刚出现的那一刻强制整页
|
|
712
|
+
// 重栅格化,合成器会先把画面按初始尺寸画一遍再缩放,用户看到的就是
|
|
713
|
+
// "先缩成一小块、闪一下、然后正常"。导航本身会正常出帧,不需要我们推。
|
|
711
714
|
if (waitUntil === 'load') return { ok: true, waited_for: 'load' };
|
|
712
715
|
// load 还没来是**正常**的(SPA 本来就不 fire load)。如实说明,并给出
|
|
713
716
|
// 下一步:调用方需要等某个具体内容时该用 ui.wait,而不是等 load。
|
|
@@ -3434,19 +3437,20 @@ return {ok:true,name:file.name,size:file.size,via:via,host_sel:hostSel,clicked:c
|
|
|
3434
3437
|
// so did-finish-load has already fired and repainted an empty shell.
|
|
3435
3438
|
// did-navigate — any cross-document navigation, including programmatic
|
|
3436
3439
|
// location.href assignment the app does on its own.
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3440
|
+
// ⚠️ 导航事件**不挂任何重绘**(2026-10-25 修)。
|
|
3441
|
+
//
|
|
3442
|
+
// 历史:这条钩子是为了对付"页面已导航但窗口还显示旧画面",手段是
|
|
3443
|
+
// removeBrowserView + addBrowserView(后来换成 invalidate)。但两者都有代价:
|
|
3444
|
+
// remove/add 会闪一帧白;invalidate() 更麻烦 —— 它强制整页重新栅格化,
|
|
3445
|
+
// 而在导航刚开始的那一刻,图层的尺寸还是初始值,于是合成器会先把新页面画进
|
|
3446
|
+
// 一个小尺寸 surface 再缩放显示:用户看到的就是"先缩成左上角一小块,闪一下,
|
|
3447
|
+
// 然后正常"(2026-10-25 用户报"刷新 baidu 总是一闪一闪")。
|
|
3448
|
+
//
|
|
3449
|
+
// 现代 Chromium 在正常情况下不会留旧画面;真留住了也有兜底:
|
|
3450
|
+
// - 白屏/缩放自检(_auditPaint)会判 scale-mismatch 并**定向**重绘
|
|
3451
|
+
// - ui.repaint 显式重绘
|
|
3452
|
+
// - 几何变化由 afterGeometryChange 负责收敛
|
|
3453
|
+
// 所以这里什么都不挂。回归:npm run layout 的 G5 断言"一次导航不引发任何重绘"。
|
|
3450
3454
|
|
|
3451
3455
|
this._attachLoadFailureHooks(tabId, view);
|
|
3452
3456
|
// "画出来了没有"只能主动看(没有对应事件),"渲染进程崩了"要自己救
|
|
@@ -3536,27 +3540,12 @@ return {ok:true,name:file.name,size:file.size,via:via,host_sel:hostSel,clicked:c
|
|
|
3536
3540
|
* Idempotent per tab: re-registering would schedule redundant remove/add
|
|
3537
3541
|
* cycles, so a WeakSet of hooked views guards it.
|
|
3538
3542
|
*/
|
|
3539
|
-
_attachRepaintHooks(tabId, view) {
|
|
3540
|
-
if (!view || !view.webContents || view.webContents.isDestroyed()) return;
|
|
3541
|
-
if (!this._repaintHooked) this._repaintHooked = new WeakSet();
|
|
3542
|
-
if (this._repaintHooked.has(view)) return;
|
|
3543
|
-
this._repaintHooked.add(view);
|
|
3544
|
-
const repaint = () => { this._scheduleRepaint(tabId); };
|
|
3545
|
-
view.webContents.on('dom-ready', repaint);
|
|
3546
|
-
view.webContents.on('did-finish-load', repaint);
|
|
3547
|
-
view.webContents.on('did-navigate', repaint);
|
|
3548
|
-
view.webContents.on('did-navigate-in-page', repaint);
|
|
3549
|
-
view.webContents.on('did-frame-finish-load', repaint);
|
|
3550
|
-
}
|
|
3551
|
-
|
|
3552
3543
|
/**
|
|
3553
|
-
*
|
|
3554
|
-
*
|
|
3555
|
-
* hundred ms; a load like ComfyUI's fires dozens of did-frame-finish-load.
|
|
3556
|
-
* Without coalescing that is dozens of remove/add cycles — visible flicker
|
|
3557
|
-
* and wasted compositing work. Debounce ~120ms: late enough to collapse the
|
|
3558
|
-
* burst, early enough that the user sees the new view essentially at once.
|
|
3544
|
+
* 已废弃:以前用来给"后来才导航的 tab"补挂重绘钩子。现在导航事件一律不重绘
|
|
3545
|
+
* (原因见 newTab 里的长注释),这里只留一个空实现,避免调用点报错。
|
|
3559
3546
|
*/
|
|
3547
|
+
_attachRepaintHooks() {}
|
|
3548
|
+
|
|
3560
3549
|
_scheduleRepaint(tabId, delay = 120) {
|
|
3561
3550
|
const prev = this._repaintTimers.get(tabId);
|
|
3562
3551
|
if (prev) clearTimeout(prev);
|
package/src/shared/version.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
// Kept in JS (not imported from package.json) to avoid Node import-attribute
|
|
3
3
|
// (JSON module) compatibility issues inside Electron. package.json "version"
|
|
4
4
|
// is manually synced to this value; tests assert they match.
|
|
5
|
-
export const VERSION = '2.1.
|
|
5
|
+
export const VERSION = '2.1.16';
|