Skip to content

[26.0] Wrap webhook scripts in IIFE to prevent redeclaration errors#22320

Open
mvdbeek wants to merge 2 commits intogalaxyproject:release_26.0from
mvdbeek:fix_webhook_script_redeclaration
Open

[26.0] Wrap webhook scripts in IIFE to prevent redeclaration errors#22320
mvdbeek wants to merge 2 commits intogalaxyproject:release_26.0from
mvdbeek:fix_webhook_script_redeclaration

Conversation

@mvdbeek
Copy link
Copy Markdown
Member

@mvdbeek mvdbeek commented Mar 31, 2026

Fixes SyntaxError: redeclaration of let tries in Firefox when webhook scripts are injected more than once via appendScriptStyle.

Fixes #22319

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

Fixes SyntaxError: redeclaration of let tries in Firefox when
webhook scripts are injected more than once via appendScriptStyle.

Fixes https://sentry.galaxyproject.org/organizations/galaxy/issues/293105/
@mvdbeek mvdbeek changed the base branch from dev to release_26.0 March 31, 2026 12:28
@github-actions github-actions bot added this to the 26.1 milestone Mar 31, 2026
@github-actions github-actions bot changed the title Wrap webhook scripts in IIFE to prevent redeclaration errors [26.0] Wrap webhook scripts in IIFE to prevent redeclaration errors Mar 31, 2026
@mvdbeek mvdbeek requested a review from dannon April 1, 2026 11:00
Without the newlines, a webhook script ending in a line comment
(// ...) would swallow the closing })(); and produce a SyntaxError.
Copy link
Copy Markdown
Member

@dannon dannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a minor tweak dealing with a corner case of scripts ending in a line comment -- without newlines around the IIFE body, the closing })(); gets swallowed by the comment. Looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

SyntaxError: Failed to execute 'appendChild' on 'Node': Identifier 'enableDebug' has already been declared

2 participants