-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
Fix #38690: Explain persistence of registered content scripts across browsers #38746
base: main
Are you sure you want to change the base?
Conversation
### **Extended Commit Description:** This update improves the documentation for the `registerContentScripts` method by explicitly clarifying the persistence behavior of registered content scripts across different browsers. #### **Changes made:** - Added a **Persistence of Registered Scripts** section under **Return Value** to describe how long scripts remain registered in **Firefox** and **Chrome**. - Explained that in **Firefox**, registered scripts are **removed when the extension is unloaded or reloaded**. - Clarified that in **Chrome**, registered scripts **persist across restarts** if `persistAcrossSessions: true`, but **are unregistered when the extension is updated**. - Highlighted the role of the `persistAcrossSessions` property in controlling script persistence. #### **Why this change?** - The previous documentation did not explicitly state how long registered scripts persist. - There was confusion regarding **browser-specific behaviors**, leading to inconsistencies in developer expectations. - Ensures that developers using the `scripting.registerContentScripts` API fully understand its behavior in **both Firefox and Chrome**. This fix references [MDN GitHub Issue mdn#38690 ](mdn#38690) and improves the clarity of the API documentation.
> [!NOTE] | ||
> **Persistence of Registered Scripts:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mdn-linter] reported by reviewdog 🐶
> [!NOTE] | |
> **Persistence of Registered Scripts:** | |
> [!NOTE] > **Persistence of Registered Scripts:** | |
> |
Preview URLs (comment last updated: 2025-03-21 19:17:04) |
### **Extended Commit Description** This update fixes a syntax issue in the YAML front matter of the `index.md` file for `registerContentScripts`. The issue was caused by parentheses `()` in the `title` field, leading to a **SyntaxError: Unexpected token** during the CI checks. #### **Changes made:** - Removed parentheses `()` from the `title` field in the YAML front matter. - Updated the title from: ```yaml title: scripting.registerContentScripts() ``` to ```yaml title: scripting.registerContentScripts ```
### **Extended Commit Description** This update fixes **code style issues** in the `index.md` file by applying **Prettier formatting** to ensure compliance with MDN’s documentation standards. The CI checks failed due to **formatting inconsistencies**, and this commit resolves those issues. #### **Changes made:** - **Ran Prettier to format `index.md`** and fix all linting issues. - Ensured that the file follows **MDN’s code style guidelines**. - Addressed **all CI linting failures** that were blocking the PR merge. #### **Why this change?** - The CI logs indicated **formatting issues** in `index.md`:
Thanks for the update! And it seems that Firefox will also unregister the script after the extension update, same as Chrome.
Thanks! |
Extended Commit Description
This update improves the documentation for the
registerContentScripts
method by explicitly clarifying the persistence behavior of registered content scripts across different browsers.Changes made:
persistAcrossSessions: true
, but are unregistered when the extension is updated.persistAcrossSessions
property in controlling script persistence.Why this change?
scripting.registerContentScripts
API fully understand its behavior in both Firefox and Chrome.This fix references MDN GitHub Issue #38690 and improves the clarity of the API documentation.
Description
This PR updates the
registerContentScripts
API documentation to clarify the persistence behavior of registered content scripts across different browsers. It explicitly explains how scripts behave in Firefox and Chrome, ensuring that developers are aware of browser-specific differences.Motivation
persistAcrossSessions
property was not well-documented, especially regarding script removal during Chrome extension updates.Additional Details
persistAcrossSessions
chrome.scripting.registerContentScripts
Related Issues and Pull Requests