Bug 25084 - Upstream changes to support V8 bindings for XHR in worker context.
Summary: Upstream changes to support V8 bindings for XHR in worker context.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jian Li
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-07 16:01 PDT by Jian Li
Modified: 2009-04-09 15:43 PDT (History)
3 users (show)

See Also:


Attachments
Proposed Patch (13.41 KB, patch)
2009-04-07 16:26 PDT, Jian Li
no flags Details | Formatted Diff | Diff
Proposed Patch (14.71 KB, patch)
2009-04-08 12:12 PDT, Jian Li
eric: review+
Details | Formatted Diff | Diff
Proposed Patch (14.95 KB, patch)
2009-04-09 15:18 PDT, Jian Li
dglazkov: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jian Li 2009-04-07 16:01:28 PDT
Upstream changes to support V8 bindings for XHR in worker context.
Comment 1 Jian Li 2009-04-07 16:26:29 PDT
Created attachment 29319 [details]
Proposed Patch
Comment 2 Eric Seidel (no email) 2009-04-08 04:02:34 PDT
Comment on attachment 29319 [details]
Proposed Patch

A more descriptive ChangeLog would be helpful.

It's strange to leave "FindOrCreate..." with a leading capital letter.

We use 0 instead of NULL in WebKit C++ code, see http://webkit.org/coding/coding-style.html

A comment documenting when it's OK for global.IsEmpty() to return true would be nice.  Maybe there is still an ASSERT we should add there?  Or is it always true that a dom wrapper lookup can fail for the worker context now?

findOrCreateEventListenerHelper
Helper isn't very descriptive.  Why are these helpers and not listeners?  Don't they inherit from V8EventListener?
Comment 3 Jian Li 2009-04-08 12:12:25 PDT
Created attachment 29342 [details]
Proposed Patch
Comment 4 Jian Li 2009-04-08 12:22:07 PDT
(In reply to comment #2)
> (From update of attachment 29319 [details] [review])
> A more descriptive ChangeLog would be helpful.
> 
What do I need to add to ChangeLog. Maybe something like the following:
  Upstream changes to V8 bindings for XHR so that it can work under either DOMWindow or WorkerContext.

How do you think? If agreed, I will update the ChangeLog.
> It's strange to leave "FindOrCreate..." with a leading capital letter.
> 
Yes, this is strange but I have to keep that unchanged because all these FindOrCreate*** are used by some files that have not been upstreamed yet (you can see the comment there).

For the new methods I have added, I use the WebKit style name.

> We use 0 instead of NULL in WebKit C++ code, see
> http://webkit.org/coding/coding-style.html
> 
Thanks for reminding. Fixed.
> A comment documenting when it's OK for global.IsEmpty() to return true would be
> nice.  Maybe there is still an ASSERT we should add there?  Or is it always
> true that a dom wrapper lookup can fail for the worker context now?
> 
I added the comment in .h file. I think we should not have ASSERT for WorkerContextExecutionProxy::retrieve() because we rely on it to return 0 to indicate if it is in worker context.
> findOrCreateEventListenerHelper
> Helper isn't very descriptive.  Why are these helpers and not listeners?  Don't
> they inherit from V8EventListener?
> 
I agree that Helper is not really a good name. Do you have any better name to suggest? The reason for using this Helper is to put the common code in this Helper so that it could be called by either FindOrCreateEventListener or findOrCreateObjectEventListener.

V8WorkerContextEventListener inherits from V8EventListener and V8WorkerContextObjectEventListener inherits from V8WorkerContextEventListener. They could only be found or created by the methods in WorkerContextExecutionProxy.
Comment 5 Eric Seidel (no email) 2009-04-09 15:00:42 PDT
Comment on attachment 29342 [details]
Proposed Patch

Seems OK to me.  I'm not the be-all, end-all expert here, but this also looks like an "intermediate step" towards better bindings, since not all is upstreamed yet.  Having commetns closer to the actual logic would be more helpful in some case, like the if (global.isEmpty()) having a comment right before it saying *why* we return 0 there.

Or having a comment right next to the funny function names Find vs. find in the .cpp file which explains that the Find version shoudl be removed ASAP.

In general, looks fine to my eyes.
Comment 6 Jian Li 2009-04-09 15:18:03 PDT
Created attachment 29373 [details]
Proposed Patch

This is the new patch with one more comment added per last feedback.
Comment 7 Dimitri Glazkov (Google) 2009-04-09 15:24:59 PDT
Comment on attachment 29373 [details]
Proposed Patch

Looks good.
Comment 8 Dmitry Titov 2009-04-09 15:43:11 PDT
Landed: http://trac.webkit.org/changeset/42373