Is it possible to access Web Workers from a chrome extension? - javascript

I have an app which contains several iFrames and Web Workers which communicate via postMessages. I am interested in creating a chrome extension which lists and display all of the messages in a comfortable and easy to inspect way.
Is there a way to access the workers from the window that created them, without a reference to the created instance? (i.e - can I get a list of workers on a given site from the chrome dev-tools console?) Would it be possible to retrieve this information from a chrome extension?
Update
Since the Chrome Devtools Sources Panel does classify web-workers, I was hoping that this can be done with a devtools extension. I also searched through the frontend code of the devtools to understand how a worker is identified there and found this, but am still unable to find how I can get a reference to the workers using the chrome extension api.

Related

How to access browser javascript APIs from another browser

I want to access one browser javascript APIs from another browser.
For example, if I am writing chrome extensions, is there any way to access javascript API for Firefox browser (let us say, History API for Firefox) installed on the same machine?
I looked at the Native Messaging in mdn, but it doesn't seem to satisfy my requirement.
Is it possible that extensions written for one browser communicate with extension for another browser?
For example, if I write a chrome extensions, can I communicate with Firefox add-on from it?
If it is not possible to have communication between extensions/browsers, how come Chrome/Firefox able to pull our
settings,bookmarks etc,. from another browser when we first install
it?
Any help?

Communicate between remote Chrome extensions

I need to develop a Chrome extension that will be able to send messages between instances of the extension (i.e. active Chrome browsers with the extension installed around the world) very quickly (like push notifications).
I understand that the regular Chrome messaging (even the external type) only works with extensions installed on the same browser, not remote ones.
I'm looking for the best, simplest solution, that will provide quick communication between the clients. The only way I thought about is to get some server running (I don't have one, so I need to find an online service), and run a script that will continuously receive/forward data. Is that the best way? Is there a simpler solution to set up for very simple communication between the remote extension instances?

how to watch firebase traffic from desktop chrome inspector

I have a JavaScript app running in my desktop Chrome browser which is reading and writing to Firebase. I'd like to get a sense of how much traffic it uses (vs any local caching) and I figured I could just watch in the Chrome Inspector.
I'm not seeing any such traffic. I assume I need to tweak some Inspector setting, but it looks like I have everything turned on and nothing filtered.
How can I see this traffic? (For my current simple needs, I'd much rather do so in Chrome, and not have to fire up WireShark)
Firebase uses a websocket to communicate with clients. In the devtool's networking tab, filter by "WS" (websocket) and you should see the connection that Firebase is using.
There is a great extension for Chrome called 'GTM/GA Debug' that has a readout for Firebase hits. When using the extension in Chrome Dev Tools, look at the tab named GA4F (Google Analytics for Firebase). It is very helpful for debugging.

Chrome Extension w/ Serial and Page Action

Currently, I have created a Chrome App that gets data from a serial connection using the Chrome App Serial API. My goal is to inject this data into a web page. I know this is capable with Chrome Extensions, but the issue there is that Chrome Extensions aren't capable of accessing the serial data on it's own. I also would like to use an Extension instead of an App because the Chrome Apps aren't going to be supported starting this year.
The only option I could think of is to use a Chrome App to get the serial data, send the data to an Extension, and then inject the data into a web page. This is definitely not preferable though. Besides the Chrome Apps not being supported, except for Chrome OS, I wouldn't like to have to have a user download the extension and the app just to implement this.
My preferred method would to have an Extension access the serial devices. Is this possible and/or is it going to possible in the future? If not, why?
Thanks in advance!

Command line chrome extension loading and testing

I'm currently using the "Developer mode" on the chrome://extensions page of the chromium browser, loading it by clicking on "Reload (Ctrl+R)".
I'd like to be able to make a change to my unpacked chrome extension and load it into the browser in an automated way, especially since I'm testing the extension on a virtual machine so doing all this completely headlessly would be ideal. However, I would at least like to avoid having to click every time I want to load my extension, and I'd like to be able to collect any errors produced into a file/tty.
What is the best way of doing this? Does chrome provide tools for automating extension building and testing?
Regarding the other question linked below:
It doesn't really address my problem, since I am looking for a way to get console output, stack traces and any output generated by the extension reload to be accessible via a file/stream in my OS, as opposed to being displayed in a chromium browser window. The linked answers provide a way to reload the extension programmatically, but not much else.
There are a few avenues for you to research.
You could look into enabling logging with a high verbosity. In principle, I would think there is a level that echoes console output; I'm no expert though.
You could use Native Messaging to speak to a daemon that will log things for you; the downside is that you probably can't catch errors this way.
You could take this one step further and create an extension that attaches to your target extension with Remote Debugging protocol (which provides the same info as DevTools) using the chrome.debugger API, and then log stuff with Native Messaging.
Or, you could eschew using an extension as a supervisor and just use/write an external Remote Debugging client.

Categories

Resources