-
Notifications
You must be signed in to change notification settings - Fork 14
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
In debug mode, commented out script tags are still being run #787
Comments
Is that a JS file or an HTML file? May it be that HTML comments use |
This problem seems to be noted in the top answer in https://stackoverflow.com/questions/28259389/how-to-put-script-in-a-javascript-string |
Nice, replacing |
So we could escape for these lines manually. But is there a way that the build could insert escapes if we find a closing tag within a javascript comment? |
The minification process does escape these, we provide |
Tagging for developer meeting to decide how to proceed. |
Discussed at dev meeting: 09/19/19 We will proceed with this comment here will handle escaping, but would get rid of line comments. If debug builds are used just for assertions then having comments may be helpful. We can use stack trace to track relevant code to the assertion or search for code snippet globally in code. @Denz1994 is assigned and will reference @jonathanolson or @samreid if needed. |
This came up again in phetsims/sherpa#80 during an RC of ESP. Adding the blocks-publication label. |
I'm assuming that this does not block publication of the dev test for Natural Selection, for phetsims/natural-selection#251. @ariel-phet please correct me asap if that's incorrect. |
…t> tags in html comment blocks. See #787.
The debugMinifyOptions in |
I compared the build version before and after the changes, it noticed that after the changes, the debug version is missing all of the code comments. Is there a way to run uglify so that it only runs "inline_script"? |
This reverts commit 65b7959, see phetsims/gravity-and-orbits#345
Thanks @KatieWoe - I discussed this issue with @jonathanolson over slack and he reviewed saying that the changes are safe to proceed with for a publication so I am cherry-picking them to the energy-skate-park-1.1 branch of chipper. Also removing the blocks publication label. |
…t> tags in html comment blocks. See #787.
Over slack @jonathanolson said that the changes are safe, but if people are relying on comments in debug files then we should look into restoring them. Adding to developer meeting to see if anyone is relying on comments in the debug build. |
I am not seeing these errors in ESP rc3 anymore. |
@zepumph: It's not important to me that the code comments are in the debug version. @samreid: I'll see if there's a new version without that. |
I manually escaped the closing tags in the comments of numeric-1.2.6.js, and reverted the changes to the minification process. I noticed this speeds up the builds by about 13 seconds. Before:
After:
This also fixes the formatting: And there are no HTTP requests when starting the debug version of energy skate park. The main part this solution is missing is how to prevent this kind of problem from being reintroduced. Some ideas for that: (a) (lazy, low effort) wait until we see this problem again @Denz1994 can you please review and comment? |
Noting that option b is already (basically) standard for at least one rc in a testing round. I run the debug sim with a fuzz test and the console open for ~10 minutes while testing something else on another device, so that I can catch assertions that might happen. |
Since (b) is basically in place, I think we can close this issue. Thanks! |
Steps to reproduce:
Observe an error like so:
seedrandom is putting this code in the HTML:
And somehow those scripts are running. The bit.ly script redirects to :
The text was updated successfully, but these errors were encountered: