Closed Bug 144795 Opened 23 years ago Closed 6 years ago

support document.cookie for all documents

Categories

(Core :: DOM: Core & HTML, enhancement, P4)

x86
Windows NT
enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: ashshbhatt, Assigned: ehsan.akhgari)

References

()

Details

(4 keywords)

Attachments

(1 file)

document.cookie does not write the cookie when called from a xul page, It is only available until the page is loaded. Press shift+ reload and the cookie is not there any more. Also if you see the cookie manager while the page is loaded and the cookie set it dosen't show the cookie.
Yes, there is no implementation of 'cookies' for xul content over http. Is there a specific reason why this is (or will be) required? Note that setting |document.cookie| in a xul document is just like setting |document.anypropertyname|. i.e., it is just a property of the document, and not a "magic" property that digests and stores the cookie. For example, if you say document.cookie="foo=bar; expires=Thursday, 16-May-2002 23:00:00 GMT"; in an HTML document and then do 'alert(document.cookie);' the value returned is just the name-value pair "foo=bar". In a xul document, the original string, including expiration time, is returned
Status: UNCONFIRMED → NEW
Ever confirmed: true
If you really want this, then you should mark it as a request-for-enhancement.
> Is there a specific reason why this is (or will be) required? For the same reason why you want this in HTML.
I'm currently implementing a xul frontend for sitebar (http://sitebar.org) and stumbeled over this bug. For example does sitebar save the state of open nodes and the session in a cookie which a can't access from the xul frontend, cause its unprivileged as it was intended to be. I think its importent that xul should not have lesser capabilities to access data then html does, otherwise it will not be used.
Assignee: hyatt → general
Component: XP Toolkit/Widgets: XUL → DOM: Level 0
Priority: -- → P4
QA Contact: shrir → ian
Target Milestone: --- → mozilla1.9alpha
Assignee: general → benjamin
I ran into this bug as well. My JavaScript code was not working and I just could not understand why document.cookie was not returning anything. I am really surprised that document.cookie is not supposed to work with XUL content. Most programmer will probably find this behavior surprising and inconvenient too. Given that XUL is an alternative for writing rich web based applications, this is a major omission. For now I guess I can embed a small iframe with HTML in it, but that is an ugly solution.
Created http://developer.mozilla.org/en/docs/Remote_XUL to list these kinds of problems.
Assignee: benjamin → nobody
QA Contact: ian → general
An alternative to cookies is to use globalStorage (Firefox 2.0 and later). Given that I don't expect anyone to put in the work to make cookies functional.
Severity: normal → enhancement
Summary: document.cookie does not write the cookie from a xul page → support document.cookie from xul pages

This wpt test is testing whether document.cookie is present on XML documents and is ignored there.

Summary: support document.cookie from xul pages → support document.cookie from all documents
Summary: support document.cookie from all documents → support document.cookie for all documents

(In reply to :Ehsan Akhgari from comment #8)

This wpt test is testing whether document.cookie is present on XML documents and is ignored there.

https://searchfox.org/mozilla-central/source/testing/web-platform/meta/xhr/responsexml-document-properties.htm.ini

Assignee: nobody → ehsan

On MDN, we state that all browsers have it already available at Document.cookie; we should probably clarify this.

Keywords: dev-doc-needed
Pushed by eakhgari@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ee03e8a4f6cd Move HTMLDocument.cookie getter/setter to Document; r=bzbarsky
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Keywords: site-compat

Documentation updates:

Target Milestone: mozilla1.9alpha1 → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: