Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running as an extension #391

Open
benjamingr opened this issue May 14, 2019 · 4 comments
Open

Support running as an extension #391

benjamingr opened this issue May 14, 2019 · 4 comments

Comments

@benjamingr
Copy link

Chrome extensions can connect to the devtools directly (chrome.debugger.attach)

It would be really useful to make this library "universal" in that it would run inside an extension - it doesn't sound like a ton of work :]

Would work towards this be welcome or is this explciitly a non-goal?

@cyrus-and
Copy link
Owner

Eh... it doesn't sound like a ton of work in theory, in practice (to avoid spaghetti code) that would require a pretty big code refactoring I guess. Also to be used from an extension, this library should be webpacked for the browser and that must coexist with the current setup, which is already obscure enough as it is.

I need to think about this...

@june07
Copy link

june07 commented Jun 18, 2019

This is hilarious and ironic in a way because I'm reading this now after NiM (A CHROMIUM EXTENSION) was just removed by @nodejs, the latest reason being just that... a solution running as an extension.

Remove recommendations of Chrome Extensions #2259

@benjamingr
Copy link
Author

@june07 oh hi! I asked for this just because I thought it was a cool idea to get it to work since chrome.debugger already has the ability to attach a debugger. We wouldn't bundle this in extension mode in Node - I was thinking more in terms of "cool way to show people things about browsers" or "way to normalize using the debugger API in extension".

Ideally this would be exported as a library to be consumed from other extensions in extension mode rather than published.

@sliminality
Copy link

I have an extremely minimal proof-of-concept here: https://github.com/sarahlim/cri-extension

It's not documented at all, sadly, though that's on my todo list. Basically just:

  1. Clone the repo
  2. Install the extension like any other unpacked extension
  3. Open the background page inspector from chrome://extensions
  4. Navigate to a webpage and click the browser action icon (it looks kind of like the Reebok logo, long story)
  5. From the background page console, you should be able to do things like await DOM.getDocument()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants