chrome.management.get() and getAll() now return a
contentScripts field: the content scripts an extension declares
in its manifest, with their matches,
excludeMatches, js and css.
The field is omitted for extensions that declare none, and it only covers
manifest-declared scripts, not ones registered at runtime through
scripting or userScripts.
Requested in 2014 so that an extension with the management
permission can tell what another extension actually touches, without parsing
locale-dependent permission warnings.
The screenshots below come from
hjanuschka/cl-8623059-extension,
a small extension that calls chrome.management.getAll() and
prints the content scripts of every installed extension. It ships a second
extension, sample-target, that declares two content scripts so
there is something to list.
git clone https://github.com/hjanuschka/cl-8623059-extension
chrome --load-extension=cl-8623059-extension,cl-8623059-extension/sample-target
ManagementApiUnitTest.ExtensionInfo_ContentScripts covers
two scripts with multiple match patterns, one with css and
exclude_matches, and an extension with no content scripts at all.ManagementApiUnitTest tests pass.management is also exposed to
chromewebstore.google.com and to
chrome://extensions, so the new field is visible there too.
Match patterns are already public in every extension's manifest, but it is
worth a conscious ack.matches, excludeMatches,
js and css are exposed. run_at,
all_frames and world would be easy to add if
wanted.