Skip to content

Can the same constructed stylesheet be used in two different Documents? #23

Closed

Description

@rakina

Should adding the same constructed stylesheet in two different Documents be allowed? If it is, can it be used as a security attack vector?

Activity

  1. calebdwilliams commented on Mar 2, 2018

    @calebdwilliams

    For the purposes of this question does "documents" include document fragments (so shadow roots) or just a window.document?

  2. ewilligers commented on Mar 3, 2018

    @ewilligers
    Collaborator

    This question is about different window.document instances, e.g. from different origins. The same constructed stylesheet can certainly be used in many shadow roots under the same document - that is the primary use case.

  3. calebdwilliams commented on Mar 4, 2018

    @calebdwilliams

    I would be weary of that possibility because I can see foresee instances where library authors might want to check if the object they get is an instance of CSSStyleSheet. If the constructors aren’t the same, that might cause an issue (unless I’m missing the point).

  4. TakayoshiKochi commented on Apr 6, 2018

    @TakayoshiKochi
    Member

    I think if once a constructed stylesheet is associated with any browsing context (i.e. specified for
    actual rendering), then reusing that same object to another browsing context would throw an exception
    (e.g. at the point that the object is added to .moreStyles or whatever it ends up with).

  5. added
    needs resolution
    on Apr 17, 2018
  6. TakayoshiKochi commented on May 22, 2018

    @TakayoshiKochi
    Member

    Let's conclude that a constructed stylesheet can only be associated with one document.
    I'll close this once corresponding spec draft change is done.

  7. rakina commented on Sep 12, 2018

    @rakina
    MemberAuthor

    #35 resolves this. It can't be used in multiple Documents.

  8. rakina commented on Sep 28, 2018

    @rakina
    MemberAuthor

    Reopening after @annevk's comment on WICG/webcomponents#759 (comment). Maybe it's OK to make a stylesheet be usable in more than one Documents if we clearly define things that need to be defined?

    According to #10, the URL of the stylesheet will stay the same, that is the document it is constructed on. For fetch group, we might want to use the one for the document it's constructed on? Not sure, I'll try to find out...

    One of the other things that was pointed out was the security aspect - can we modify another Document's <style> element's stylesheet? If we can't, then maybe it make sense to not allow injecting a constructed stylesheet to another Document.

    cc @tabatkins, who might be able to help solve these questions

  9. reopened this on Sep 28, 2018
  10. rakina commented on Dec 10, 2018

    @rakina
    MemberAuthor

    Resolved with #61.

  11. 25 remaining items

  12. heycam commented on Jan 17, 2020

    @heycam

    @rakina can this issue be closed? I think your spec changes to follow the #23 (comment) proposal were made.

  13. rakina commented on Jan 20, 2020

    @rakina
    MemberAuthor

    Oops yeah forgot to actually close the issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs resolution

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions