Enrico Bacis 38f60eb2d4 Allow rule creation in sample.dnr-rule-manager when no rule exists (#1029)
The `functional-samples/sample.dnr-rule-manager` example allows the user to add and remove `chrome.declarativeNetRequest` rules on demand from the extension's options page.

Rules require to have a unique `id`, so the extension fetches the list of all the currently defined rules, takes the max and adds 1.

When no rule is defined, this results in `Math.max(...[]) + 1` => `Math.max() + 1` => `-Infinity + 1` => `-Infinity` and since the `id` should be an integer and not an number, the extension throws an error.

Ensuring that `0` is always a parameter of `Math.max` should solve the problem.
2023-11-13 13:27:09 +00:00
2023-02-22 13:25:39 +01:00
2023-05-12 10:58:20 +01:00
2023-03-20 19:36:40 +01:00
2023-02-22 13:25:39 +01:00
2023-05-01 11:29:59 -04:00

Chrome Extensions samples

Official samples for Chrome Extensions and the Chrome Apps platform. (Chrome Apps are deprecated. Learn more on the Chromium blog).

For more information on extensions, see Chrome Developers.

Explore samples

The directory structure is as follows:

You can also use the Samples page to discover extensions by type, permissions, and extension API.

Installation

To experiment with these samples, please clone this repo and use 'Load Unpacked Extension'. Read more on Development Basics.

Contributing

Please see the CONTRIBUTING file for information on contributing to the chrome-extensions-samples project.

License

chrome-extensions-samples are authored by Google and are licensed under the Apache License, Version 2.0.

Description
No description provided
Readme Apache-2.0 74 MiB
Languages
JavaScript 85.1%
HTML 8.3%
CSS 4.2%
C++ 1%
Perl 0.4%
Other 0.9%