Make `nsIAlertNotification` easier to init
Categories
(Toolkit :: Alerts Service, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox147 | --- | fixed |
People
(Reporter: lina, Assigned: saschanaz)
References
Details
Attachments
(6 files)
|
59 bytes,
text/x-review-board-request
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
| Reporter | ||
Comment 1•7 years ago
|
||
| Comment hidden (mozreview-request) |
| Reporter | ||
Comment 3•7 years ago
|
||
Comment 4•7 years ago
|
||
| mozreview-review | ||
| Reporter | ||
Comment 5•7 years ago
|
||
Updated•7 years ago
|
| Reporter | ||
Updated•7 years ago
|
Comment 6•7 years ago
|
||
(In reply to Lina Cambridge (she/her) [:lina] from comment #5)
Comment on attachment 8989278 [details]
Bug 1369833 - MakensIAlertNotificationproperties writable.Reusing
NotificationOptionscould work, though! WebIDL dictionaries are
simpler to use from C++ and JS, and that leaves us with 6 params (the
options, title, clickable flag, cookie, principal, and private browsing
flag). We can probably ditch clickable and private browsing (every
notification can be clickable, and we can get the private browsing ID from
the principal), leaving us with 4 params. 3 if you omit the principal, which
most chrome callers will do, 2 if you also omit the cookie.WDYT? I might play around with this when I have spare cycles, but, if it
doesn't seem worthwhile, I'm also happy to just close this. :-)
That could be a good start. Since nobody's actively maintaining this code now though I'm reluctant to make big changes.
Updated•3 years ago
|
Updated•2 years ago
|
| Assignee | ||
Comment 7•1 year ago
|
||
JS can just provide a general object like this:
// this works!
var svc = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
var alert = {
name: "name",
imageURL: "",
title: "title",
text: "message",
textClickable: true,
cookie: "test-id",
dir: "",
lang: "",
data: "test-id",
principal: null,
URI: null,
inPrivateBrowsing: false,
actionable: true,
silent: false,
vibrate: [],
actions: [],
source: "",
opaqueLaunchData: "",
loadImage: (timeout, listener, userData) => listener.onImageMissing(userData)
}
svc.showAlert(alert, console.log)
The problem is that not all members are supposed to be caller provided. Something like this would be nice:
interface nsIAlertAction : nsISupports {
// ...
void wrap(nsIAlertAction aAction);
};
var svc = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
var alert = Cc["@mozilla.org/alert-notification;1"].createInstance(Ci.nsIAlertNotification);
// Missing attributes will get default values
alert.wrap({
name: "name",
title: "title",
text: "message",
textClickable: true,
});
svc.showAlert(alert, console.log)
| Assignee | ||
Comment 8•1 year ago
|
||
Updated•3 months ago
|
Updated•3 months ago
|
| Assignee | ||
Comment 9•3 months ago
|
||
| Assignee | ||
Comment 10•3 months ago
|
||
| Assignee | ||
Comment 11•3 months ago
|
||
| Assignee | ||
Comment 12•3 months ago
|
||
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Comment 13•3 months ago
|
||
Comment 14•3 months ago
|
||
Comment 15•3 months ago
|
||
Backed out for causing bc failures @browser_device_connected.js.
| Assignee | ||
Updated•3 months ago
|
Comment 16•3 months ago
|
||
Comment 17•3 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/8f349df6d9dc
https://hg.mozilla.org/mozilla-central/rev/0fa7b9d4643a
https://hg.mozilla.org/mozilla-central/rev/4ab7a7d3decd
https://hg.mozilla.org/mozilla-central/rev/ae669e66bfd0
https://hg.mozilla.org/mozilla-central/rev/7ce16044c7d6
Updated•2 months ago
|
Description
•