Closed Bug 188710 Opened 23 years ago Closed 23 years ago

Cookies cannot be read or set from scripts defined in XSLT (no document.cookie support)

Categories

(Core :: XSLT, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: horndog, Assigned: peterv)

References

()

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021212 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021212 The reference URL is a simple test case. It first reads the value of document.cookie (always undefined) and then sets the value of the cookie "foo" to the current date as a UNIX time value (so that changes will be visible). The alert boxes can be removed on request if they are too annoying. Reproducible: Always Steps to Reproduce: 1. Go to the specified URL Actual Results: No cookie is set and a JavaScript warning is issued on the first call to read document.cookie. As this object has not been implemented, the warning accurately states that the script is trying to reference an undefined property of document. Expected Results: Read and set the cookie. :)
Hi Miles, this is actually a DUPE, but I'm too tired to lookup the bug, so I INVALID it. (I wonder what DOM2 spec says about it.) Your stylesheet has a XHTML default namespace on it, so the first generated element is the html element in the XHTML namespace. Therefor it does not trigger the html default output rule, so output method is XML. Mozilla doesn't expose HTMLDocument methods and properties to XML documents, even if they're XHMTL. Some consider that a bug, and I'm sure it's filed somewhere. If you remove the namespace or set the output method to html via a xsl:output tag, you'll be fine. I suggest doing both.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
I made a query for XSL and cookie because I assumed that it was a cookie bug. I'll go and fix my stylesheets now. Sorry for the inconvenience. :)
it would be great if you could let us know if cookies actually do work after you've fixed the stylesheet. Thanks!
Indeed they do. The reference URL has been updated. Thanks for the info on <xsl:output .../>. I've used it a few times, but since most of my XSLT work is server-side and doesn't use the XSLT processor's built it serializer, I forgot about it. Thank you for the quick reply on a saturday; Above and beyond the call of duty.
your welcome, thanx for the testing. verified per reporters comments.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.