Skip to content

Commit c5bb5a1

Browse files
kleberbaumnetsnek
authored andcommitted
Fix browser workbench errors found via headless Chrome
- Copy desktop workbench JS/CSS from Cursor install (was missing) - 7t: Null-check i.name before .replace() in directory entry filter - 7u: Default {reason} destructuring in UtilityProcessWorker handler - 7v: Default {reason} destructuring in watcher termination handler - 7w: Guard _getInitialData with Array.isArray and null-check updateConflicts - 7x: Fix lZf() URI double-slash when workspaceId is empty - 7y: Null-safe getFullWindowTitle when productService.nameLong is undefined - RPM release bumped to 11
1 parent 3227a3b commit c5bb5a1

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

cursor.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Name: cursor
22
Version: %{cursor_version}
3-
Release: 10.fc43
3+
Release: 11.fc43
44
Summary: Cursor AI Code Editor (ARM64)
55
License: Proprietary
66
URL: https://cursor.sh

patch-cursor-web.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ if [ -d "$CURSOR_OUT" ]; then
100100
vs/workbench/browser/parts/editor/media/forward-tb.png \
101101
vs/workbench/browser/parts/editor/media/logo.png \
102102
vs/workbench/services/extensionManagement/common/media/defaultIcon.png \
103+
vs/workbench/workbench.desktop.main.js \
104+
vs/workbench/workbench.desktop.main.css \
103105
; do
104106
if [ -f "$CURSOR_OUT/$f" ]; then
105107
mkdir -p "$SERVDIR/out/$(dirname "$f")"
@@ -462,6 +464,67 @@ if old in js and 'style="display:none' not in js[js.find(old):js.find(old)+200]
462464
changed = True
463465
print(' update notification suppressed')
464466
467+
# 7t. Fix .replace() on undefined i.name when cleaning up directory entries
468+
old = r'e.filter(i=>!t.has(i.name.replace(/\.[a-z]+$/,"")))'
469+
new = r'e.filter(i=>i.name&&!t.has(i.name.replace(/\.[a-z]+$/,"")))'
470+
if old in js:
471+
js = js.replace(old, new, 1)
472+
changed = True
473+
print(' directory entry i.name null-check patched')
474+
elif new in js:
475+
print(' directory entry i.name already patched')
476+
477+
# 7u. Fix destructuring {reason} from undefined in UtilityProcessWorker termination handler
478+
old = 's.then(({reason:d})=>{d?.code===0?this.logService.trace(`[UtilityProcessWorker]: terminated normally'
479+
new = 's.then(({reason:d}={})=>{d?.code===0?this.logService.trace(`[UtilityProcessWorker]: terminated normally'
480+
if old in js:
481+
js = js.replace(old, new, 1)
482+
changed = True
483+
print(' UtilityProcessWorker reason destructuring patched')
484+
elif '({reason:d}={})' in js and 'UtilityProcessWorker' in js:
485+
print(' UtilityProcessWorker reason already patched')
486+
487+
# 7v. Fix destructuring {reason} from undefined in watcher termination handler
488+
old = 'i.then(({reason:r})=>{r?.code===0?this.trace(`terminated by itself with code ${r.code}, signal: ${r.signal}`):this.onError(`terminated by itself unexpectedly'
489+
new = 'i.then(({reason:r}={})=>{r?.code===0?this.trace(`terminated by itself with code ${r.code}, signal: ${r.signal}`):this.onError(`terminated by itself unexpectedly'
490+
if old in js:
491+
js = js.replace(old, new, 1)
492+
changed = True
493+
print(' watcher reason destructuring patched')
494+
elif '({reason:r}={})' in js and 'terminated by itself' in js:
495+
print(' watcher reason already patched')
496+
497+
# 7w. Fix _getInitialData destructuring non-iterable result (fallback to empty array)
498+
old = 'call("_getInitialData").then(([i,r,s])=>{this.updateStatus(i),this.updateConflicts(r),s&&this.updateLastSyncTime(s)'
499+
new = 'call("_getInitialData").then((_d)=>{const [i,r,s]=Array.isArray(_d)?_d:[];i&&this.updateStatus(i),r&&this.updateConflicts(r),s&&this.updateLastSyncTime(s)'
500+
if old in js:
501+
js = js.replace(old, new, 1)
502+
changed = True
503+
print(' _getInitialData iterable fallback patched')
504+
elif '_d||[]' in js and '_getInitialData' in js:
505+
print(' _getInitialData already patched')
506+
507+
# 7x. Fix lZf() URI path starting with // when workspaceId is empty
508+
old = 'function lZf(n,e,t){return je.from({scheme:wn.vscodeTerminal,path:`/${n}/${e}`'
509+
new = 'function lZf(n,e,t){const _p=n?`/${n}/${e}`:`/${e}`;return je.from({scheme:wn.vscodeTerminal,path:_p'
510+
if old in js:
511+
js = js.replace(old, new, 1)
512+
changed = True
513+
print(' lZf() URI path double-slash fix patched')
514+
elif 'const _p=n?' in js and 'lZf' in js:
515+
print(' lZf() already patched')
516+
517+
# 7y. Fix getFullWindowTitle .replace() on undefined title
518+
old = 'let i=this.getWindowTitle()||this.productService.nameLong;return e&&(i=`${e} ${i}`),t&&(i=`${i} ${t}`),i.replace(/[^\\S ]/g," ")'
519+
new = 'let i=this.getWindowTitle()||this.productService.nameLong||"";return e&&(i=`${e} ${i}`),t&&(i=`${i} ${t}`),i.replace(/[^\\S ]/g," ")'
520+
if old in js:
521+
js = js.replace(old, new, 1)
522+
changed = True
523+
print(' getFullWindowTitle null-safe patched')
524+
elif 'nameLong||""' in js:
525+
print(' getFullWindowTitle already patched')
526+
527+
465528
if changed:
466529
open(f, 'w').write(js)
467530
PATCH_DESKTOP_EOF

0 commit comments

Comments
 (0)