Bug 58121

Summary: [WK2] layoutTestController.shadowRoot should return undefined when its argument is not an element
Product: WebKit Reporter: Dominic Cooney <dominicc>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aroben, commit-queue, dglazkov, dominicc
Priority: P2 Keywords: LayoutTestFailure, MakingBotsRed
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description Dominic Cooney 2011-04-08 00:25:31 PDT
For consistency with Mac DRT, and Chromium DRT (and GTK DRT after bug 58119), layoutTestController.shadowRoot should return undefined, not null, when its argument is not an element.
Comment 1 Dominic Cooney 2011-04-08 00:27:28 PDT
Created attachment 88779 [details]
Patch
Comment 2 WebKit Commit Bot 2011-04-08 02:05:02 PDT
Comment on attachment 88779 [details]
Patch

Clearing flags on attachment: 88779

Committed r83270: <http://trac.webkit.org/changeset/83270>
Comment 3 WebKit Commit Bot 2011-04-08 02:05:05 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Adam Roben (:aroben) 2011-04-08 09:36:59 PDT
fast/dom/HTMLKeygenElement/keygen.html is still failing on WebKit2.
Comment 5 Adam Roben (:aroben) 2011-04-08 09:38:53 PDT
WKBundleNodeHandleCopyElementShadowRoot is returning 0, and LayoutTestController::shadowRoot returns JSValueMakeUndefined in that case.
Comment 6 Adam Roben (:aroben) 2011-04-08 09:42:24 PDT
I mean it returns JSValueMakeNull. But apparently the test wants JSValueMakeUndefined.
Comment 7 Adam Roben (:aroben) 2011-04-08 09:44:21 PDT
It looks like LayoutTestController doesn't have enough information to do the right thing. It's supposed to return undefined if it is passed a non-element node, but it has no way of determining whether a particular node is an element or not.
Comment 8 Adam Roben (:aroben) 2011-04-08 09:46:29 PDT
It's not clear to me that having shadowRoot return different things for non-elements and elements without shadow roots is worthwhile. Why do our tests need that behavior? The tests themselves are quite capable of figuring out what's an element and what isn't.
Comment 9 Dominic Cooney 2011-04-08 10:42:17 PDT
I will work on a patch to make the ports consistent and always return null.
Comment 10 Dominic Cooney 2011-04-08 11:49:35 PDT
Created attachment 88851 [details]
Patch
Comment 11 Dimitri Glazkov (Google) 2011-04-08 13:15:01 PDT
Comment on attachment 88851 [details]
Patch

Clearing flags on attachment: 88851

Committed r83333: <http://trac.webkit.org/changeset/83333>
Comment 12 Dimitri Glazkov (Google) 2011-04-08 13:15:04 PDT
All reviewed patches have been landed.  Closing bug.