Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions chrome/content/api/LegacyPrefs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,46 @@ Use this API to access Thunderbird's system preferences or to migrate your own p

## Usage

### API Functions
Add the [LegacyPrefs API](https://github.com/thundernest/addon-developer-support/tree/master/auxiliary-apis/LegacyPrefs) to your add-on. Your `manifest.json` needs an entry like this:

```
"experiment_apis": {
"LegacyPrefs": {
"schema": "api/LegacyPrefs/schema.json",
"parent": {
"scopes": ["addon_parent"],
"paths": [["LegacyPrefs"]],
"script": "api/LegacyPrefs/implementation.js"
}
}
},
```

## API Functions

This API provides the following functions:

#### async getPref(aName, [aFallback])
### async getPref(aName, [aFallback])

Returns the value for the ``aName`` preference. If it is not defined or has no default value assigned, ``aFallback`` will be returned (which defaults to ``null``).

#### async getUserPref(aName)
### async getUserPref(aName)

Returns the user defined value for the ``aName`` preference. This will ignore any defined default value and will only return an explicitly set value, which differs from the default. Otherwise it will return ``null``.

#### clearUserPref(aName)
### clearUserPref(aName)

Clears the user defined value for preference ``aName``. Subsequent calls to ``getUserPref(aName)`` will return ``null``.

#### async setPref(aName, aValue)
### async setPref(aName, aValue)

Set the ``aName`` preference to the given value. Will return false and log an error to the console, if the type of ``aValue`` does not match the type of the preference.

### API Events
## API Events

This API provides the following events:

#### onChanged.addListener(listener, branch)
### onChanged.addListener(listener, branch)

Register a listener which is notified each time a value in the specified branch is changed. The listener returns the name and the new value of the changed preference.

Expand Down
35 changes: 20 additions & 15 deletions chrome/content/api/LegacyPrefs/implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,31 @@
* This file is provided by the addon-developer-support repository at
* https://github.com/thundernest/addon-developer-support
*
* Version: 1.9
* fixed fallback issue reported by Axel Grude
* Version 1.10
* - adjusted to Thunderbird Supernova (Services is now in globalThis)
*
* Version: 1.8
* reworked onChanged event to allow registering multiple branches
* Version 1.9
* - fixed fallback issue reported by Axel Grude
*
* Version: 1.7
* add onChanged event
* Version 1.8
* - reworked onChanged event to allow registering multiple branches
*
* Version: 1.6
* add setDefaultPref()
* Version 1.7
* - add onChanged event
*
* Version: 1.5
* replace set/getCharPref by set/getStringPref to fix encoding issue
* Version 1.6
* - add setDefaultPref()
*
* Version: 1.4
* Version 1.5
* - replace set/getCharPref by set/getStringPref to fix encoding issue
*
* Version 1.4
* - setPref() function returns true if the value could be set, otherwise false
*
* Version: 1.3
* Version 1.3
* - add setPref() function
*
* Version: 1.2
* Version 1.2
* - add getPref() function
*
* Author: John Bieling (john@thunderbird.net)
Expand All @@ -39,10 +42,12 @@ var { ExtensionCommon } = ChromeUtils.import(
var { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

var { ExtensionError } = ExtensionUtils;

var Services = globalThis.Services ||
ChromeUtils.import("resource://gre/modules/Services.jsm").Services;


var LegacyPrefs = class extends ExtensionCommon.ExtensionAPI {
getAPI(context) {

Expand Down
2 changes: 1 addition & 1 deletion chrome/content/api/NotifyTools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ You must remove all added listeners when your add-on is disabled/reloaded. Inste

### setAddOnId(add-on-id)

The `notifyTools.js` script needs to know the ID of your add-on to be able to listen for messages. You may either define the ID directly in the first line of the script, or set it using `setAddOnId()`.
The `notifyTools.js` script needs to know the ID of your add-on to be able to listen for messages. You may either define the ID directly in the first line of the script, or set it using `setAddOnId()`.
6 changes: 5 additions & 1 deletion chrome/content/api/NotifyTools/implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* This file is provided by the addon-developer-support repository at
* https://github.com/thundernest/addon-developer-support
*
* Version 1.5
* - adjusted to Thunderbird Supernova (Services is now in globalThis)
*
* Version 1.4
* - updated implementation to not assign this anymore
*
Expand All @@ -26,7 +29,8 @@

// Get various parts of the WebExtension framework that we need.
var { ExtensionCommon } = ChromeUtils.import("resource://gre/modules/ExtensionCommon.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var Services = globalThis.Services ||
ChromeUtils.import("resource://gre/modules/Services.jsm").Services;

var observerTracker = new Set();

Expand Down
4 changes: 2 additions & 2 deletions chrome/content/api/NotifyTools/schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"namespace": "NotifyTools",
"namespace": "NotifyTools",
"events": [
{
"name": "onNotifyBackground",
Expand Down Expand Up @@ -31,4 +31,4 @@
}
]
}
]
]
1 change: 0 additions & 1 deletion chrome/content/api/Utilities/implementation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable object-shorthand */

var { ExtensionCommon } = ChromeUtils.import("resource://gre/modules/ExtensionCommon.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

// might be better to get the parent window of the current window
// because we may be screwed otherwise.
Expand Down
30 changes: 30 additions & 0 deletions chrome/content/api/WindowListener/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
Version: 1.62
-------------
- fix bug in fullyLoaded()

Version: 1.61
-------------
- adjusted to Thunderbird Supernova (Services is now in globalThis)

Version: 1.60
-------------
- explicitly set hasAddonManagerEventListeners flag to false on uninstall

Version: 1.59
-------------
- store hasAddonManagerEventListeners flag in add-on scope instead on the global
window again, and clear it upon add-on removal

Version: 1.58
-------------
- hard fork WindowListener v1.57 implementation and continue to serve it for
Thunderbird 111 and older
- WindowListener v1.58 supports injection into nested browsers of the new
mailTab front end of Thunderbird Supernova and allows "about:message" and
"about:3pane" to be valid injection targets. More information can be found here:
https://developer.thunderbird.net/thunderbird-development/codebase-overview/mail-front-end

Version: 1.57
-------------
- fix race condition which could prevent the AOM tab to be monkey patched correctly

Version: 1.56
-------------
- be precise on which revision the wrench symbol should be displayed, instead of
Expand Down
Loading