WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
65595
<iframe> inside shadow tree should be invisible from the host document.
https://bugs.webkit.org/show_bug.cgi?id=65595
Summary
<iframe> inside shadow tree should be invisible from the host document.
Kent Tamura
Reported
2011-08-02 23:14:14 PDT
<iframe> in a shadow tree have some problems for now. - hide shadow frames from windows.frames - Loading in a shadow frame shouldn't update the history.
Attachments
Patch
(14.65 KB, patch)
2011-08-03 00:47 PDT
,
Kent Tamura
no flags
Details
Formatted Diff
Diff
Patch 2
(19.03 KB, patch)
2011-08-05 01:44 PDT
,
Kent Tamura
no flags
Details
Formatted Diff
Diff
Patch 3
(19.18 KB, patch)
2011-08-05 02:02 PDT
,
Kent Tamura
no flags
Details
Formatted Diff
Diff
Patch 4
(20.66 KB, patch)
2011-08-05 04:30 PDT
,
Kent Tamura
no flags
Details
Formatted Diff
Diff
Patch
(19.49 KB, patch)
2012-02-22 01:54 PST
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
Patch
(20.09 KB, patch)
2012-02-22 16:35 PST
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
Patch
(20.08 KB, patch)
2012-02-22 17:25 PST
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
Patch
(19.34 KB, patch)
2012-02-22 17:32 PST
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
Patch for landing
(20.02 KB, patch)
2012-02-22 20:28 PST
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Kent Tamura
Comment 1
2011-08-03 00:47:08 PDT
Created
attachment 102749
[details]
Patch
Hajime Morrita
Comment 2
2011-08-03 01:25:17 PDT
Comment on
attachment 102749
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=102749&action=review
Another idea is to maintain a separate list for shadow frame.
> Source/WebCore/page/FrameTree.cpp:26 > +#include "HTMLFrameOwnerElement.h"
Is this required?
> Source/WebCore/page/FrameTree.cpp:70 > + while (frame->isInShadowTree())
is fram always non-null?
> Source/WebCore/page/FrameTree.cpp:346 > + if (frame)
Do we need this check?
> Source/WebCore/page/FrameTree.h:55 > + // The number of child frames excluding shadow frames.
This is obvious from the code.
Roland Steiner
Comment 3
2011-08-03 01:59:42 PDT
AFAICT, with this patch one cannot use firstChild(), nextChild(), previousSibling and nextSibling() within shadow trees at all. Rather than skipping frames where isInShadowTree() is true, it might be better to skip frames where the treeScope is different (?). Also, in case the HTML of an <iframe> within a shadow tree includes itself an <iframe>, isInShadowTree() for the nested <iframe> would be false, and the frame thus visible. However, since the nested <iframe> got included by a shadow tree, this seems to run counter to the intent of the patch (?). In the long run I wonder if it wasn't possible to have frame trees at the TreeScope level instead.
Kent Tamura
Comment 4
2011-08-03 02:00:18 PDT
Comment on
attachment 102749
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=102749&action=review
Thank you for reviewing.
> Another idea is to maintain a separate list for shadow frame.
It hink the current idea is better to maintain. We might want to change the behavior in the future so that loading for shadow iframes updates the browser history.
>> Source/WebCore/page/FrameTree.cpp:26
> > Is this required?
It's not required. Removed.
>> Source/WebCore/page/FrameTree.cpp:70 >> + while (frame->isInShadowTree()) > > is fram always non-null?
frame can be null. But it's safe to call 0->isInShadowTree().
>> Source/WebCore/page/FrameTree.cpp:346 >> + if (frame) > > Do we need this check?
It's not needed. frame is always non-0 in this case. Fixed.
>> Source/WebCore/page/FrameTree.h:55 >> + // The number of child frames excluding shadow frames. > > This is obvious from the code.
Removed.
Hajime Morrita
Comment 5
2011-08-03 02:09:12 PDT
Comment on
attachment 102749
[details]
Patch Could you add test for dynamic frame tree modification like - from main document to shadow tree (and vice versa) - from a shadow tree to another shadow tree ?
Kent Tamura
Comment 6
2011-08-03 02:27:46 PDT
(In reply to
comment #3
)
> AFAICT, with this patch one cannot use firstChild(), nextChild(), previousSibling and nextSibling() within shadow trees at all. Rather than skipping frames where isInShadowTree() is true, it might be better to skip frames where the treeScope is different (?).
It's reasonable. I need to investigate what we should do for Frame::ownerElement() == 0.
> Also, in case the HTML of an <iframe> within a shadow tree includes itself an <iframe>, isInShadowTree() for the nested <iframe> would be false, and the frame thus visible. However, since the nested <iframe> got included by a shadow tree, this seems to run counter to the intent of the patch (?).
In this case, a deeper <iframe> might update the browser history. I'll make a test and check the behavior.
Kent Tamura
Comment 7
2011-08-03 02:29:30 PDT
(In reply to
comment #5
)
> (From update of
attachment 102749
[details]
) > Could you add test for dynamic frame tree modification like > - from main document to shadow tree (and vice versa) > - from a shadow tree to another shadow tree > ?
Do they make sense for the component model? If such cases can be made only by window.internals, I don't think we should take care of them.
Alexey Proskuryakov
Comment 8
2011-08-03 10:22:02 PDT
What's the use case for having an iframe in a shadow tree? Can we just disallow them instead?
Roland Steiner
Comment 9
2011-08-03 18:41:27 PDT
(In reply to
comment #8
)
> What's the use case for having an iframe in a shadow tree? Can we just disallow them instead?
iframes in shadow tree have been discussed as one way to achieve strong isolation between the document and (parts of) a component.
Kent Tamura
Comment 10
2011-08-03 19:50:24 PDT
(In reply to
comment #8
)
> What's the use case for having an iframe in a shadow tree? Can we just disallow them instead?
A patch in
Bug 53961
uses it to inject a lot of style sheet and JavaScript code into a shadow tree. I think we have no other ways to execute JavaScript code in shadow trees without polluting the global context.
Dimitri Glazkov (Google)
Comment 11
2011-08-03 19:56:12 PDT
(In reply to
comment #10
)
> (In reply to
comment #8
) > > What's the use case for having an iframe in a shadow tree? Can we just disallow them instead? > > A patch in
Bug 53961
uses it to inject a lot of style sheet and JavaScript code into a shadow tree. > I think we have no other ways to execute JavaScript code in shadow trees without polluting the global context.
That sounds like a massive hack. I know you really want that calendar to land, but shouldn't we try to solve this problem properly?
Hajime Morrita
Comment 12
2011-08-03 21:06:20 PDT
(In reply to
comment #11
)
> (In reply to
comment #10
) > > (In reply to
comment #8
) > > > What's the use case for having an iframe in a shadow tree? Can we just disallow them instead? > > > > A patch in
Bug 53961
uses it to inject a lot of style sheet and JavaScript code into a shadow tree. > > I think we have no other ways to execute JavaScript code in shadow trees without polluting the global context. > > That sounds like a massive hack. I know you really want that calendar to land, but shouldn't we try to solve this problem properly?
This might be a great opportunity to think about isolation: If you want to create components in non intrusive way, what do we need? This sounds worth to investigate.
Alexey Proskuryakov
Comment 13
2011-08-03 22:57:34 PDT
I thought that the whole purpose of shadow trees was to provide isolation. If we need iframes for that, we could just as well remove shadow tree support and use iframes everywhere, couldn't we? :)
Kent Tamura
Comment 14
2011-08-04 18:03:17 PDT
(In reply to
comment #11
)
> > A patch in
Bug 53961
uses it to inject a lot of style sheet and JavaScript code into a shadow tree. > > I think we have no other ways to execute JavaScript code in shadow trees without polluting the global context. > > That sounds like a massive hack. I know you really want that calendar to land, but shouldn't we try to solve this problem properly?
Yes, I really want to make the progress of the calendar picker. I don't think implementing "the proper way" will be done in a few months, and the iframe-in-shadow might be needed anyway.
Kent Tamura
Comment 15
2011-08-05 01:44:25 PDT
Created
attachment 103051
[details]
Patch 2
WebKit Review Bot
Comment 16
2011-08-05 02:00:06 PDT
Comment on
attachment 103051
[details]
Patch 2
Attachment 103051
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/9321002
Kent Tamura
Comment 17
2011-08-05 02:02:27 PDT
Created
attachment 103053
[details]
Patch 3 Include Document.h for Chromium
WebKit Review Bot
Comment 18
2011-08-05 02:39:11 PDT
Comment on
attachment 103053
[details]
Patch 3
Attachment 103053
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/9306789
New failing tests: fast/frames/layout-after-destruction.html
Kent Tamura
Comment 19
2011-08-05 04:30:02 PDT
Created
attachment 103059
[details]
Patch 4 Fix a re-parenting bug
Alexey Proskuryakov
Comment 20
2011-08-05 09:17:46 PDT
I still don't understand what the plan is here. Having iframes in shadow trees is a long term liability, and in the end, they should probably not be supported at all.
Dimitri Glazkov (Google)
Comment 21
2011-08-05 09:35:49 PDT
(In reply to
comment #20
)
> I still don't understand what the plan is here. Having iframes in shadow trees is a long term liability, and in the end, they should probably not be supported at all.
Having iframes in shadow DOM is not a problem in general. None of the component model proposals currently in existence place any limitations like this. However, using iframes in the context of 53961 definitely seems like a hack. If what you're looking for is a global JS context (which I don't think you do -- you could just use closure), then we should do this explicitly for JS running in a component. If you're trying to avoid stylesheet pollution, then use scoped styles. Does this make sense?
Sam Weinig
Comment 22
2011-08-07 22:07:16 PDT
(In reply to
comment #0
)
> <iframe> in a shadow tree have some problems for now. > > - hide shadow frames from windows.frames > - Loading in a shadow frame shouldn't update the history.
Where do these rules come from?
Kent Tamura
Comment 23
2011-08-08 02:52:55 PDT
(In reply to
comment #21
)
> However, using iframes in the context of 53961 definitely seems like a hack. If what you're looking for is a global JS context (which I don't think you do -- you could just use closure), then we should do this explicitly for JS running in a component. If you're trying to avoid stylesheet pollution, then use scoped styles.
I confirmed <script> in a shadow tree worked. Do you have any idea how to access the shadow tree from the script in the shadow tree? We can't use document.getElementById(), etc.
Kent Tamura
Comment 24
2011-08-08 02:58:46 PDT
(In reply to
comment #22
)
> > - hide shadow frames from windows.frames > > - Loading in a shadow frame shouldn't update the history. > > Where do these rules come from?
They are my opinions. Others might object to them.
Roland Steiner
Comment 25
2011-08-10 15:12:11 PDT
(In reply to
comment #22
)
> (In reply to
comment #0
) > > <iframe> in a shadow tree have some problems for now. > > > > - hide shadow frames from windows.frames > > - Loading in a shadow frame shouldn't update the history. > > Where do these rules come from?
In my understanding these are a natural consequence of the isolation discussion of components: if a component is supposed to be isolated from the page by default, then the page should have no way of accessing those iframes unless the component opens them up. Conversely, the component should not "pollute" the page's history by virtue of it utilizing iframes.
Kent Tamura
Comment 26
2011-12-08 17:13:59 PST
Comment on
attachment 103059
[details]
Patch 4 I'm trying another way to implement the calendar picker.
Dominic Cooney
Comment 27
2012-02-07 22:32:58 PST
Now that ShadowRoot is exposed to script, ClusterFuzz demonstrated a crash adding an IFRAME to a ShadowRoot <
http://code.google.com/p/chromium/issues/detail?id=113167
>.
Hajime Morrita
Comment 28
2012-02-22 01:54:16 PST
Created
attachment 128159
[details]
Patch
Hajime Morrita
Comment 29
2012-02-22 01:57:37 PST
This change just hides iframes from accessor on document. History stuff is out of scope. I don't think we need to hide navigation in shadowed iframes because we don't do that for nested iframes. The concept of shadow DOM is further clarified since the last patch was written. <iframe> in shadow is no longer a big deal.
Dimitri Glazkov (Google)
Comment 30
2012-02-22 10:15:39 PST
Comment on
attachment 128159
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=128159&action=review
> Source/WebCore/ChangeLog:8 > + This change introduced FrameTree::documentChild() and
"introduces"
> Source/WebCore/ChangeLog:10 > + frame lookup. Using these, now the named accessor and the indexed
remove "now" here ...
> Source/WebCore/ChangeLog:11 > + acceccor on Document, and Window.length is TreeScope aware. They
and replace "is" with "are now".
> Source/WebCore/page/Frame.cpp:1128 > +bool Frame::isScopedBy(TreeScope* scope) const
isScopedby -> inScope
> Source/WebCore/page/FrameTree.h:57 > Frame* previousSibling() const { return m_previousSibling; } > Frame* firstChild() const { return m_firstChild.get(); } > Frame* lastChild() const { return m_lastChild; }
Are these guys still being used?
> Source/WebCore/page/FrameTree.h:78 > + Frame* documentChild(unsigned index) const;
I think the name is a bit unintuitive. It requires you to know that Document is a TreeScope. Also, the purpose of scoped* functions is limited to just supplying results for document* functions. Do we need the complete set of the two? Can we collapse them into one set, called "scopedChild"?
Hajime Morrita
Comment 31
2012-02-22 16:35:27 PST
Created
attachment 128328
[details]
Patch
Hajime Morrita
Comment 32
2012-02-22 16:37:33 PST
Comment on
attachment 128159
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=128159&action=review
Hi Dimitri, thanks for reviewing this! I addressed your point. Could you have another round?
>> Source/WebCore/ChangeLog:8 >> + This change introduced FrameTree::documentChild() and > > "introduces"
fixed.
>> Source/WebCore/ChangeLog:10 >> + frame lookup. Using these, now the named accessor and the indexed > > remove "now" here ...
removed...
>> Source/WebCore/ChangeLog:11 >> + acceccor on Document, and Window.length is TreeScope aware. They > > and replace "is" with "are now".
... and fixed.
>> Source/WebCore/page/Frame.cpp:1128 >> +bool Frame::isScopedBy(TreeScope* scope) const > > isScopedby -> inScope
fixed.
>> Source/WebCore/page/FrameTree.h:57 >> Frame* lastChild() const { return m_lastChild; } > > Are these guys still being used?
Yes. People iterate over frame children for example in the history module.
>> Source/WebCore/page/FrameTree.h:78 >> + Frame* documentChild(unsigned index) const; > > I think the name is a bit unintuitive. It requires you to know that Document is a TreeScope. > > Also, the purpose of scoped* functions is limited to just supplying results for document* functions. Do we need the complete set of the two? Can we collapse them into one set, called "scopedChild"?
Sounds good. done.
Dimitri Glazkov (Google)
Comment 33
2012-02-22 16:37:57 PST
Comment on
attachment 128328
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=128328&action=review
> Source/WebCore/ChangeLog:9 > + This change introduces FrameTree::documentChild() and > + FrameTree::documentChild(), which can be used for scope-aware
Whoops! Still mentions documentChild!
Hajime Morrita
Comment 34
2012-02-22 17:25:25 PST
Created
attachment 128344
[details]
Patch
Hajime Morrita
Comment 35
2012-02-22 17:25:59 PST
(In reply to
comment #33
)
> > Whoops! Still mentions documentChild!
Whoaaaa. My text editor searched only under page/ and binding/ :-/
Hajime Morrita
Comment 36
2012-02-22 17:26:42 PST
> > Whoops! Still mentions documentChild! > Whoaaaa. My text editor searched only under page/ and binding/ :-/
And bots are red... I need to fix them.
Hajime Morrita
Comment 37
2012-02-22 17:32:30 PST
Created
attachment 128347
[details]
Patch
Dimitri Glazkov (Google)
Comment 38
2012-02-22 18:13:08 PST
Comment on
attachment 128347
[details]
Patch r=me, make sure bots are green before landing.
Hajime Morrita
Comment 39
2012-02-22 20:28:24 PST
Created
attachment 128377
[details]
Patch for landing
Hajime Morrita
Comment 40
2012-02-22 20:28:58 PST
Comment on
attachment 128377
[details]
Patch for landing Waiting EWS greeness.
WebKit Review Bot
Comment 41
2012-02-23 16:54:25 PST
Comment on
attachment 128377
[details]
Patch for landing Clearing flags on attachment: 128377 Committed
r108700
: <
http://trac.webkit.org/changeset/108700
>
WebKit Review Bot
Comment 42
2012-02-23 16:54:32 PST
All reviewed patches have been landed. Closing bug.
Ryosuke Niwa
Comment 43
2012-03-06 15:29:43 PST
The test added by this patch is failing on Mac port:
http://build.webkit.org/results/SnowLeopard%20Intel%20Release%20(Tests)/r109929%20(37823)/fast/dom/shadow/iframe-shadow-pretty-diff.html
There are a bunch of other tests that have been failing for the same missing WebKitShadowRoot error :( Could you guys skip all of those on Mac port?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug