Open Bug 1056182 Opened 11 years ago Updated 3 years ago

Add window.internals debug functions (garbage collection, etc.), protected by a pref

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86_64
Linux
defect

Tracking

()

People

(Reporter: decoder, Unassigned)

Details

(Keywords: sec-want)

Chrome has a window.internals object that is available only with a specific command line flag/pref and exposes all sorts of testing functions like GC. Some of our guests at the fuzzing work week mentioned yesterday, that our way of providing these test functions (through Jesse's addon), makes automation more complex and caused them a few problems when they started writing fuzzers for Firefox. I think making this a native feature of the browser (of course protected by a pref) is beneficial as it makes the browser testing easier and a little more uniform. It also makes reproducing easier for our developers, once a test depends on such an internal function. I'd be willing to implement this (given I find out how).
I recall marionette had a pref *and* a run-time CLI flag to prevent this from being accidentally turned on in release builds, and the same solution could be in use here.
Shouldn't be too hard to add a [Pref=...] readonly attribute Internals internals; to Window.webidl.
Component: General → DOM
I'm happy to guide implementation. This should be pretty easy now that Window is on Web IDL bindings. Basically you define an IDL interface like this: [NoInterfaceObject] interface TestingFunctions { // Your functions here }; and add this to Window.webidl: [Pref="whatever.something"] // Or a Func if you want enabling to be more complicated readonly attribute TestingFunctions internals; and then of course implement the TestingFunctions interface. Whether to do that in JS or C++ depends on what we want to expose on there.
Exposing Components.utils.getJSTestingFunctions() this way sounds great. And maybe a few of the other things https://www.squarefree.com/extensions/domFuzzLite3.xpi offers, such as cycle collection and enabling accessibility. I'd prefer for it to only expose "fuzzing-safe" functions.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.