Event Firing Order:
For more details, visit: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest
-
Click the "+ / Add" button in the upper left corner of the extension's main interface to enter the rule editing interface.
-
The
Match Request
field is required; it will execute during theonBeforeRequest
stage. If this function returnstrue
, it indicates a match for this rule, triggering the subsequent listener functions of this rule. -
Each stage of the rule can have its own listener function. You can access references for events and types of the
details
parameter by clicking the "? / Reference" button on the right side of the textarea.
-
In general, you can select a similar template and modify the variable values within it. For complex situations, additional logic may need to be written in JavaScript.
-
You can usually view the function parameters and return types in the hint button on the right side of the textarea, e.g.,
@param details
indicates thedetails
parameter, and@return boolean
indicates that the return value is of typeboolean
. -
Generally, just fill in the function body, unless it is an asynchronous function or uses different parameter names.
-
You can add the current code as a template by clicking the “☆ / Add Template" button on the right side of the textarea.
- Isolated by request and rule:
this.k=v;
- Isolated by request:
share.k=v;
- Global:
self.k=v;
orwindow.k=v;
, etc.
-
The
Index
field in the rule list determines the matching order, with smaller numbers being tested first. -
In the rule list, with Group view off and sorting canceled, you can adjust the rule order by dragging and dropping.
-
There may be conflicts with other web extensions, as they might modify the same request.
-
The data displayed in the Web Developer Tools may be before modification.
-
Avoid using
async function
or handling complex calculations during theMatch Request
stage, as this may slow down all requests. -
Conflicts should be avoided when sharing data using
share
,self
, orwindow
. -
Use
FilterResponse
only when necessary; avoid modifying the request body of a single request by multiple rules at the same time.