You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is needed for full functionality in Github's current release, and probably fixes other sites. Unfortunately it also seems to have been fixed by the frontend binding rewrite that is the crux of #533.
In Parser.cpp, look at lines 4585 and 4791. Then, in BytecodeEmitter.cpp, fix the assertions in lines 5499 and remove the assertion at 5521. This should be enough to get const treated as let which should have similar enough semantics for a first pass. However, this is too risky to put in FPR12.
ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js: rc = 3, run time = 0.723338
1146644: Don't crash compiling a non-body-level for-loop whose loop declaration is a const
ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js:95:3 Error: Assertion failed: got false, expected true: unexpected error: expected SyntaxError, got Error: Congratulations on making for (const & in/of &) work! Please remove the try/catch and this throw.
Stack:
@ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js:95:3
ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js: rc = 3, run time = 1.333542
1146644: Don't crash compiling a non-body-level for-loop whose loop declaration is a const
ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js:95:3 Error: Assertion failed: got false, expected true: unexpected error: expected SyntaxError, got Error: Congratulations on making for (const & in/of &) work! Please remove the try/catch and this throw.
Stack:
@ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js:95:3
js1_8_5/reflect-parse/for-loop-destructuring.js: rc = 3, run time = 1.013104
js1_8_5/reflect-parse/PatternAsserts.js:92:11 Error: expected SyntaxError for "for (const x in foo);"
Stack:
assertError@js1_8_5/reflect-parse/PatternAsserts.js:92:11
test@js1_8_5/reflect-parse/for-loop-destructuring.js:29:1
runtest@js1_8_5/reflect-parse/shell.js:59:9
@js1_8_5/reflect-parse/for-loop-destructuring.js:51:1
js1_8_5/reflect-parse/for-loop-destructuring.js: rc = 3, run time = 5.893012
js1_8_5/reflect-parse/PatternAsserts.js:92:11 Error: expected SyntaxError for "for (const x in foo);"
Stack:
assertError@js1_8_5/reflect-parse/PatternAsserts.js:92:11
test@js1_8_5/reflect-parse/for-loop-destructuring.js:29:1
runtest@js1_8_5/reflect-parse/shell.js:59:9
@js1_8_5/reflect-parse/for-loop-destructuring.js:51:1
No offense, but I don't make one-offs since we don't have continuous integration and builds are lengthy (and they're too large to attach here anyway). The patch above is essentially what's on tree, so you could do it off the FPR14 tag with that added.
Since the latest attempt at #521 ended in failure again, and this might add some partial functionality on some sites, we'll try it (with test fixes) for FPR15.
This is now causing github to go into infinite errors, essentially seizing the browser (primarily on issues) due to an uncaught check op. I removed this op as a temporary measure but this makes the hack even more disgusting since const will be valid to assign to pretty much anywhere. It will also break a lot of tests. I haven't thought of a better way around it.
Maybe, except the check op is generated in the frontend bytecode emitter, so a previously compiled script wouldn't change its behaviour. (Conversely, it would be highly impractical (and slow) to actually make the check during execution depend on a runtime setting, so this would have to live in the frontend if I did it at all.)
Activity
classilla commentedon Jan 12, 2019
In
Parser.cpp, look at lines 4585 and 4791. Then, inBytecodeEmitter.cpp, fix the assertions in lines 5499 and remove the assertion at 5521. This should be enough to getconsttreated asletwhich should have similar enough semantics for a first pass. However, this is too risky to put in FPR12.roytam1 commentedon Jan 23, 2019
so these changes "hackfixes"
for(const x in y)problems:and now complaining async/await keyword.
xref: #521
hack: treat `const` in `for(const x in y)` as `let`.
classilla commentedon Feb 6, 2019
This isn't worth it, might regress other code, and doesn't fix enough to get Github working properly. Wontfixing for TenFourFox.
classilla commentedon Mar 16, 2019
If we can get async functions working, we might reexamine this hack.
classilla commentedon May 7, 2019
This may also fix Discord, see https://tenfourfox.tenderapp.com/discussions/problems/8804-discord-problem
classilla commentedon May 18, 2019
This enables login to Discord, but now it just "crashes" (the page complains Discord has crashed). Changing the user agent makes no difference.
classilla commentedon May 21, 2019
There are various failures, but they aren't unexpected:
/Volumes/BruceDeuce/src/tenfourfox/js/src/jit-test/tests/parser/letContextualKeyword.js:7:5 Error: Assertion failed: got false, expected true
Stack:
expectError@/Volumes/BruceDeuce/src/tenfourfox/js/src/jit-test/tests/parser/letContextualKeyword.js:7:5
@/Volumes/BruceDeuce/src/tenfourfox/js/src/jit-test/tests/parser/letContextualKeyword.js:21:1
ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js: rc = 3, run time = 0.723338
1146644: Don't crash compiling a non-body-level for-loop whose loop declaration is a const
ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js:95:3 Error: Assertion failed: got false, expected true: unexpected error: expected SyntaxError, got Error: Congratulations on making for (const & in/of &) work! Please remove the try/catch and this throw.
Stack:
@ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js:95:3
ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js: rc = 3, run time = 1.333542
1146644: Don't crash compiling a non-body-level for-loop whose loop declaration is a const
ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js:95:3 Error: Assertion failed: got false, expected true: unexpected error: expected SyntaxError, got Error: Congratulations on making for (const & in/of &) work! Please remove the try/catch and this throw.
Stack:
@ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js:95:3
js1_8_5/reflect-parse/for-loop-destructuring.js: rc = 3, run time = 1.013104
assertError@js1_8_5/reflect-parse/PatternAsserts.js:92:11
test@js1_8_5/reflect-parse/for-loop-destructuring.js:29:1
runtest@js1_8_5/reflect-parse/shell.js:59:9
@js1_8_5/reflect-parse/for-loop-destructuring.js:51:1
js1_8_5/reflect-parse/PatternAsserts.js:92:11 Error: expected SyntaxError for "for (const x in foo);"
Stack:
assertError@js1_8_5/reflect-parse/PatternAsserts.js:92:11
test@js1_8_5/reflect-parse/for-loop-destructuring.js:29:1
runtest@js1_8_5/reflect-parse/shell.js:59:9
@js1_8_5/reflect-parse/for-loop-destructuring.js:51:1
js1_8_5/reflect-parse/for-loop-destructuring.js: rc = 3, run time = 5.893012
assertError@js1_8_5/reflect-parse/PatternAsserts.js:92:11
test@js1_8_5/reflect-parse/for-loop-destructuring.js:29:1
runtest@js1_8_5/reflect-parse/shell.js:59:9
@js1_8_5/reflect-parse/for-loop-destructuring.js:51:1
js1_8_5/reflect-parse/PatternAsserts.js:92:11 Error: expected SyntaxError for "for (const x in foo);"
Stack:
assertError@js1_8_5/reflect-parse/PatternAsserts.js:92:11
test@js1_8_5/reflect-parse/for-loop-destructuring.js:29:1
runtest@js1_8_5/reflect-parse/shell.js:59:9
@js1_8_5/reflect-parse/for-loop-destructuring.js:51:1
classilla commentedon May 29, 2019
No offense, but I don't make one-offs since we don't have continuous integration and builds are lengthy (and they're too large to attach here anyway). The patch above is essentially what's on tree, so you could do it off the FPR14 tag with that added.
classilla commentedon Jun 16, 2019
Since the latest attempt at #521 ended in failure again, and this might add some partial functionality on some sites, we'll try it (with test fixes) for FPR15.
#541: hack for(const x in y) with test changes
classilla commentedon Jul 21, 2019
Leaving open while I ponder if more work is needed.
classilla commentedon Oct 29, 2019
This is now causing github to go into infinite errors, essentially seizing the browser (primarily on issues) due to an uncaught check op. I removed this op as a temporary measure but this makes the hack even more disgusting since
constwill be valid to assign to pretty much anywhere. It will also break a lot of tests. I haven't thought of a better way around it.roytam1 commentedon Oct 29, 2019
maybe create a pref to change behavior in runtime?
classilla commentedon Oct 29, 2019
Maybe, except the check op is generated in the frontend bytecode emitter, so a previously compiled script wouldn't change its behaviour. (Conversely, it would be highly impractical (and slow) to actually make the check during execution depend on a runtime setting, so this would have to live in the frontend if I did it at all.)
#541: temporary workaround for infinite errors on github
#541: more disgusting hacks to fix jsfiddle