<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>19562</bug_id>
          
          <creation_ts>2012-10-16 21:14:39 +0000</creation_ts>
          <short_desc>[Shadow]: Consider making shadow DOM subtrees public by default</short_desc>
          <delta_ts>2012-11-28 21:13:04 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>18428</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dimitri Glazkov">dglazkov</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>sonpostman</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>76451</commentid>
    <comment_count>0</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-16 21:14:39 +0000</bug_when>
    <thetext>This is a spill-over from bug 15409.

There&apos;s been several comments from developers about the fact that Shadow DOM encapsulation is _too_ well-sealed for various long tail, but important use cases. In other words, the information that could be accessible (no security concerns, for example) is not. One has to use hacks to get at the truth.

A proposed solution strawman:

I buy this and want to help. Here&apos;s the latest strawman:

1) There&apos;s a 3-position switch on each shadow DOM subtree: public,
private, isolated.

2) There&apos;s a mechanism in place to flip this switch (specifics TBD)

3) the element.shadowRoot property points to the top of the tree
stack, or null if the shadowRoot&apos;s subtree is in &quot;private&quot; or
&quot;isolated&quot; setting.

4) &lt;shadow&gt;.olderSubtree points to the older subtree in the stack or
null if the older subtree is in &quot;private&quot; or &quot;isolated&quot; setting.

5) ShadowRoot.host points to the shadow host or null, if the subtree
is in &quot;private&quot; or &quot;isolated&quot; setting.

6) The &quot;isolated&quot; setting essentially means that there&apos;s a new
document and scripting context for this shadow subtree (specifics
TBD). Watch https://www.w3.org/Bugs/Public/show_bug.cgi?id=16509 for
progress.

Remaining questions:

a) how is the switch flipped and when?

b) do we want to introduce the concept of removing shadows subtrees
from the top of the stack? Seems like a completeness thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76453</commentid>
    <comment_count>1</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-16 21:16:41 +0000</bug_when>
    <thetext>*** Bug 15409 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78176</commentid>
    <comment_count>2</comment_count>
    <who name="Sooel Son">sonpostman</who>
    <bug_when>2012-11-10 16:51:19 +0000</bug_when>
    <thetext>I found that simple code from the previous thread (bug 15409)
Therefore, I like to ask you a question about the following code instance. 

var shadows = new WeakMap();
(function () {
  var realCtor = ShadowRoot;
  ShadowRoot = function (host) {
    var shadow = realCtor(host);
    var hostShadows = shadows.get(host);
    if (!hostShadows) {
      hostShadows = [];
      shadows.set(host, hostShadows);
    }
    hostShadows.push(shadow);
    return shadow;
  };
})();

JavaScript closure can hide a shadow root instance from the hosting page or other scripts running on the same orgin. However, because the hosting page can redefine ShadowRoot, the shadow root can be accessible to other scripts via the following code. 

window.ShadowRoot = function(e) { 
  window.hook_shadowRoots.push(e);
  e = new ShadowRoot(e);
}

I understand that Shadow DOM does not provide security isolated environment. However, it can be used at hiding DOM elements even from the same origin with the help of JavaScript closure. 

My question is simple. Is it possible? or There is no plan at all to support this scheme.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78495</commentid>
    <comment_count>3</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-11-20 00:27:10 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/webcomponents/rev/89362bed5080</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79049</commentid>
    <comment_count>4</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-11-28 21:09:41 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/webcomponents/rev/03ee269f46b1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79050</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-11-28 21:13:04 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/webcomponents/rev/0714c60f265d</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>