For #13959 - review: add clarifying comments.

pull/216/head
Michael Comella 4 years ago committed by Michael Comella
parent 50959d997e
commit 3e96f6b385

@ -122,6 +122,9 @@ class StrictModeManager(
// quintillion times in a build config where StrictMode is enabled so we don't handle it
// because it'd increase complexity.
suppressionCount += 1
// We log so that devs are more likely to notice that we're suppressing StrictMode violations.
// We add profiler markers so that the perf team can easily identify IO locations in profiles.
logger.warn("StrictMode violation suppressed: #$suppressionCount")
if (Thread.currentThread() == mainLooper.thread) { // markers only supported on main thread.
components.core.engine.profiler?.addMarker("StrictMode.suppression", "Count: $suppressionCount")

@ -52,6 +52,8 @@ class MozillaStrictModeSuppression(config: Config) : Rule(config) {
val receiver = expression.parent?.firstChild?.node?.chars
val calledMethod = expression.calleeExpression?.firstChild?.node?.chars
// This won't catch if setVmPolicy is imported directly. However, this is unlikely so let's
// not handle it now. Maybe we can add it when we add tests for this file.
if (receiver == "StrictMode") {
val violationMsg = when (calledMethod) {
"setThreadPolicy" -> VIOLATION_MSG

Loading…
Cancel
Save