In startSES.js, we have the following function which normalizes the
mitigation options. If it is passed null/undefined, parseFunctionBody will
be true, but if it is passed {}, parseFunctionBody will be false. Why?
The context of this question is that I was considering using the sourceUrl
option where it was not previously present, and doing so will currently
change other behavior unless I override that option.
function resolveOptions(opt_mitigateOpts) {
function resolve(opt, defaultOption) {
return (opt_mitigateOpts && opt in opt_mitigateOpts) ?
opt_mitigateOpts[opt] : defaultOption;
}
var options = {};
if (opt_mitigateOpts === undefined || opt_mitigateOpts === null) {
options.maskReferenceError = true;
options.parseFunctionBody = true;
options.sourceUrl = void 0;
options.rewriteTopLevelVars = true;
options.rewriteTopLevelFuncs = true;
options.rewriteFunctionCalls = true;
options.rewriteTypeOf = false;
options.forceParseAndRender = false;
} else {
options.maskReferenceError = resolve('maskReferenceError', true);
options.parseFunctionBody = resolve('parseFunctionBody', false);
options.sourceUrl = resolve('sourceUrl', void 0);
options.rewriteTopLevelVars = resolve('rewriteTopLevelVars', true);
options.rewriteTopLevelFuncs = resolve('rewriteTopLevelFuncs', true);
options.rewriteFunctionCalls = resolve('rewriteFunctionCalls', true);
options.rewriteTypeOf = resolve('rewriteTypeOf',
!options.maskReferenceError);
options.forceParseAndRender = resolve('forceParseAndRender', false);
}
return options;
}
--
---
You received this message because you are subscribed to the Google Groups
"Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.