Closed pauljt closed 10 years ago
All rules refactored. Separate tests now for production and test rules. Just needs a little bit of UI cleanup, and maybe a readme update, and this will be ready to merge.
I get "error parsing nfc manager permission. the test is empty for source, testhit and testmiss. According to https://bugzilla.mozilla.org/show_bug.cgi?id=952217#c17 the patch that landed doesn't make it so easy to test if something has nfc-manager, but I'm not sure I get it. Removing this makes things work ;)
The Experiment tab doesn't work completely: We need a button since I find the onkey-thing for the rule field unintuitive :)
Also client/js/rules.js is somehow broken, the check for localStorage exists but everything using localStorage is outside of this. I dont know how this happens but I will fix this separately from this.
Re the empty rule. You get an error, but it still works - the rule parser is error tolerant I hope. THe reason for this is nfc is a difficult permission to scan for. We can remove it for now though.
The experiment tab does work completely, its your brain which is broken ;) But yeh I can add a button if you want.
Actually rule.js and scan.js are basically ready to be removed. My plan was once this is landed, to add a seperate patch which remove the old scan.js and rules js, and renames AcornWalker.js to scan.js
Make sense?
So in pondering how we make more readable rules, I realized that if we can write rules in Javascript use a JS parser (e.g. acorn) to parse rules. This is a work in progress, but currently this PR makes the following changes:
This is awesome since it allows a bunch of cool features:
I'm just refactoring the new rules to use this format, then this will be ready to go.