Creation of context-menu for Network Tab (DevTools)

Hello,
I’m a new user that would like to develop some small features by using the instruments and the documentation provided by this wonderful community!

My simple target is to create a new context-menu inside the Network tab->Copy context. I would like to simulate programmaticaly the Copy as cURL function.

Currently, looking online I got only how to create a context-menu only on the webpage and not in the DevTools/Network tab, for example (check/uncheck button menu):

browser.menus.create({
  id: "check-uncheck",
  type: "checkbox",
  title: browser.i18n.getMessage("menuItemUncheckMe"),
  contexts: ["all"],
  checked: checkedState
}, onCreated);

I would like to know if there is a way to manage the Network tab context-menu, if there is some object inside the browser object to be managed. An example of code would be appreciated. I’m new on this project ^^

Thank you for your support!

1 Like

Sadly, there are very few entry points to hook into dev tools, and all only allow you to add entirely new UI elements. See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Extending_the_developer_tools

1 Like

Thank you for the answer.

In case I would like to implement that Copy as cURL not more in Network tab of DevTools, but in the usual context menu, I tried to write a small script and I’m able to get the Cookie values of the active tab by using browser.cookies.getAll({url: tab.url});, but I’m not able to get the list of all headers and other parameters by using the elements explained in the documentation as: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/HttpHeaders or https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onHeadersReceived. Is there a specific data structure that can take all the headers and parameters as POST param from the active tab? Idk if the elements linked above were the correct one to use or I’m using them in a wrong way or there are other functions/data structures to use.

Thank you in advance ^^