Bug 84825

Summary: New Notification constructor does not take security origin permissions into account
Product: WebKit Reporter: Jon Lee <jonlee>
Component: WebCore Misc.Assignee: Jon Lee <jonlee>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, jianli, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.7   
Attachments:
Description Flags
Patch darin: review+

Description Jon Lee 2012-04-24 21:52:29 PDT
Running new Notification() show the notification regardless of whether the security origin has permission to do so. It should instead be calling the onerror() callback.
Comment 1 Radar WebKit Bug Importer 2012-04-24 21:53:02 PDT
<rdar://problem/11315405>
Comment 2 Jon Lee 2012-04-24 22:23:39 PDT
Created attachment 138738 [details]
Patch
Comment 3 Darin Adler 2012-04-24 22:27:13 PDT
Comment on attachment 138738 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=138738&action=review

> Source/WebCore/ChangeLog:18
> +        (WebCore::Notification::dispatchErrorEvent): The default constructor of ErrorEvent doesn't
> +        create the proper event object. Create it using Event::create().

Is there a test showing that this was wrong?
Comment 4 Jon Lee 2012-04-24 22:49:19 PDT
(In reply to comment #3)
> (From update of attachment 138738 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=138738&action=review
> 
> > Source/WebCore/ChangeLog:18
> > +        (WebCore::Notification::dispatchErrorEvent): The default constructor of ErrorEvent doesn't
> > +        create the proper event object. Create it using Event::create().
> 
> Is there a test showing that this was wrong?

No. The only tests available are of the legacy API, which threw an exception when creating the notification, so there was no situation in which the error event got dispatched. The new behavior based on the latest draft of the spec utilizes this event.

There are a series of tasks already in bugzilla for bringing the notifications tests up to date once support for notifications is available on the mac.
Comment 5 Jon Lee 2012-04-24 22:51:55 PDT
Committed r115166: <http://trac.webkit.org/changeset/115166>