mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
8.88k stars 22.42k forks source link

extension. or runtime.getBackgroundPage() only gives variables when it is a generated bgr page but not type module #33316

Open opto opened 3 weeks ago

opto commented 3 weeks ago

MDN URL

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/extension/getBackgroundPage

What specific section or headline is this issue about?

No response

What information was incorrect, unhelpful, or incomplete?

extension.getBackgroundPage() does not return varaibles or functions unless the background page is "generated". Same for runtime.getBackgroundPage()

current FF and TB.

Either of these two return a bgr page without addon vars or functions:

set type to "module" or use "page" instead of "scripts" in manifest.

What did you expect to see?

either a note in MDN or the variables

Do you have any supporting links, references, or citations?

use and modify this addon to load an explicit bgr page or to set type to module: https://github.com/mdn/webextensions-examples/tree/main/find-across-tabs

Do you have anything more you want to share?

No response

MDN metadata

Page report details * Folder: `en-us/mozilla/add-ons/webextensions/api/extension/getbackgroundpage` * MDN URL: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/extension/getBackgroundPage * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/mozilla/add-ons/webextensions/api/extension/getbackgroundpage/index.md * Last commit: https://github.com/mdn/content/commit/43e3ff826b7b755b05986c99ada75635c01c187c * Document last modified: 2024-01-22T01:22:45.000Z