Bug 78721

Summary: Rename DOMWindow to Window in the bindings
Product: WebKit Reporter: Erik Arvidsson <arv>
Component: DOMAssignee: Erik Arvidsson <arv>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, ap, dglazkov, haraken, kaustubh.ra, sam, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#the-window-objecthttp://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#the-window-object
Bug Depends on: 79384    
Bug Blocks:    
Attachments:
Description Flags
WIP
none
Patch
none
Patch
none
Patch for landing
none
Patch for landing none

Description Erik Arvidsson 2012-02-15 10:15:15 PST
We name our interface DOMWindow when it should be called Window:

assertTrue(window.Window !== undefined)
Comment 1 Erik Arvidsson 2012-02-15 12:26:06 PST
That assert was not so useful. Here are better test

assertTrue(String(Window) === 'function Window() { [native code] }') // V8
assertTrue(String(Window) === '[object WindowConstructor]') // JSC
Comment 2 Erik Arvidsson 2012-02-17 12:32:42 PST
Haraken, do you have any suggestions how to do this? Right now the interface name must match the file name as far as I can tell.
Comment 3 Erik Arvidsson 2012-02-21 16:45:11 PST
Created attachment 128083 [details]
WIP
Comment 4 Kentaro Hara 2012-02-21 16:51:05 PST
Comment on attachment 128083 [details]
WIP

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

The approach looks good to me.

> Source/WebCore/ChangeLog:8
> +        No new tests. (OOPS!)

Please add run-bindings-tests.

> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:-3782
> -sub GetVisibleInterfaceName

Maybe you can remove GetVisibleInterfaceName() from CodeGeneratorJS.pm too?

> Source/WebCore/bindings/scripts/IDLAttributes.txt:55
> +InterfaceName=*

Thanks for using IDLAttributes.txt, which was introduced today:-)
Comment 5 Erik Arvidsson 2012-02-21 16:51:57 PST
This adds a new extended attribute to the interface section called InterfaceName

interface [
  InterfaceName=Window
] DOMWindow {

}

This is kind of backwards. A better outcome would be to use ImplementedAs on the interface and update all the IDL files to use the real interface name as spec'ed.

interface [
  ImplementedAs=DOMWindow
] Window {

}

However, making this change would require a lot more work. I'm tempted to say that we should do that since forcing us to use non standard interface names in our IDL files suck.

WDYT?
Comment 6 Adam Barth 2012-02-21 16:51:59 PST
Comment on attachment 128083 [details]
WIP

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

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1326
> -    my $visibleClassName = GetVisibleClassName($interfaceName);
> +    my $visibleClassName = $codeGenerator->GetVisibleInterfaceName($dataNode);

Should we rename $visibleClassName to $visibleInterfaceName ?

Can we remove GetVisibleClassName from CodeGeneratorJS.pm too?

> Source/WebCore/bindings/scripts/IDLAttributes.txt:55
> +InterfaceName=*

Please add a test to Source/WebCore/bindings/scripts/tests for this IDL attribute.

> LayoutTests/fast/dom/Window/atob-btoa-expected.txt:18
> -PASS window.btoa(window) is "W29iamVjdCBET01XaW5kb3dd"
> +FAIL window.btoa(window) should be W29iamVjdCBET01XaW5kb3dd. Was W29iamVjdCBXaW5kb3dd.

Please update the test so that this says "PASS"
Comment 7 Adam Barth 2012-02-21 16:53:07 PST
> However, making this change would require a lot more work. I'm tempted to say that we should do that since forcing us to use non standard interface names in our IDL files suck.

I would add a FIXME near the GetVisibleInterfaceName function that says something to that effect.
Comment 8 Erik Arvidsson 2012-02-22 11:40:45 PST
Created attachment 128256 [details]
Patch
Comment 9 WebKit Review Bot 2012-02-22 12:35:55 PST
Comment on attachment 128256 [details]
Patch

Attachment 128256 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/11560582

New failing tests:
inspector/profiler/heap-snapshot.html
Comment 10 Erik Arvidsson 2012-02-22 13:36:03 PST
Created attachment 128276 [details]
Patch
Comment 11 Adam Barth 2012-02-22 15:17:58 PST
Please consider landing the patch in stages.  For example, you could land the code generator infrastructure/tests first with attributes for the current whitelisted interfaces and then change DOMWindow in a separate patch.  That will make our lives easier if we have to roll back the DOMWindow change do to compat issues.
Comment 12 Erik Arvidsson 2012-02-22 15:24:27 PST
Thanks Adam. That makes sense. I will split it into 2 patches.
Comment 13 Erik Arvidsson 2012-02-23 15:17:40 PST
Created attachment 128565 [details]
Patch for landing
Comment 14 Erik Arvidsson 2012-02-23 15:18:34 PST
Comment on attachment 128565 [details]
Patch for landing

Missing ChangeLogs
Comment 15 Erik Arvidsson 2012-02-23 15:20:20 PST
Created attachment 128566 [details]
Patch for landing
Comment 16 WebKit Review Bot 2012-02-23 22:21:20 PST
Comment on attachment 128566 [details]
Patch for landing

Clearing flags on attachment: 128566

Committed r108729: <http://trac.webkit.org/changeset/108729>
Comment 17 WebKit Review Bot 2012-02-23 22:21:28 PST
All reviewed patches have been landed.  Closing bug.