aequery
aequery copied to clipboard
aeq.extend throwing `reflect is read only` error, sometimes
Description:
Certain scripts change the DOM in some way such that aeq.extend throws reflect is read only error.
Steps to reproduce:
- Run an offending script (specific known examples: lipsyncr v2.7, early versions of Motion, textsyncr v1.6). Unsure whether any are using aeq.
- Run a script running aeq
- aeq.extend throws
reflect is read onlyerror
Workaround:
- Restart AE to clear DOM environment
- launch panels in reverse error, so that aeq tool loads first
The error is on this line specifically: https://github.com/aenhancers/aequery/blob/66f66cfb2a4788175c77797e7a6680da15c2a462/lib/main.js#L173
I'm unsure what these other scripts are changing in the DOM to cause this error; not sure how best to diagnose, either.
Can add a try/catch around this line, but that feels like not the best solution here.
A try/catch isn't ideal but you can be selective about it. You can do that for just the reflect error and re-throw if it's something else. That way you aren't swallowing everything. Something similar to this...
try {
target[name] = copy;
}
catch(e) {
var isReflectErrorCausedByOtherScriptsMutatingTheDom = (e.message === 'reflect is read only');
if (!isReflectErrorCausedByOtherScriptsMutatingTheDom) {
// See https://github.com/aenhancers/aequery/issues/58 for context on why this is here.
throw e;
}
}