setting document.cookie using javascript causes an abort.

VERIFIED WORKSFORME

Status

()

P3
normal
VERIFIED WORKSFORME
20 years ago
19 years ago

People

(Reporter: sdm, Assigned: morse)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

20 years ago
This sample code causes an abort, atleast under linux:
// Sets cookie values. Expiration date is optional
//
function setCookie(name, value, expire) {
   document.cookie = name + "=" + escape(value)
   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}
function register(name) {
   var today = new Date()
   var expires = new Date()
   expires.setTime(today.getTime() + 1000*60*60*24*365)
   setCookie("TheCoolJavaScriptPage", name, expires)
}

I've tried taking out all the extraneous stuff here, except for the
document.cookie =  stuff, and it still dumps core.

Updated

20 years ago
Assignee: norris → morse
Component: JavaScript → Cookies
(Assignee)

Updated

20 years ago
Status: NEW → RESOLVED
Last Resolved: 20 years ago
Resolution: --- → WORKSFORME
(Assignee)

Comment 1

20 years ago
Using a tree that I pulled and built on April 16, I was unable to reproduce this
problem.  I ran it on both windows and on linux and the cookie was successfully
set in both cases and there was no abort or crash on either platform.

Here is the exact html that I used:

<html>
<head>
<script>
function setCookie(name, value, expire) {
   document.cookie = name + "=" + escape(value)
   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}
function register(name) {
   var today = new Date()
   var expires = new Date()
   expires.setTime(today.getTime() + 1000*60*60*24*365)
   setCookie("TheCoolJavaScriptPage", name, expires) }
register("cookie1");
</script>
</head>
<body>
Javascript cookie-setting bug
</body>
</html>
(Reporter)

Comment 2

20 years ago
Sorry, I forgot to mention one important thing - this was in a XUL document, not
HTML. The xul I was using is at
http://pimpmaster.org/simeon/xultool-test?create=xul
(Assignee)

Comment 3

20 years ago
Sorry, this one doesn't crash either.  Again I tried it in both windows and
linux.  Furthermore, it does not set any cookies.

I tried it in 4.5 and it ran fine once.  But the next time I tried it I got
something very strange -- rather than displaying a page it attempted to download
a file called xultool-text.htm.  I exited and reentered the browser and the same
thing happened.  Furthermore, that htm file contains no cookie-setting code.

Status uncanged -- it still works for me.  I'm assuming that whatever problem
you are running into, it has been corrected in the later version of the sources.
You might want to pull a fresh tree and see if you are still having the problem.

Updated

19 years ago
Status: RESOLVED → VERIFIED

Comment 4

19 years ago
smorrison, can you reproduce the problem?  smorse has stated above that he is
unable to reproduce it here, and i have been unsuccessful in reproducing the
problem as well.  if you can reproduce it, please reopen it.
You need to log in before you can comment on or make changes to this bug.