W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2013

[whatwg] Implementation question about Notifications

From: Andrew Wilson <atwilson@google.com>
Date: Thu, 14 Nov 2013 15:45:19 +0100
Message-ID: <CAArhhityo_KFbqkG4uQX=LUyWsrbfOLtG1MesbLDuPZZNUhHDA@mail.gmail.com>
To: WHATWG List <whatwg@whatwg.org>
Cc: Peter Beverloo <peter@chromium.org>
The notification spec (http://notifications.spec.whatwg.org/#api) says that
the Notification object has the following readonly attributes: title, dir,
lang, body, tag, icon.

Let's say I make the following calls:

var n1 = new Notification("title");
var n2 = new Notification("title", {icon: "invalid_icon_url"});
var n3 = new Notification("title", {icon: "http://non-existent-icon.com"});

What should:


resolve to? I think that it should be:

n1.dir == "auto"
n1.lang == ""
n1.body === undefined
n1.tag === undefined
n1.icon === undefined

Do you agree? Or should it map to something different?

What about n2.icon and n3.icon - what should they read? I'm curious, given
that section 4.9.1 reads:

If the notification platform supports icons, notification's icon URL is set
> and has not yet been fetched, fetch it and wait for the resource to be
> fully downloaded.
> Once fetching has finished and the image format is supported, set
> notification's icon to the decoded resource. (Otherwise notification has no
> icon.)

I'm not certain if "set notification's icon" refers to just the visible
image within the notification, or to the *Notification.icon* attribute
itself - I'm assuming the former (since we don't want to wait for a network
fetch before setting the Notification.icon attribute) so perhaps we should
rephrase this as "set notification's icon image to the decoded resource"?

Also, step 8 in the constructor description says:

If options's icon is present, parse icon using the API base URL specified
> by the entry settings object, and if that does not return failure, set
> notification's icon URL to the return value. (Otherwise icon URL is not
> set.)

...so it seems pretty clear that Notification.icon should be undefined if
the passed NotificationOptions.icon attribute is unparseable. Agreed?

Received on Thursday, 14 November 2013 14:45:45 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:14 UTC