Bug 22355 - Systematize code for replacing global constructors
Summary: Systematize code for replacing global constructors
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-19 08:26 PST by Alexey Proskuryakov
Modified: 2008-11-19 10:31 PST (History)
0 users

See Also:


Attachments
proposed patch (10.62 KB, patch)
2008-11-19 08:31 PST, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2008-11-19 08:26:17 PST
JSDOMWindow implements global constructor replacement in setJSDOMWindowXXX functions; JSDOMWindowBase has special cases in put(), and JSWorkerContext is just broken.

Probably easiest to make all code match generated one; patch forthcoming.
Comment 1 Alexey Proskuryakov 2008-11-19 08:31:37 PST
Created attachment 25271 [details]
proposed patch
Comment 2 Sam Weinig 2008-11-19 09:29:10 PST
Can we autogenerate this code?
Comment 3 Darin Adler 2008-11-19 09:32:35 PST
Comment on attachment 25271 [details]
proposed patch

> +    if (!static_cast<JSDOMWindowBase*>(thisObject)->allowsAccessFrom(exec))
> +        return;
> +    // Shadowing a built-in constructor
> +    static_cast<JSDOMWindowBase*>(thisObject)->putDirect(Identifier(exec, "Event"), value);

How about a helper function for this idiom? I can't think of any good reason to write this out explicitly 8 times instead of using a function.

r=me
Comment 4 Alexey Proskuryakov 2008-11-19 10:31:18 PST
Committed revision 38599.

(In reply to comment #3)
> How about a helper function for this idiom? I can't think of any good reason to
> write this out explicitly 8 times instead of using a function.

I like that these look as close as possible to JSDOMWindow auto-generated ones. Lately, I've spent considerable time digging through minor differences in how the same things are implemented, so I think that consistency is important here.

What we really need is to auto-generate these, and move them to DOMWindow from JSDOMWindowBase.