-
Notifications
You must be signed in to change notification settings - Fork 38
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
TypeError: Cannot read properties of undefined (reading \'type\') #211
Comments
@mozfreddyb I gathered some additional details from the service-worker.js file that @diox shared privately with me to help investigating this and determine what should be the correct way on handling these cases, let me know if you need some other details that may be useful to investigate this bug and that I may have missed to mention explicitly in this comment. The issue is triggered due to the use of the spread operator in a call to insertAdjacentHTML, which per config will be trying to validate for safety the second argument of the insertAdjacentHTML calls:
[
Node {
type: 'SpreadElement',
start: ...,
end: ..,
loc: [SourceLocation],
range: [Array],
argument: [Node],
parent: [Node]
}
] To be totally fair, the same error would also be triggered if a call to insertAdjacentHTML doesn't have a second argument, and so currently the following two also trigger the same exception:
I'm not sure if we would want to add variable tracing along with fixing this bug, but in the meantime I collected some more details in case we want to consider that: -If
and so in theory we may even consider to track back the variable and if it is a literal array then we may be able to confirm if the second |
That's extremely useful. I'll get to it first thing tomorrow. |
So, fixing this error is easy. But satisfying all of your requirements is a bit complicated. We can't try and find some close-ish declaration of arrays for spread-statements, but we'll lose context for most variables relatively easily. Again, as per our threat model we do not care nor should we complain about code that is minified/obfuscated. I can do some backtracing, but the code will give up relatively soon. Either way, I'll have a patch ready sometime this week. |
Should we have a release with the fix, or are we waiting for a fix for #214 as well ? |
We saw the following error happen in production (sentry traceback) when validating an add-on through the linter:
I'll try to grab the add-on it occurred on if I can...
The text was updated successfully, but these errors were encountered: