Skip to content

RES-Slim v0.3.8 — settingsNavigation click handler and URL parser fixes

Choose a tag to compare

@SysAdminDoc SysAdminDoc released this 11 Apr 22:46

Five real bug fixes to settingsNavigation. These were sitting uncommitted in the working tree (work-in-progress from a prior session) and got triaged as part of the v0.3.7 audit cycle — the four original fixes are solid, plus one additional regression I caught during verification.

Fixed

Click interceptor

  1. Modifier clicks — the click handler previously only respected ctrlKey, so cmd-click (macOS), shift-click, and alt-click on a settings link would still intercept and open the console instead of honoring the modifier's native behavior (open in new tab, etc.). Now checks all four modifier keys.

  2. Nested click targets — the old check e.target instanceof HTMLAnchorElement broke if the user clicked an icon or span inside a settings link. Now walks up via e.target.closest('a').

  3. target="_blank" anchors — the interceptor now skips anchors that explicitly opt into a new tab. Previously those got hijacked into the embedded console.

parseHash / makeUrlHash

  1. Proper URL encoding — the old code used a regex match + literal %20 string replace, which only handled spaces and broke on any other URL-encoded character. Now uses encodeURIComponent / decodeURIComponent for a proper round-trip. Also internally normalizes the legacy #!settings prefix so both old and new links parse to the same result.

  2. Prefix match vs substring match — [caught during verification against the existing test URLs]. The initial fix sliced the hash at position 14 (length of #res:settings), so a URL like #res:settings-redirect-standalone-options-page/accountSwitcher (a distinct test-harness route that happens to share #res:settings as a literal prefix) was getting parsed with -redirect-standalone-options-page as the moduleID. Fixed by requiring the prefix to be followed by / or end-of-string before treating the remainder as a path.

Verified with

Edge-case test harness in a node one-liner:

"#res:settings"                                                   => {}
"#res:settings/"                                                  => {}
"#res:settings/commentHighlights"                                 => {"moduleID":"commentHighlights"}
"#res:settings/commentHighlights/color"                           => {"moduleID":"commentHighlights","optionKey":"color"}
"#res:settings/commentHighlights/expire%20days"                   => {"moduleID":"commentHighlights","optionKey":"expire days"}
"#!settings/autoExpand"                                           => {"moduleID":"autoExpand"}
"#!settings"                                                      => {}
"#something-else"                                                 => {}
""                                                                => {}
"#res:settings-redirect-standalone-options-page/accountSwitcher"  => {}

All cases return the expected result — URL encoding round-trips (expire%20daysexpire days), both hash styles parse, and the prefix-substring trap returns empty instead of a bogus moduleID.

Not shipped in this release

The tests/settingsConsole.js diff is still uncommitted. It's a mechanical selector refresh (#moduleOptionsSave#RESGlobalSave, workspaceStageStatusRESGlobalStageBar, .optionsSaved.is-saved) plus two new tests — but it references upstream RES modules (accountSwitcher, keepLoggedIn, quickMessage, wheelBrowse) that were stripped from RES-Slim in v0.1.0. Shipping the selector sync on tests that can't actually run against this private fork would just propagate stale fixtures. Those tests need a separate rewrite against modules that actually exist in RES-Slim; out of scope for a bug-fix release. There's also no CI wiring, so they're never executed regardless.

Install

CRX (signed, auto-updates from prior RES-Slim CRX installs — same extension ID)

Download res-slim-chrome-v0.3.8.crx and drag into chrome://extensions with Developer mode enabled.

Zip (unpacked)

Download RES-Slim-v0.3.8-chrome.zip, extract, and load unpacked from chrome://extensions.

Verification

  • yarn once clean
  • yarn eslint lib/modules/settingsNavigation.js clean
  • yarn stylelint clean
  • npx flow check: 0 errors