Make Preferences::RegisterCallbacks() take in an array of defined size
Categories
(Core :: Preferences: Backend, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: gstoll, Assigned: virpatel71)
Details
(Keywords: good-first-bug)
Attachments
(1 external file)
Right now this function takes in a const char* const* and relies on callers to null-terminate their array. This is a footgun; we should make it <size_t N>(const char prefs[N]) or something of defined size. (we should do this for Preferences::RegisterCallbacksAndCall(), Preferences::UnregisterCallbacks(), etc. as well)
| Reporter | ||
Updated•2 months ago
|
we should make it <size_t N>(const char prefs[N]) or something of defined size.
Thoughts on using Span<const char* const>? Span can be included using #include "mozilla/Span.h" and can be iterated over safely:
for (const char* pref : view) {
printf("%s\n", pref);
}
Caller does would do something like:
const char* prefs[] = {
"browser.tabs.warnOnClose",
"dom.webnotifications.enabled",
};
Span<const char* const> view = prefs;
| Reporter | ||
Comment 2•1 month ago
|
||
Sorry for the delay in responding here. A Span sounds fine to me - thanks!
| Reporter | ||
Comment 4•1 month ago
|
||
Definitely! Feel free to assign it to yourself. There’s a bunch of information here, and feel to ask questions here or on Matrix!
Unfortunately, I don't have sufficient permissions to assign myself.
| Reporter | ||
Comment 6•1 month ago
|
||
Ah, sorry! I can do it then.
Comment 10•9 days ago
|
||
Reverted this because it was causing gtest process-crashes.
- Revert link
- Push with failures
- Failure Log
- Failure line: PROCESS-CRASH | None [@ libc.so + 0x0000000000057741] | gtest
Comment 11•5 days ago
|
||
Comment 12•5 days ago
|
||
| bugherder | ||
Description
•