mozjexl: Accessing attribute on empty filter expression causes "TypeError: b is undefined" error
Categories
(Firefox :: Normandy Client, defect, P3)
Tracking
()
People
(Reporter: cpeterson, Unassigned)
References
(Depends on 1 open bug)
Details
Comment 1•6 years ago
|
||
Comment 2•6 years ago
|
||
Comment hidden (offtopic) |
Updated•6 years ago
|
Updated•6 years ago
|
Comment 5•6 years ago
|
||
:mythmon, is this issue still outstanding? Trying to reproduce it using this code in the Browser Console:
ChromeUtils.import("resource://normandy/lib/RecipeRunner.jsm");
ChromeUtils.import("resource://gre/modules/components-utils/FilterExpressions.jsm");
let ctx = RecipeRunner.getFilterContext({});
let s = "normandy.channel == 'nightly' && normandy.version >= '63' && normandy.os.isWin && normandy.os.winVersion == 10.0 && normandy.telemetry.main.environment.system.gfx.adapters[.vendorID == '0x10de'].vendorID == '0x10de'";
FilterExpressions.eval(s, ctx).then(console.log.bind(console));
... which produces false
. I tried some other explicitly-undefined expressions:
FilterExpressions.eval("hi.buddy == true", ctx).then(console.log.bind(console));
FilterExpressions.eval("hi.buddy[.vendorId == true]", ctx).then(console.log.bind(console));
This just produces undefined
. I see that https://github.com/mozilla/mozjexl/commit/94e7463958983e8ca188c86017145827ad90f2f1#diff-098f6bcd4621d373cade4e832627b4f6 landed a while ago, and it seems like it's meant to address this kind of problem, but as far as I can tell, we never picked up that change in Firefox. If there's a case here that mozjexl is failing on, could you please provide an example of it? Or is this issue about bringing the new mozjexl into the Firefox source tree?
Comment 6•6 years ago
|
||
It seems like the error depends on all of:
- doing filtering (
[.foo]
) - on a defined object
- and then accessing a field on it
To that end, this code reproduces the problem for me:
ChromeUtils.import("resource://normandy/lib/RecipeRunner.jsm");
ChromeUtils.import("resource://gre/modules/components-utils/FilterExpressions.jsm");
let ctx = RecipeRunner.getFilterContext({});
let s = "normandy[.foo].bar";
FilterExpressions.eval(s, ctx).then(console.log.bind(console), console.log.bind(console, "error"));
Comment 7•6 years ago
|
||
I have filed https://github.com/mozilla/mozjexl/pull/20 to try to address the issue.
Comment 8•6 years ago
|
||
The above-mentioned PR has been merged, but there's no process available to rebuild the vendored toolkit/components/utils/mozjexl.js
. This bug therefore depends on one of https://bugzilla.mozilla.org/show_bug.cgi?id=1520362 or https://github.com/mozilla/mozjexl/issues/21.
Updated•6 years ago
|
Updated•2 years ago
|
Description
•