-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap all JavaScript in an Immediately-Invoked Function Expression #19
Conversation
This ensures that variables declared in the script do not alter the enclosing scope. Yes, JavaScript is a bad language.
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2025010404-4.3&flavor=pull-requests Test run included the following:
New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2024111705-4.3&flavor=update
Failed tests22 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/119126#dependencies 3 fixed
Unstable tests
|
None of the upstream scripts in there have constructs like this, and documentation doesn't recommend it either. Does this PR fixes some specific issue? |
No, this PR does not fix any specific issue. There was either a comment or a past commit message mentioning that variable scope was unclear, and this does fix that. The purpose is to prevent future changes from shadowing or clobbering some critical variable and introducing a bug that would be extremely hard to track down. |
Plasma people said each script gets isolated scope, so this is not needed. |
That is great! Do you have a link to the discussion @marmarek? |
A question on the plasma matrix channel, I believe you are there too. |
I have no idea how to open this link (on a desktop client), but this is the message link: https://matrix.to/#/!gYaaEyvNWxTzXssOmq:kde.org/$4sVVYWLfQ1NcgslQJvy7wpnUw1gHA8sv90OgAy5Fyro?via=matrix.org&via=kde.org&via=im.kde.org |
This ensures that variables declared in the script do not alter the enclosing scope. Yes, JavaScript is a bad language.