fix(worker)!: remove dead highlight-load-lang code path#5198
Conversation
|
@copilot see the CI error about the commit message. Can you fix that please? |
Done in commit Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Can you fix the lint error from ci? |
Fixed in commit |
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ad-lang Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Agent-Logs-Url: https://github.com/speced/respec/sessions/eaf97df3-cfd4-4999-92cf-047f0b3b3ca4 Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
The highlight-load-lang action is unused by production code (see #4934). The same-origin check added by Copilot Autofix was broken in blob workers (self.location.origin is "null"), silently breaking the only remaining consumer. Remove the dead code instead of hardening it.
2799fd9 to
c9a2e1c
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the ReSpec web worker script with the goal of addressing a security finding around importScripts() usage in the highlighting worker.
Changes:
- Bumps the worker version header comment to v1.1.0.
- Simplifies the worker
messagehandler to only process the"highlight"action (removing the"highlight-load-lang"branch).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot can you check and fix the ci issues? |
Agent-Logs-Url: https://github.com/speced/respec/sessions/78a14774-8331-43c0-b95e-83e38a6bd570 Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Fixed in commit |
|
@copilot rebase |
# Conflicts: # tests/spec/core/highlight.html # worker/respec-worker.js Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Done in commit |
|
Merging this as a hot fix, as it doesn't touch any code, but addresses the CI issue. |
|
oh, no, wait!... it does touch code. I misread it on my phone. |
… optional chain - Remove Object.assign clone (structured clone already provides fresh data) - Early return for non-highlight actions (don't echo unknown messages) - Add optional chain on data.languages for robustness
There was a problem hiding this comment.
Pull request overview
This PR removes a long-dead worker message/action (highlight-load-lang) from ReSpec’s syntax-highlighting worker, along with the associated test fixture that exercised that path.
Changes:
- Remove the
"highlight-load-lang"message handler fromworker/respec-worker.js, leaving the worker to handle only"highlight"requests. - Delete the test HTML/fixture JS that posted
"highlight-load-lang"to the worker. - Drop the spec test that asserted remote/custom language loading via that removed action.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| worker/respec-worker.js | Deletes the dead "highlight-load-lang" branch and simplifies the message handler to only process "highlight". |
| tests/support-files/hljs-testlang.js | Removes the now-unused custom highlight language fixture. |
| tests/spec/core/highlight.html | Removes the spec fixture document that posted "highlight-load-lang" to the worker. |
| tests/spec/core/highlight-spec.js | Removes the spec test that depended on "highlight-load-lang" to register a remote language. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@sidvishnoi this one is high priority — it removes the flaky CDN highlight test that's failing CI on 4+ other PRs. Clean dead code removal (per #4934). Would appreciate a quick look when you get a chance. |
sidvishnoi
left a comment
There was a problem hiding this comment.
LGTM. Marked as breaking change (!) in PR title.
Merge latest main which removes dead highlight-load-lang code path (#5198). The highlight.html fixture that our branch updated to use document.respec.worker has been deleted on main as dead code. Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Summary
highlight-load-langaction from the workerself.location.originis"null"), so removing the dead code is the correct fixTest plan
Modified Web platform tests— no observable behavior change (dead code removal)