Open Bug 1476867 Opened 6 years ago Updated 2 years ago

Log allocation from content process when DEBUG_ALLOCATIONS is used

Categories

(DevTools :: Framework, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Bug 1423517 introduces DEBUG_ALLOCATIONS=normal|verbose, that logs JS allocations while running mochitests or DAMP. But as-is, it only prints allocations that happenned in the parent process. It doesn't allow debugging leaks/allocations happening in the content process.
Blocks: 1476869
Comment on attachment 8993351 [details] Bug 1476867 - Debug JS allocations on all processes instead of only parent process. https://reviewboard.mozilla.org/r/258130/#review265084 Code analysis found 5 defects in this patch: - 5 defects found by mozlint You can run this analysis locally with: - `./mach lint path/to/file` (JS/Python) If you see a problem in this automated review, please report it here: http://bit.ly/2y9N9Vx ::: devtools/client/shared/test/shared-head.js:100 (Diff revision 1) > // Print allocation count if DEBUG_DEVTOOLS_ALLOCATIONS is set to "normal", > // and allocation sites if DEBUG_DEVTOOLS_ALLOCATIONS is set to "verbose". > const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment); > const DEBUG_ALLOCATIONS = env.get("DEBUG_DEVTOOLS_ALLOCATIONS"); > if (DEBUG_ALLOCATIONS) { > + Services.ppmm.loadProcessScript("data:,new " + function () { Error: Unexpected space before function parentheses. [eslint: space-before-function-paren] ::: devtools/client/shared/test/shared-head.js:101 (Diff revision 1) > // and allocation sites if DEBUG_DEVTOOLS_ALLOCATIONS is set to "verbose". > const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment); > const DEBUG_ALLOCATIONS = env.get("DEBUG_DEVTOOLS_ALLOCATIONS"); > if (DEBUG_ALLOCATIONS) { > + Services.ppmm.loadProcessScript("data:,new " + function () { > + const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm"); Error: 'require' is already declared in the upper scope. [eslint: no-shadow] ::: devtools/client/shared/test/shared-head.js:101 (Diff revision 1) > // and allocation sites if DEBUG_DEVTOOLS_ALLOCATIONS is set to "verbose". > const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment); > const DEBUG_ALLOCATIONS = env.get("DEBUG_DEVTOOLS_ALLOCATIONS"); > if (DEBUG_ALLOCATIONS) { > + Services.ppmm.loadProcessScript("data:,new " + function () { > + const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm"); Error: Cu.import imports into variables and into global scope. [eslint: mozilla/no-import-into-var-and-global] ::: devtools/client/shared/test/shared-head.js:104 (Diff revision 1) > if (DEBUG_ALLOCATIONS) { > + Services.ppmm.loadProcessScript("data:,new " + function () { > + const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm"); > - const { allocationTracker } = require("devtools/shared/test-helpers/allocation-tracker"); > + const { allocationTracker } = require("devtools/shared/test-helpers/allocation-tracker"); > - const tracker = allocationTracker(); > + const tracker = allocationTracker(); > - registerCleanupFunction(() => { > + const Services = require("Services"); Error: 'Services' is already declared in the upper scope. [eslint: no-shadow] ::: devtools/client/shared/test/shared-head.js:115 (Diff revision 1) > + const mode = msg.data; > + Services.cpmm.addMessageListener("debug:allocation:stop", onMessage); > + if (mode == "normal") { > - tracker.logCount(); > + tracker.logCount(); > - } else if (DEBUG_ALLOCATIONS == "verbose") { > - tracker.logAllocationSites(); > + } else if (mode == "verbose") { > + tracker.logAllocationSites({ first : 100 }); Error: Extra space after key 'first'. [eslint: key-spacing]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: