linux browser buster shows [NAN] for page count cookie

VERIFIED FIXED in M14

Status

()

Core
DOM: Core & HTML
P2
normal
VERIFIED FIXED
18 years ago
18 years ago

People

(Reporter: chris hofmann, Assigned: harishd)

Tracking

Trunk
x86
Windows 95
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

18 years ago
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>

Updated

18 years ago
Assignee: mccabe → morse
Component: Javascript Engine → Cookies
QA Contact: rginda → tever

Comment 1

18 years ago
Most likely a cookie bug - reassigning there.

Comment 2

18 years ago
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.
(Reporter)

Comment 3

18 years ago
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

Updated

18 years ago
Assignee: morse → mccabe

Comment 4

18 years ago
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>

Updated

18 years ago
Assignee: mccabe → vidur
Component: Cookies → DOM Level 0
QA Contact: tever → desale

Comment 5

18 years ago
<!-- --> 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.

Updated

18 years ago
Assignee: vidur → harishd

Comment 6

18 years ago
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.
(Assignee)

Updated

18 years ago
Priority: P3 → P2
Target Milestone: M14
(Assignee)

Comment 7

18 years ago
*** Bug 24479 has been marked as a duplicate of this bug. ***
(Assignee)

Comment 8

18 years ago
Adding Clayton to the CC list.
(Assignee)

Comment 9

18 years ago
FIXED by opening up BODY for INPUT ( emulating IE to an extent ). BTW, this fix 
is quirks mode only.
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED

Comment 10

18 years ago
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.