How to give a browser extension all text data input into that browser?

I’m experimenting with Chrome browser extensions. I want to be able to take any text input into the browser (through the URL bar of the browser or onto text boxes on social media sites and so on) and send that text to a server. I’m wondering if this is possible in chrome and what functions I need to use to achieve this?

I suspect the logic of the extension would work something like this: any time a link is clicked where there is text in an input form / text box, extract that text or form input and send it using some JS requests library to a server.

Which Chrome API function can be used to get the text input into a form?

Chrome allocations profile: why memory consumption for handleEvent is so huge?

To start with one might take a look at this post on regarding ability to assign POJO as an event listener. The thing is that this object should have handleEvent method in order to be able to react on a certain event.
For example:

const handler = {handleEvent(e) {this[`on${e.type}`](e)}};

In the above mentioned post on author sends us to benchmark, which was created exactly to demonstrate the fact, that usage of handleEvent basically takes O(1) memory overheads.
For example (not the actual benchmark):

const handlersQueue = [];

const masterHandler = {
    handleEvent(e) {
    onclick: () => ++this.counter,
    counter: 0

for (let i = 0; i < 1e4; i++) {
    const newHandler = Object.create(masterHandler);
    document.body.addEventListener('click', newHandler);

document.dispatchEvent(new Event('click'));

In that case it is logical to assume, that all the event handlers are going to borrow handleEvent method from a prototype (masterHandler).
Author has created a little bit more sophisticated form of above mentioned example (take a look at DynamicHandler class), but overall idea stays the same.
On the contrary, allocations profile shows an enormous memory consumption by handleEvent function (Chrome Version 64.0.3282.186 (Official Build) (64-bit), MacOS High Sierra):
weird memory consumption results
The questions are:

  • a) why this is happening?
  • b) shouldn't it cost us O(1) (basically SelfSize(bytes) of 0 bytes)?
  • c) is it a sign of an issue either in ChromeDevTools or V8 themselves?

chrome extension eventpage onclicked not triggering

I’m aiming to fire an onclick event on a chrome extension using the documented onclicked eventlistener. It’s not working.

Below is the code:

chrome.browserAction.onClicked.addListener(function (tab) {

Along with the manifest

  "manifest_version": 2,

  "name": "Seneca One add Bookmark",
  "description": "Posts URL to database.",
  "version": "2.0",
  "background": {
    "scripts": ["eventPage.js"],
    "persistent": false
  "browser_action": {
    "default_icon": "[email protected]",
    "default_title": "Add bookmark"
  "permissions": [

Please any help will be greatly appreciated.