Bug 28271 - V8 Bindings for Desktop Notifications
Summary: V8 Bindings for Desktop Notifications
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-13 12:08 PDT by John Gregg
Modified: 2009-08-19 13:33 PDT (History)
2 users (show)

See Also:


Attachments
V8 Bindings for Notifications (24.28 KB, patch)
2009-08-13 12:17 PDT, John Gregg
dglazkov: review-
Details | Formatted Diff | Diff
V8 Bindings for Notifications (24.40 KB, patch)
2009-08-18 17:39 PDT, John Gregg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Gregg 2009-08-13 12:08:46 PDT
Desktop notifications feature needs V8 Bindings.
Comment 1 John Gregg 2009-08-13 12:17:21 PDT
Created attachment 34764 [details]
V8 Bindings for Notifications
Comment 2 Eric Seidel (no email) 2009-08-13 12:36:24 PDT
Comment on attachment 34764 [details]
V8 Bindings for Notifications

Why so much custom bindings code?  We'd much rather share as much bindings code with JSC as possible.  Why do all of these functions need to be custom?
Comment 3 John Gregg 2009-08-13 12:41:43 PDT
The V8 code generator requires event listener accessors to be custom, which is the vast majority of that custom file.

Beyond that there are the 2 createNotification functions which I made custom, as explained in the ChangeLog, because I need them to be different in page context and worker context.  

I don't particularly like that either since the difference is so minor.  The alternative solution would be to change the code generator to be aware that V8 uses different proxy objects in worker and page contexts, and mark up the IDL with a tag that causes context-aware code to be generated.  But I consider that a more substantial change.
Comment 4 John Gregg 2009-08-13 12:45:17 PDT
For completeness of my response, there is also requestPermission which was already custom in JSC for the same reason, the need to distinguish between worker and page contexts, and in a more substantial way: not executing in worker context, rather than just using different proxies.
Comment 5 Eric Seidel (no email) 2009-08-13 20:18:01 PDT
Seems we need to file some bugs about making the generators better.  Adding more copy/paste code is bad news bears. :(
Comment 6 John Gregg 2009-08-17 17:21:54 PDT
Eric, I agree with that and I'm happy to help with it (although the code generator is not an area of my expertise yet).  But I think that could happen in parallel with moving notifications forward for Chromium.  Would you want to wait on this patch until those changes can be made?
Comment 7 Eric Seidel (no email) 2009-08-17 17:27:38 PDT
I left this r=? because I agree, it doesn't need to block this change.  That said, we need to file some bugs about the missing features.  It would be great if you could file bugs for the needed additions to the code generators, and ideally link them here. :)
Comment 8 Dimitri Glazkov (Google) 2009-08-17 18:18:12 PDT
Comment on attachment 34764 [details]
V8 Bindings for Notifications

Overall, looks good. Some style nits around abbreviations:

> +    Notification* notif = V8DOMWrapper::convertToNativeObject<Notification>(V8ClassIndex::NOTIFICATION, args.Holder());

notification

> +    Notification* notif = V8DOMWrapper::convertToNativeObject<Notification>(V8ClassIndex::NOTIFICATION, args.Holder());

notification

> +    NotificationCenter* notifInterface = V8DOMWrapper::convertToNativeObject<NotificationCenter>(V8ClassIndex::NOTIFICATIONCENTER, args.Holder());

notificationCenter

> +    RefPtr<V8CustomVoidCallback> callback;
> +    if (args.Length() > 0) {
> +        if (!args[0]->IsObject()) {
> +            V8Proxy::throwError(V8Proxy::TypeError, "Callback must be of valid type.");
> +            return v8::Undefined();

return throwError("Callback must...");
Comment 9 John Gregg 2009-08-18 17:39:37 PDT
Created attachment 35090 [details]
V8 Bindings for Notifications

Thanks, I've addressed those comments in this revised patch.
Comment 10 Dimitri Glazkov (Google) 2009-08-18 19:02:01 PDT
Comment on attachment 35090 [details]
V8 Bindings for Notifications

r=me.
Comment 11 Eric Seidel (no email) 2009-08-18 20:03:48 PDT
Comment on attachment 35090 [details]
V8 Bindings for Notifications

Rejecting patch 35090 from commit-queue.  This patch will require manual commit.

Failed to run "['git', 'svn', 'rebase']"  exit_code: 1  cwd: None
Comment 12 Adam Barth 2009-08-18 20:04:25 PDT
Comment on attachment 35090 [details]
V8 Bindings for Notifications

I blame the rebase bug.  Let's try again.
Comment 13 Eric Seidel (no email) 2009-08-18 22:50:43 PDT
Comment on attachment 35090 [details]
V8 Bindings for Notifications

Clearing flags on attachment: 35090

Committed r47492: <http://trac.webkit.org/changeset/47492>
Comment 14 Eric Seidel (no email) 2009-08-18 22:50:47 PDT
All reviewed patches have been landed.  Closing bug.
Comment 15 Peter Kasting 2009-08-19 13:16:59 PDT
(In reply to comment #13)
> (From update of attachment 35090 [details])
> Clearing flags on attachment: 35090
> 
> Committed r47492: <http://trac.webkit.org/changeset/47492>

This seems to have caused the following compile error:

WebCore\bindings\v8\WorkerContextExecutionProxy.cpp(41) : fatal error C1083: Cannot open include file: 'Notification.h': No such file or directory
Comment 16 John Gregg 2009-08-19 13:22:56 PDT
http://codereview.chromium.org/173066 is ready to go to fix the chromium build, if that's what you mean.  

Or is the webkit build on its own broken?
Comment 17 Peter Kasting 2009-08-19 13:33:28 PDT
(In reply to comment #16)
> http://codereview.chromium.org/173066 is ready to go to fix the chromium build,
> if that's what you mean.  

Ah, OK.  Sorry for the harassment :)