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

A way to get and block requests of other extensions in firefox #17

Open
Landius opened this issue Oct 21, 2023 · 2 comments
Open

A way to get and block requests of other extensions in firefox #17

Landius opened this issue Oct 21, 2023 · 2 comments

Comments

@Landius
Copy link

Landius commented Oct 21, 2023

TLDR: use browser.proxy.onRequest.

MDN doc about the firefox's proxy API, it's quite different from chromium's chrome.proxy.

use browser.proxy.onRequest.addListener(listener, {urls:['<all_urls>']}) to get requestDetail.
usually, the requestDetail.documentUrl of extension request is in format like: moz-extension://${internalUUID}/path
listener returns an invalid proxy to block request 🤣

internalUUID is unique for each extension, but it's different from the extension id returned by browser.management.getAll(), and I can't find a way to get it in extension.
one way to get internalUUID is, open this page about:debugging#/runtime/this-firefox, run some snippet in devtool:

const idPairArr=[];
for(let card of document.querySelectorAll('.card')){
  const fields = card.querySelectorAll('dd.fieldpair__description');
  if(fields.length>=2){
    idPairArr.push({
      extensionId:fields[0].innerText,
      internalUUID:fields[1].innerText
    })
  }
}
console.log(idPairArr);

related issues: #8, #14

@dnakov
Copy link
Owner

dnakov commented Oct 21, 2023

Hey that's great! I tried proxy.onRequest in chrome a while ago, and yes, didn't show extension traffic, nice find for firefox!
Thanks for the pointer, I'll try digging into it as well.

@SullieLore
Copy link

Could I please request that Firefox (specifically Zen Browser, which is basically Firefox) is looked at again as a new home/continuation for Little Rat? I must say, without Little Rat I feel like most extensions are not worth using. Thanks for your hard work.

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

No branches or pull requests

3 participants