Closed Bug 24204 Opened 25 years ago Closed 25 years ago

linux browser buster shows [NAN] for page count cookie

Categories

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

x86
Windows 95
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: chofmann, Assigned: harishd)

References

()

Details

not sure this is a cookie or js engine bug but linux
shows "NAN" (not a number) for the page count frame.

recent seamonkey win32 builds shows the page fine.
test page is at
http://komodo.mozilla.org/buster/count.html

script that gets evaluated looks like

here is the code that gets evaluated.

  <HTML>
  <HEAD>
  <TITLE>
  JS World.com
  </TITLE>
  </HEAD>
  <!-- BODY BGCOLOR="FFFFFF" TEXT="000000" -->
  <basefont size=2>
  <SCRIPT LANGUAGE="JavaScript">
  <!--
  /*

     This script was created by the administration
     from www.jsworld.com.  Permission is hereby
     granted to use this script freely for any
     commercial or non commercial use, as long as
     this message remains in tact.

     © 1998 JavaScript World
     All Rights Reserved
     http://www.jsworld.com/

  */
  document.write("<FORM><INPUT TYPE=HIDDEN NAME='saved' value='1'></FORM>")
  function welcome()
          {
  if(document.cookie == "")
          {
  var counting = "1";
  var when = new Date()
  document.cookie = "counting=; expires=" + when.toGMTString();
  when.setMonth(when.getMonth() + 1)
  var counting = document.forms[0].saved.value;
  document.cookie = "counting="+counting+" `; expires=" + when.toGMTString()
  document.write("1st page");
          }
  else
          {
  var get = document.cookie;
  get = get.substring((get.indexOf("=")+1),get.length);
  var count = get.split(" ");
  count[0]++
  document.write("pg:"+count[0]+"");
  document.forms[0].saved.value=count[0];
  saveit()
          }
          }

  function saveit()
          {
  var when = new Date()
  document.cookie = "counting=; expires=" + when.toGMTString();
  when.setMonth(when.getMonth() + 1)
  var counting = document.forms[0].saved.value;
  document.cookie = "counting="+counting+"; expires=" + when.toGMTString()
          }
  welcome()
  // -->
  </SCRIPT>
  </BODY>
  </HTML>
Assignee: mccabe → morse
Component: Javascript Engine → Cookies
QA Contact: rginda → tever
Most likely a cookie bug - reassigning there.
I think I can can answer this.  I don't know if it was a cookie bug or not, but
there was a period when cookies were replicating themselves---each time the
browser was run, the cookies were duplicated.  The existance of multiple cookies
confused the browser-buster page counter, and it generated a NaN cookie value.

The bug was eventually fixed and duplicate cookies disappeared.  But if you had
picked up the NaN, it stayed around (NaN composed with anything is still NaN).
As far as I can tell, the only way to get rid of it is to edit the cookies file
and delete the line (while the browser isn't running, of course).

If there's a residual bug, it's that a malformed cookie file with two values (on
two lines) for the same cookie aren't cleaned out.
yes, it appears that the bug has morfed a bit.
instead of [NAN] to the frame window, the following goes
to the console

title string = [JS World.com - Mozilla]
JavaScript Error: null
URL: http://komodo.mozilla.org/buster/count.html
LineNo: 19
Assignee: morse → mccabe
It's not a cookie bug but a javascript engine bug.  A javascript error is
being raised.

Below is a reduced test case based on the html shown in this report.  It works
fine in 4.x (giving an alert box with the value of 1).  But in a recent
seamonkey build it raises the same javascript error, namley "document.forms[0]
has no properties".

Interestingly, if I change the <!-- BODY --> tag to be <BODY>, it works fine.  I
have no idea what these dashes and the exclamation mark are supposed to do.

Reassigning back to javascript team.

<HTML>
  <!-- BODY -->
    <SCRIPT>
      document.write("<FORM><INPUT TYPE=HIDDEN NAME='saved' value='1'></FORM>")
      function welcome() {
        alert(document.forms[0].saved.value);
      }
      welcome()
    </SCRIPT>
  </BODY>
</HTML>
Assignee: mccabe → vidur
Component: Cookies → DOM Level 0
QA Contact: tever → desale
<!-- --> make an HTML comment.  My guess is that the script is showing up in the
<HEAD> of the document in one case, and in the <BODY> in the other, and this is
exposing something different in Mozilla about how we bring document or
document.forms into the scope.

Reassigning to the DOM component.
Assignee: vidur → harishd
The null error problem was introduced and fixed by pollmann earlier this
morning.

We're still getting a script error (document.forms[0] has no properties) on the
page count page http://komodo.mozilla.org/buster/count.html. The reason is that
the document.write of the <FORM><INPUT...></FORM> results in the parser
(actually the NavDTD) holding on to the tags in its misplaced content list
(since a BODY hasn't been explicitly opened). Passing this one along to harishd
- seems like we might need to flush the misplaced content list if the content
comes from a document.write.
Priority: P3 → P2
Target Milestone: M14
*** Bug 24479 has been marked as a duplicate of this bug. ***
Adding Clayton to the CC list.
FIXED by opening up BODY for INPUT ( emulating IE to an extent ). BTW, this fix 
is quirks mode only.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Verified with 2000-02-02-14.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.