Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ownerDocument.cookie not reading cookies on restart #14993

Closed
DartBot opened this issue Nov 10, 2013 · 8 comments
Closed

ownerDocument.cookie not reading cookies on restart #14993

DartBot opened this issue Nov 10, 2013 · 8 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue library-html type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Nov 10, 2013

This issue was originally filed by Erik.Gri...@gmail.com


What steps will reproduce the problem?

  1. set a cookie from inside a custom element using ownerDocument.cookie='name=value'
  2. refresh the browser and from inside the element print(ownerDocument.cookie)

What is the expected output? What do you see instead?

Expected: The console displays 'name=value'
Actual: The console prints nothing.

What version of the product are you using? On what operating system?

Dart Editor version 0.8.10_r30104 (DEV)
Dart SDK version 0.8.10.10_r30104

Please provide any additional information below.

  1. The cookie shows up in the developer tools.
  2. The cookie shows up in document.cookie.
@anders-sandholm
Copy link
Contributor

Added Area-HTML label.

@sethladd
Copy link
Contributor

Added Triaged label.

@DartBot
Copy link
Author

DartBot commented Nov 16, 2013

This comment was originally written by @zoechi


As I learned from a discussion about another bug related to ownerDocument (ownerDocument.createElement()):
For imports the ownerDocument (a method of the base class in custom element) refers the imported html file (e.g. a custom control) not the main page (not 100% sure about this though) it is understadable that it has no cookies.
document is a public method of the polymer package referencing the main document which naturally has access to the cookies.
Please correct me if I'm wrong.

@blois
Copy link
Contributor

blois commented Nov 18, 2013

There are multiple documents in play for typical Polymer applications-

Each HTML import is a separate document and the contents of Template elements are also separate documents.

From custom elements, typically you'll see at least two instantiations-
  - The first will be the instance within the template contents. This is distinguishable because ownerDocument.defaultView will be null. Also enteredView will never be invoked.
  - The second is when the template is instanced and the element is added to the view. enteredView will be invoked and ownerDocument.defaultView will be true.

I assume that if the top-level document is used rather than a different one that it will work properly.

@DartBot
Copy link
Author

DartBot commented Nov 19, 2013

This comment was originally written by Erik.G...@gmail.com


The top-level document.cookie worked properly. I tested ownerDocument.cookie again with with build 30187 and polymer 0.9.0+1 using the same code, ownerDocument.cookie is now reading the top-level document cookie on restart. That being said, does it make sense to allow operations like getting/setting cookies on these other documents?

@kevmoo
Copy link
Member

kevmoo commented Apr 7, 2014

Removed Area-HTML label.
Added Area-Library, Library-Html labels.

@alan-knight
Copy link
Contributor

With the pending question it's definitely an enhancement rather than a defect. I don't know if it's appropriate, but that seems more like a Polymer/Custom Elements question than a general dart:html issue. Put in a query to Polymer people.


Removed Type-Defect, Priority-Unassigned labels.
Added Type-Enhancement, Priority-Medium labels.

@alan-knight
Copy link
Contributor

It seems like it would be very difficult to make that work in Polymer. So I'm going to call the original issue resolved and the generalization not planned.


Added NotPlanned label.

@DartBot DartBot added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-html closed-not-planned Closed as we don't intend to take action on the reported issue labels Jan 21, 2015
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue library-html type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

6 participants