Bug 82607 - Shadow DOM is exposed in JS
Summary: Shadow DOM is exposed in JS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Shinya Kawanaka
URL:
Keywords:
Depends on:
Blocks: 82429
  Show dependency treegraph
 
Reported: 2012-03-29 06:17 PDT by Shinya Kawanaka
Modified: 2012-04-08 18:22 PDT (History)
12 users (show)

See Also:


Attachments
Repro (1.37 KB, text/html)
2012-03-29 06:17 PDT, Shinya Kawanaka
no flags Details
WIP (7.02 KB, patch)
2012-04-02 00:54 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
WIP (7.59 KB, patch)
2012-04-02 03:51 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
WIP (10.37 KB, patch)
2012-04-02 04:39 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Patch (12.16 KB, patch)
2012-04-02 05:43 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Patch (12.12 KB, patch)
2012-04-02 05:51 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-01 (7.40 MB, application/zip)
2012-04-02 07:33 PDT, WebKit Review Bot
no flags Details
Archive of layout-test-results from ec2-cr-linux-03 (7.25 MB, application/zip)
2012-04-02 08:37 PDT, WebKit Review Bot
no flags Details
Patch (12.25 KB, patch)
2012-04-02 18:46 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Patch (11.84 KB, patch)
2012-04-03 22:30 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Patch for landing (11.67 KB, patch)
2012-04-04 19:06 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shinya Kawanaka 2012-03-29 06:17:33 PDT
Created attachment 134560 [details]
Repro

When getSelection() is called in nested shadow root, shadow dom is exposed in JS level.
This issue won't expose the deepest shadow tree, but the other shadow trees could be exposed.
Comment 1 Shinya Kawanaka 2012-04-02 00:54:09 PDT
Created attachment 135038 [details]
WIP
Comment 2 Gustavo Noronha (kov) 2012-04-02 01:52:11 PDT
Comment on attachment 135038 [details]
WIP

Attachment 135038 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/12310408
Comment 3 Early Warning System Bot 2012-04-02 02:07:35 PDT
Comment on attachment 135038 [details]
WIP

Attachment 135038 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12306590
Comment 4 Build Bot 2012-04-02 02:07:39 PDT
Comment on attachment 135038 [details]
WIP

Attachment 135038 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12306588
Comment 5 Early Warning System Bot 2012-04-02 02:12:17 PDT
Comment on attachment 135038 [details]
WIP

Attachment 135038 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12307522
Comment 6 WebKit Review Bot 2012-04-02 02:22:20 PDT
Comment on attachment 135038 [details]
WIP

Attachment 135038 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12309458
Comment 7 Gyuyoung Kim 2012-04-02 02:29:00 PDT
Comment on attachment 135038 [details]
WIP

Attachment 135038 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/12313392
Comment 8 Shinya Kawanaka 2012-04-02 03:51:45 PDT
Created attachment 135060 [details]
WIP
Comment 9 Philippe Normand 2012-04-02 04:06:13 PDT
Comment on attachment 135060 [details]
WIP

Attachment 135060 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/12309505
Comment 10 Build Bot 2012-04-02 04:27:55 PDT
Comment on attachment 135060 [details]
WIP

Attachment 135060 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12307566
Comment 11 Build Bot 2012-04-02 04:31:30 PDT
Comment on attachment 135060 [details]
WIP

Attachment 135060 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12309508
Comment 12 Shinya Kawanaka 2012-04-02 04:39:22 PDT
Created attachment 135064 [details]
WIP
Comment 13 Build Bot 2012-04-02 05:25:43 PDT
Comment on attachment 135064 [details]
WIP

Attachment 135064 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12311429
Comment 14 Shinya Kawanaka 2012-04-02 05:43:05 PDT
Created attachment 135076 [details]
Patch
Comment 15 Shinya Kawanaka 2012-04-02 05:51:50 PDT
Created attachment 135079 [details]
Patch
Comment 16 WebKit Review Bot 2012-04-02 07:33:31 PDT
Comment on attachment 135079 [details]
Patch

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

New failing tests:
fast/dom/shadow/selection-shouldnt-expose-shadow-dom.html
Comment 17 WebKit Review Bot 2012-04-02 07:33:38 PDT
Created attachment 135096 [details]
Archive of layout-test-results from ec2-cr-linux-01

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-01  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 18 WebKit Review Bot 2012-04-02 08:37:44 PDT
Comment on attachment 135079 [details]
Patch

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

New failing tests:
fast/dom/shadow/selection-shouldnt-expose-shadow-dom.html
Comment 19 WebKit Review Bot 2012-04-02 08:37:50 PDT
Created attachment 135108 [details]
Archive of layout-test-results from ec2-cr-linux-03

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-03  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 20 Shinya Kawanaka 2012-04-02 18:46:01 PDT
Created attachment 135252 [details]
Patch
Comment 21 Hajime Morrita 2012-04-02 21:29:44 PDT
Comment on attachment 135252 [details]
Patch

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

> Source/WebCore/page/DOMSelection.cpp:52
> +    if (!node->treeScope()->rootNode()->isShadowRoot())

It looks there is TreeScope::isShadowRoot(). Does it work for this?

> Source/WebCore/page/DOMSelection.cpp:56
> +    while (shadowAncestor->treeScope()->rootNode()->isShadowRoot())

It looks we can loop over TreeScope instead of Node.
Comment 22 Shinya Kawanaka 2012-04-03 18:21:45 PDT
(In reply to comment #21)
> (From update of attachment 135252 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=135252&action=review
> 
> > Source/WebCore/page/DOMSelection.cpp:52
> > +    if (!node->treeScope()->rootNode()->isShadowRoot())
> 
> It looks there is TreeScope::isShadowRoot(). Does it work for this?

We've removed the function before.

> 
> > Source/WebCore/page/DOMSelection.cpp:56
> > +    while (shadowAncestor->treeScope()->rootNode()->isShadowRoot())
> 
> It looks we can loop over TreeScope instead of Node.
Comment 23 Hajime Morrita 2012-04-03 19:10:23 PDT
(In reply to comment #22)
> (In reply to comment #21)
> > (From update of attachment 135252 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=135252&action=review
> > 
> > > Source/WebCore/page/DOMSelection.cpp:52
> > > +    if (!node->treeScope()->rootNode()->isShadowRoot())
> > 
> > It looks there is TreeScope::isShadowRoot(). Does it work for this?
> 
> We've removed the function before.
Oh I didn't notice that. So how about Node::isInShadowTree() ?

> 
> > 
> > > Source/WebCore/page/DOMSelection.cpp:56
> > > +    while (shadowAncestor->treeScope()->rootNode()->isShadowRoot())
> > 
> > It looks we can loop over TreeScope instead of Node.
Comment 24 Shinya Kawanaka 2012-04-03 22:30:02 PDT
Created attachment 135515 [details]
Patch
Comment 25 Hajime Morrita 2012-04-03 23:12:43 PDT
Comment on attachment 135515 [details]
Patch

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

> Source/WebCore/page/DOMSelection.cpp:52
> +    if (!node->treeScope()->rootNode()->isShadowRoot())

can we use isInSahdowTree() here too?
Comment 26 Shinya Kawanaka 2012-04-04 19:06:55 PDT
Created attachment 135743 [details]
Patch for landing
Comment 27 Shinya Kawanaka 2012-04-04 19:28:50 PDT
Committed r113276: <http://trac.webkit.org/changeset/113276>
Comment 28 Kristóf Kosztyó 2012-04-05 01:59:47 PDT
Committed r113302: <http://trac.webkit.org/changeset/113302>
Comment 29 Zoltan Arvai 2012-04-05 02:03:01 PDT
http://trac.webkit.org/changeset/113302(In reply to comment #28)
> Committed r113302: <http://trac.webkit.org/changeset/113302>

Skipped test on Qt because V8 not yet supported on Qt bots:
fast/dom/shadow/selection-shouldnt-expose-shadow-dom.html
Comment 30 Hajime Morrita 2012-04-08 18:22:24 PDT
(In reply to comment #29)
> 
> Skipped test on Qt because V8 not yet supported on Qt bots:
> fast/dom/shadow/selection-shouldnt-expose-shadow-dom.html
Zoltan, thanks for caring this.