Some code is not get a chance to be executed

VERIFIED WORKSFORME

Status

()

VERIFIED WORKSFORME
18 years ago
17 years ago

People

(Reporter: xiaobin.lu, Assigned: rogerl)

Tracking

Trunk
x86
Windows NT
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

18 years ago
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
BuildID:    

After a loop it does not execute document.writeln.

Reproducible: Always
Steps to Reproduce:
1.Run mozilla

2.Launch HTML file below:
     <!--    -*- Mode: HTML; tab-width: 8; indent-tabs-mode: nil -*-
-->
<html>
<head>
<title>About Java Plug-ins Support</title>
</head>
<body>
<script language="JavaScript">

<!-- JavaScript to enumerate and display all installed plug-ins            -->

<!-- First, refresh plugins in case anything has been changed recently in  --> 
<!-- prefs: (The "false" argument tells refresh not to reload or activate  --> 
<!-- any plugins that would be active otherwise.  In contrast, one would   --> 
<!-- use "true" in the case of ASD instead of restarting)                  -->

navigator.plugins.refresh(false);

var numPlugins = navigator.plugins.length;
var writeOnceOut = 1;

for (var i = 0; i < numPlugins; i++)
{
       plugin = navigator.plugins[i];
       numTypes = plugin.length;

       writeOnceIn = 1;
       var found;

       for (var j = 0; j < numTypes; j++)
        {
                var mimetype = plugin[j];

                if (mimetype)
                {
                         enabled = "No";
                         enabledPlugin = mimetype.enabledPlugin;
                        if (enabledPlugin && (enabledPlugin.name == 
plugin.name))
                                enabled = "Yes";
                        mimeString = mimetype.type;
                        re = /(application\/x-java*)/i;

                        found = mimeString.match(re);

                        if(found && writeOnceOut) {
                          document.writeln("<b><font size=+3>Installed Java 
plug-ins</font></b><br>");
                          document.writeln("<p><hr>");
						  writeOnceOut = 0;
						}

                        if(found && writeOnceIn){
                          document.write("<center><font size=\"+1\"><b>");
						  document.write(plugin.name);
						  document.writeln
("</b></font></center><br>");

						  document.writeln
("<dl><dd>File name:");
						  document.write
(plugin.filename);
						  document.write("<dd><br>");
						  document.write
(plugin.description);
						  document.writeln("</dl><p>");

						  document.writeln("<table 
width=\"100%\" border=\"2\" cellpadding=\"5\">");
						  document.writeln("<tr><th 
width=\"20%\"><font size=\"-1\">Mime Type</font></th>");
						  document.writeln("<th 
width=\"50%\"><font size=\"-1\">Description</font></th>");
						  document.writeln("<th 
width=\"20%\"><font size=\"-1\">Suffixes</font></th>");
		                  document.writeln("<th><font size=\"-1
\">Enabled</th></tr>");

                          writeOnceIn = 0;
                         }

                        if(found){
                          document.writeln("<tr align=\"center\">");
                          document.writeln("<td>" + mimetype.type + "</td>");
                          document.writeln("<td>" + mimetype.description 
+ "</td>");
                          document.writeln("<td>" + mimetype.suffixes 
+ "</td>");
                          document.writeln("<td>" + enabled + "</td>");
                          document.writeln("</tr>");
                        }
                }

          }

    if(found)
        document.writeln("</table><p><hr><p>");
}

  document.writeln("Find more information about java plugin at ");
  document.writeln("<A HREF=\"http://java.sun.com/j2se/1.3/\">Sun 
Microsystems</A>.");
  document.writeln("<p><hr>");


</script>
</body>
</html>



Actual Results:  It does not print: 
   Find more information about java plugin at Sun Microsystems.

Expected Results:  After a list of table, it should print something like:
  Find more information about java plugin at Sun Microsystems.
But it does not print these lines. To my suppurise,Netscape can print these 
statesments

Comment 1

18 years ago
Using Mozilla binary 2001012504 on WinNT. WORKSFORME - I see the text

      "Find more information about java plugin at Sun Microsystems."


Xiaobin, what Mozilla BuildID were you using? And what do you see
when you go to Tasks | Tools | JavaScript Console? Hit "Clear" there,
then load the page, and look in the JavaScript Console again.
Do you see any errors there? 


When I did that, I saw an "unterminated string literal" error.
I went back to the HTML and fixed all the broken lines, and then
everything worked fine. I will attach the HTML file below - 

Comment 2

18 years ago
Created attachment 23584 [details]
The HTML testcase (with broken lines repaired)

Comment 3

18 years ago
Created attachment 23586 [details]
The HTML testcase with debugging code added -

Comment 4

18 years ago
Marking WORKSFORME - 
Status: UNCONFIRMED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → WORKSFORME

Comment 5

18 years ago
Marking Verified - 


Xiaobin, if this is still a problem for you, please reopen the bug.
But I am having no problem seeing the message

   "Find more information about java plugin at Sun Microsystems."


on both the testcasese above. Note: without cleaning up the broken
lines, NN4.7 did not print anything, either - 
Status: RESOLVED → VERIFIED
(Reporter)

Comment 6

18 years ago
  I don't know what's wrong with my system at that time. Now it works pretty 
well.

   Thanks!
You need to log in before you can comment on or make changes to this bug.