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
Fix failing with trailing comments in scripts #2674
Fix failing with trailing comments in scripts #2674
Conversation
When a user script had a trailing comment it would comment out part of the eval string. Catch them so they don't interfere.
src/user-script-obj.js
Outdated
(function scopeWrapper(){ | ||
function userScript() { | ||
${this._content} | ||
/* catch open comment blocks */ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A) I prefer full/grammatical sentences in comments
B) Something like /* Force a line break after
_content in case its final line contains a line comment. /*
seems much more useful; just "catch open comment blocks" is so terse as to be hard to understand later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. Will adjust.
src/user-script-obj.js
Outdated
@@ -249,7 +249,11 @@ window.EditableUserScript = class EditableUserScript | |||
// of the generated parts. | |||
this._evalContent | |||
// Note intentional lack of line breaks before the script content. | |||
= `try { (function scopeWrapper(){ function userScript() { ${this._content} } | |||
= `try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the comment on the line above.
Adding a line after _content
is good to fix this bug. Adding lines above it makes the lines in reported errors harder to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed that. I'll submit a commit the removes the lines.
This fix is in Version 4.1beta4. Testing to confirm the fix is appreciated! https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/versions/beta?page=1#version-4.1beta4 |
See #2670
When a user script had a trailing comment it would comment out part
of the eval string. Catch them so they don't interfere.