Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is "Chrome PDF viewer" extension "mhjfbmdgcfjbbpaeojofohoefgiehjai" located?

How can I find the folder for chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai (the hidden "Chrome PDF viewer")?

I need to access these files and change its JavaScript to send me a message before printing a PDF.

like image 451
HTarda Avatar asked Dec 20 '18 10:12

HTarda


Video Answer


1 Answers

It's an internal component of Chrome; it's not really a physical folder to navigate to, this is compiled into the Chrome's own files (specifically resources.pak - thanks, wOxxOm).

You can get the source code of that extension from the Chromium source, e.g. https://chromium.googlesource.com/chromium/src.git/+/71.0.3578.98/chrome/browser/resources/pdf - note that those still need compilation with the Closure Compiler, so not usable for modification as-is.

But suppose you do modify and compile it. Can you install your modified version? Yes and no.

While it is technically possible to override the extension by presenting an unpacked extension with a higher version and the same key in the manifest..

enter image description here

..it will not actually work like that, because the manifest uses elevated "private" permissions..

"permissions": [
  "chrome://resources/",
  "contentSettings",
  "metricsPrivate",
  "resourcesPrivate"
],
"content_security_policy": "script-src 'self' blob: filesystem: chrome://resources; object-src * blob: externalfile: file: filesystem: data:; plugin-types application/x-google-chrome-pdf",

..that can't be used from a non-internal extension:

enter image description here

So if you really wanted to modify the internal PDF viewer, you'd need to compile your own modified version of Chromium, or at the very least your own version of resources.pak. Probably not what you want to do.

like image 144
Xan Avatar answered Nov 14 '22 23:11

Xan