Skip to content

Commit f85fd15

Browse files
Release build 4.28.0 [ci release]
1 parent 082084d commit f85fd15

37 files changed

+7259
-4026
lines changed

README.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ In the built output you will see these dramatic differences in the bundled code
6767

6868
### Features scope injection utilities
6969

70-
To handle the difference in scope injection we expose multiple utilities which behave differently per browser in src/utils.js and src/wrapper-utils.js. for Firefox the code exposed handles [xrays correctly](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts) without needing the features to be authored differently.
70+
To handle the difference in scope injection we expose multiple utilities which behave differently per browser in src/utils.js and `ContentFeature` base class. for Firefox the code exposed handles [xrays correctly](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts) without needing the features to be authored differently.
7171

72-
- defineProperty()
72+
- `ContentFeature.defineProperty()`
7373
- defineProperty(object, propertyName, descriptor) behaves the same as Object.defineProperty(object, propertyName, descriptor)
7474
- The difference is for Firefox we export the relevant functions so it can go across the xray
75-
- wrapProperty(object, propertyName, descriptor)
75+
- `ContentFeature.wrapProperty(object, propertyName, descriptor)`
7676
- a simple wrapper around defineProperty() that ignores non-existing properties and retains unspecified descriptor keys.
77-
- Example usage: `wrapProperty('Navigator.prototype.userAgent', { get: () => 'fakeUA' })`
78-
- wrapMethod(object, propertyName, wrapperFn)
77+
- Example usage: `this.wrapProperty('Navigator.prototype.userAgent', { get: () => 'fakeUA' })`
78+
- `ContentFeature.wrapMethod(object, propertyName, wrapperFn)`
7979
- overrides a native method. wrapperFn() will be called in place of the original method. The original method will be passed as the first argument.
8080
- Example usage:
8181
```
82-
wrapMethod(Permissions.prototype, 'query', async function (originalFn, queryObject) {
82+
this.wrapMethod(Permissions.prototype, 'query', async function (originalFn, queryObject) {
8383
if (queryObject.name === 'blocked-permission') {
8484
return {
8585
name: queryObject.name,
@@ -91,16 +91,6 @@ To handle the difference in scope injection we expose multiple utilities which b
9191
})
9292
```
9393
94-
- wrapConstructor(object, propertyName, wrapperFn)
95-
- overrides a constructor. It works similar to `wrapMethod()`, but handles extra constructor-specific details
96-
- Example usage:
97-
```
98-
wrapConstructor(window, 'Date', function (originalConstructor, ...args) {
99-
// always return the same date
100-
return new originalConstructor(1995, 11, 17)
101-
})
102-
```
103-
10494
- DDGProxy
10595
- Behaves a lot like new window.Proxy with a few differences:
10696
- has an overload function to actually apply the function to the native property.
@@ -110,7 +100,7 @@ To handle the difference in scope injection we expose multiple utilities which b
110100
111101
### Testing Locally
112102
113-
Depending on what you are changing, you may need to run the build processes locally, or individual tests.
103+
Depending on what you are changing, you may need to run the build processes locally, or individual tests.
114104
The following all run within GitHub Actions when you create a pull request, but you can run them locally as well.
115105
116106
- eslint

0 commit comments

Comments
 (0)