-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add polymer-resin API to enable migration and custom report handling.
YT would like to be able to use goog.log instead of the JS dev console. The report handler API enables that, without pulling goog.log in for the standalone compiled version. In the getting-started docs, I need a story to explain how to get telemetry about false positives. When migrating an app, one might do var polymerResinDebugTelemetry = {}; // Allow application to progress as normal so we can exercise // as much of the API as possible without working around problems // caused by false positives. // HACK: DO NOT SUBMIT. security.polymer_resin.UNSAFE_passThruDisallowedValues(true); // Collect violation counts in a table instead of logging. security.polymer_resin.setReportHandler( function (isDisallowedValue, fmtString, optContextNodeName, optNodeName, optAttrName, optValue, var_args) { if (isDisallowedValue) { var key = optContextNodeName + ' : ' + optNodeName + ' : ' + optAttrName; polymerResingDebugTelemetry[key] = (polymerResingDebugTelemetry[key] || 0) + 1; } }); // Can be called from console. function dumpPolymerResinDebugTelemetry() { console.log(JSON.stringify(polymerResinDebugTelemetry, null, 2)); } The report handler API can also be used to feed violations during production back to the server for later investigation. Tested: I have not added tests for the new APIs. I ran existing test suite to test default behavior. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=157109206
- Loading branch information
1 parent
921e579
commit ce8c3b3
Showing
3 changed files
with
160 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.