What is the maximum message size allowed, such as 32 bytes or 64 bytes, for communication between content scripts and background pages in Chrome extensions?

Currently working on a Chrome extension that extracts large public keys from webpages. I'm curious if there are any specific limitations with Google's message passing API that aren't readily available on their website.

Appreciate any insights!

Answer №1

Utilizing chrome.runtime.sendMessage results in the serialization and transmission of messages from the sender's process (such as the tab containing the content script) to the extension's process (the background page) all at once. The maximum size limit for the IPC message is 128 MB. Exceeding this limit will result in termination of the sender's process.

Note that even though the message size is 128 MB, it doesn't mean you can send a JavaScript string with a length of 134,217,728 characters, as additional space is needed to store metadata. Assuming an average of 2 bytes storage per character for a JavaScript string, the maximum practical limit would be closer to 50 MB.

While technically feasible, sending such large amounts of data is not recommended. A screenshot from Chrome's task manager after transmitting a 50MB message shows that it took 5 seconds for the message to travel from the tab to the background page. Additionally, both the browser and tab processes utilized about 300MB, while the extension process used 663MB, compared to their initial values of 32MB, 17MB, and 22MB respectively.

Messages under a few megabytes pose no issue.

https://i.sstatic.net/8ka0t.png

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Preventing Video Downloads and Enabling Video Playback in Selenium using C# and ChromeDriver

I am interested in learning how to use Selenium and ChromeDriver, or even Chrome itself, to prevent video content on a webpage from downloading and playing automatically. This is important to me as it can use up bandwidth and time during my testing of othe ...

Application freezes when asynchronous lookup returns no results

While using mongoose with async, I have encountered an issue where my application hangs and eventually times out when performing a lookup that returns no results. Below is an example of a controller code snippet that performs a simple lookup by id using m ...

How to Eliminate Image Flickering While Loading in a React Component

Currently, I am developing a React component that takes an imageUrl and displays it on a canvas with a deliberate 2-second delay to mimic loading time for larger images. However, I have encountered a problem: when the imageUrl changes in the parent compone ...

Apply the "ng-class" directive only if there is an <a> element located after the specified element

My issue involves a list of items categorized by labels, with a search filter applied. The problem arises when the labels appear in the search results even though the lists themselves are empty. I need to hide the relevant label if there are no items prese ...

Using AngularJS to populate dropdown options with data from JSON objects

I have a JSON file that looks like this: var myJson = { "Number of Devices":2, "Block Devices":{ "bdev0":{ "Backend_Device_Path":"/dev/ram1", "Capacity":"16777216", "Bytes_Written":9848, "timestamp":"4365093 ...

Trigger the change-event by hand

Hey there, I'm facing an issue with manually triggering a change event. Currently, I have a selectOneMenu (similar to a dropdown in JSF) with various values. When I select a value from this dropdown list, a datatable is supposed to be updated. This ...

When scrolling down, the overflow of the container div is clipped

Currently, I am developing an Electron application using HTML, CSS, and Javascript. In my project, there is a container div named #mainGrid that acts as a CSS grid container with 100% height to ensure the background color remains centered and covers the en ...

What is the best way to dynamically load utility methods in a Next.js application?

Do you believe it is beneficial to organize logic into utility files and dynamically load them to enhance the speed of a website? For example, I have a method called getInvoiceDetails in a file named getInvoiceDetails.tsx: export default const getInvoiceD ...

Clear input field upon document loading

Looking for the most effective method to clear an input field when $.(document).ready() is triggered. I want the input field to be cleared every time the user reloads or navigates away from and back to the page, once the DOM is fully loaded. I've ex ...

Enhancing a simple HTML 5 project by integrating JS dependencies with minimal recompilation or processing

If I have a collection of .html, .css, and .js files that I am serving as static resources via a web server. There are countless JS packages available on NPM repository. I am curious about the process of packaging these libraries (downloading and extra ...

How can I stop TypeScript from causing my builds to fail in Next.js?

Encountering numerous type errors when executing yarn next build, such as: Type error: Property 'href' does not exist on type '{ name: string; }'. This issue leads to the failure of my build process. Is there a specific command I can ...

The jQuery function appears to be running multiple times in a loop

For some reason, every value in my JSON object is getting added to the "listOfCountries" array twice. It seems like there might be a loop going through the result object more than once. I could really use some assistance with this issue! var listOfCountri ...

Please input the number backwards into the designated text field

In my react-native application, I have a TextInput where I need to enter numbers in a specific order such as 0.00 => 0.01 => 0.12 => 1.23 => 12.34 => 123.45 and so on with each text change. I tried using CSS Direction "rtl" but it didn' ...

Executing PHP script using AJAX displays an empty outcome

I want to execute a php script through ajax after submitting a form. Here is the form <form id="form" class="form"> <input id="email" type="email" required name="email" placeholder="Email" onchange="myUpdateFunction()" value=""> <te ...

Merge the values of the obscured inputs into a JSON-formatted string within a designated concealed input field

Is there a way to merge the hidden input values into a JSON formatted string and store it in a separate hidden input field? <c:forEach var="perForm" items="${importedPersonForms}" varStatus="count"> <input type="hidden" name="importedPerson ...

I need to press the button two times to successfully submit

I am experiencing a remote validation issue. When I click on the submit button without focusing on the text box, it triggers a remote ajax call for validation. However, when I press the submit button a second time, the form gets submitted. On the same cl ...

Updating an AngularJS scope variable without the need for redundant re-repetition

Currently, I am facing an issue where I am assigning items to the scope like so: $scope.items = [{ name: 'one', value: 1 }{ name: 'two', value: 2 }] I am using ng-repeat to display these items. There's a service that ...

Ways to schedule the execution of a script at a specific time using Node.js

Every time the readDirectory function is called, it checks if any file created date is more than 30 days ago and removes that file from the directory. While this functionality is working correctly, I am concerned about its efficiency. To address this issue ...

I've recently delved into the world of JavaScript and am currently working on creating a calculator website. However, I'm facing some challenges in getting it to function

I created a calculator code using HTML, CSS, and JavaScript for a website. However, due to my limited experience with JavaScript coding, I encountered some issues. Currently, I have only implemented the number input part (not operations or deletion), but w ...

How to show or hide a textbox in JavaScript?

Within my user control, there is a panel with two controls: ddlType, a drop-down list, and txtOthers, a text box. Initially, txtOthers is set to be invisible. The goal is for txtOthers to become visible when the user selects an option in ddlType that corr ...