content icon indicating copy to clipboard operation
content copied to clipboard

Add note about onBeforeRequest unavailability

Open SenorGato opened this issue 3 years ago • 4 comments

Summary

Added that webRequest.onBeforeRequest is not avaliable in content scripts.

Motivation

I spent two hours trying to do this, and stumbled across the answer on a random stack overflow, seems pertinent.

Supporting details

https://stackoverflow.com/questions/40996014/typeerror-api-is-undefined-in-content-script-or-why-cant-i-do-this-in-a-cont

Related issues

Metadata

  • [ ] Adds a new document
  • [ ] Rewrites (or significantly expands) a document
  • [x] Fixes a typo, bug, or other error

SenorGato avatar Feb 09 '22 22:02 SenorGato

Preview URLs

Flaws

URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onBeforeRequest Title: webRequest.onBeforeRequest on GitHub Flaw count: 1

  • broken_links:
    • Can't resolve https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#webextension_apis

External URLs

URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onBeforeRequest Title: webRequest.onBeforeRequest on GitHub

No new external URLs

github-actions[bot] avatar Feb 09 '22 22:02 github-actions[bot]

@rebloor I think this is waiting on your review

Josh-Cena avatar Jul 22 '22 06:07 Josh-Cena

@SenorGato apologies for missing the review request. I am wondering why we need a note on this event given that it's only one of many that aren't available in content scripts.

rebloor avatar Jul 27 '22 17:07 rebloor

I'm not certain this is what we want to do. Content scripts have a limited set of APIs they are allowed to use. This same comment, if we addressed the issue this way, would need to be added to the majority of APIs.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#webextension_apis

mixedpuppy avatar Aug 08 '22 17:08 mixedpuppy

@Josh-Cena as you can see, there are now two comments on this change querying how appropriate it is. We thank you for offering this suggestion, but on reflection, we shouldn't make it.

rebloor avatar Aug 11 '22 17:08 rebloor

I think you've tagged the wrong person @rebloor (OP is @SenorGato) but I agree with your choice

Josh-Cena avatar Aug 12 '22 01:08 Josh-Cena

Sorry @Josh-Cena

rebloor avatar Aug 12 '22 03:08 rebloor