Cookie not getting set when link clicked on

NEW
Unassigned

Status

()

Core
DOM: Core & HTML
16 years ago
4 years ago

People

(Reporter: Stephen P. Morse, Unassigned)

Tracking

Trunk
x86
Windows NT
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

16 years ago
This is a wierd bug and I wouldn't have believed the symptoms if I hadn't seen
it with my own eyes.

Consider the following html code:

  <html>
    <body>
      <form>
        <input value="y">
      </form>
      <a href="http://home.pacbell.net/spmorse/ellis/ellisattack/attack.htm">
        click me
      </a>
  </body>
</html>

and the code that it links to (attack.htm) is:

  <html>
    <body>
      <script>
        document.cookie = "a=b;path=/spmorse/ellis";
      	  alert("cookie="+document.cookie);
      </script>
      Cookie Setting Test
    </body>
  </html>

If you go to attack.htm by clicking on the link, the "a=b" cookie does not get
set.  You can verify this by using the cookie manager after you get to that
page.  On the other hand, if you go to it by typing the URL directly into the
url line, the cookie does get set.  Of course all cookies should be removed
(with the cookie manager) prior to each test, otherwise you won't know if a
cookie just got set or if you were seeing a previous cookie.

Now some clues.

1. If you remove the value= attribute from the input tag (or set the value to
""), then the cookie does get set when the link is clicked.

2. From the debugger I see that the cookie is supposed to be set from the
routine nsHTMLDocument::SetCookie.  However in the bad case, that routine is
never being entered.  This is in nsHTMLDocument.cpp which is upstream from the
cookie module.

Assigning to DOM HTML for starters.

Comment 1

16 years ago
I tested with 07-30-15 build and the cookie is stored in both the cases.

1. load the URL directly.
2. Click on the link to load the URL.
(Reporter)

Comment 2

16 years ago
tever, can you reproduce?  You were the one who saw the original problem when
you tried to verify a different bug.

Comment 3

16 years ago
Steve, I am not able to reproduce this with todays branch on winNT, or todays
branch and trunk on linux.

But with my experimental mozilla build from the other day (where we originally
saw the problem), I can reproduce this.  This is running from the linux based g
server.  Also, I am noticing that I have clipping and pasting the url and
pressing enter will cause the cookie not to be set.  I actually have to edit the
url after clipping in order to get it to set the cookie.
 

Comment 4

16 years ago
sorry about the typos, what I meant to say was ...

Also, I am noticing that if I clip and paste the url and then press enter, the
cookie will still not get set.  I actually have to edit the url after pasting in
order for the cookie to be set
Mass-reassigning bugs.
Assignee: jst → dom_bugs

Updated

13 years ago
QA Contact: stummala → ian
The URL testcase doesn't work anymore.

Comment 7

13 years ago
I think you will need to host the content on your own server to get the right
effect. All the info needed is here in the bug.

Updated

9 years ago
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general

Updated

4 years ago
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.