Open Bug 160201 Opened 22 years ago Updated 2 years ago

Cookie not getting set when link clicked on

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
Windows NT
defect

Tracking

()

People

(Reporter: morse, Unassigned)

References

()

Details

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.
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.
tever, can you reproduce?  You were the one who saw the original problem when
you tried to verify a different bug.
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.
 
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
QA Contact: stummala → ian
The URL testcase doesn't work anymore.
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.
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general
Assignee: general → nobody
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.