Skip to content
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

Add mode to throw on invalid prop access, fixes #25 #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dmose
Copy link
Member

@dmose dmose commented Jul 8, 2022

Add mode to throw on invalid property access. In the default mode, everything should stay the same. In the new mode, there are various semantic changes, so we'll need to roll this out to Firefox with care.

Note that this branch is based on https://github.com/mozilla/mozjexl/pull/31/files so that we can actually see whether anything got broken in CI.

@dmose
Copy link
Member Author

dmose commented Jul 8, 2022

Note that the fix for #21 will want to land before this one, at which time I'll rebase this PR. (This has been done).

@dmose dmose force-pushed the error-handling branch 4 times, most recently from e88d7b4 to cd8ea07 Compare July 15, 2022 02:24
@dmose dmose changed the title WIP Add mode to throw on invalid prop access, fixes #25 Add mode to throw on invalid prop access, fixes #25 Jul 15, 2022
@dmose dmose requested a review from brennie July 15, 2022 02:27
@dmose dmose self-assigned this Jul 15, 2022
@dmose dmose force-pushed the error-handling branch 4 times, most recently from 36a21ef to 93db993 Compare October 6, 2022 23:58
lib/evaluator/handlers.js Outdated Show resolved Hide resolved
Copy link
Member

@brennie brennie left a comment

Choose a reason for hiding this comment

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

Sorry I missed this for so long! I guess I haven't opened up my GitHub review queue in a while.

test/evaluator/Evaluator-throw-on-missing-prop-mode.js Outdated Show resolved Hide resolved
lib/evaluator/handlers.js Show resolved Hide resolved
vendor/mozjexl.jsm Outdated Show resolved Hide resolved
lib/evaluator/handlers.js Outdated Show resolved Hide resolved
@dmose dmose requested a review from brennie October 7, 2022 19:03
Copy link
Member

@brennie brennie left a comment

Choose a reason for hiding this comment

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

Minor nits only re: use of var vs const.

Comment on lines +17 to +20
var lexer = new Lexer(grammar);

function toTree(exp) {
var p = new Parser(grammar);
Copy link
Member

Choose a reason for hiding this comment

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

and var here.

return e.eval(toTree("(2 + 3) * 4")).should.become(20);
});
it("should evaluate a string concat", function() {
var e = new Evaluator(grammar, null, null, null, true);
Copy link
Member

Choose a reason for hiding this comment

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

and here etc.

@@ -107,7 +110,7 @@ describe("Evaluator", function() {
});
it("should throw when transform does not exist", function() {
var e = new Evaluator(grammar);
return e.eval(toTree('"hello"|world')).should.reject;
return e.eval(toTree('"hello"|world')).should.be.rejected;
Copy link
Member

Choose a reason for hiding this comment

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

What is the difference here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants