#73 ✓resolved
George V. Reilly

Non-fatal "Fatal Error"

Reported by George V. Reilly | September 22nd, 2009 @ 11:39 AM | in 1.1 Release

I sort of have things working with the latest env.js, but I'm getting
this "Fatal Error" which doesn't actually stop execution. I don't see
this error running your test.js.

Here's a small repro case, taken on a 64-bit Windows 7 RC system with env-js.1.0.rc7.

d:\WebClient_JSTests>c:\Windows\System32\java.exe -version
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)

d:\WebClient_JSTests>"C:\Windows\System32\java.exe" - Dfile.encoding=utf-8 -jar "dist\env-js.jar" "d:\WebClient_JSTests
\test2.js"

INFO:  [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS} adding

value to history: file:/d:/WebClient_JSTests/index.html

ERROR: [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS} Fatal

Error: Document: only comments, processing instructions, or whitespace
allowed outside of document element
Line: 1 Column: 1

Line: (line ?)
ERROR: [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS}
ERROR: [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS} [object

Object] Line: (line ?)

ERROR: [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS}
INFO:  [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS}

Sucessfully loaded document at file:/d:/WebClient_JSTests/index.html
PASS (1) [StringUtilTests] okay: Alpha PASS (2) [StringUtilTests] okay: Alpha and Beta PASS (3) [StringUtilTests] okay: Alpha, Beta, and Gamma PASS (4) [StringUtilTests] okay: Neither Alpha, Beta, nor Gamma PASS (5) [StringUtilTests] okay: Alpha, Beta, Gamma, and Delta PASS (6) [StringUtilTests] okay: Alpha, Beta, Gamma, or Delta 6 Passed, 0 Failed, 0 Errors, 6 Total Tests

Rhino exit code: 0

========= test2.js ===============

load("dist/env.rhino.js");

window.onload = function() {
load("test/testrunner.js"); load("StringUtil2.js"); results(); };

window.location = "index.html";

======== StringUtil2.js ===========

// Concatenate words into a comma-separated list, with conjunction as the final separator,
// according to the normal rules of English. concatWordList = function(words, conjunction)
{ var n = words.length; conjunction = " " + (conjunction || "and") + " " ; // http://en.wikipedia.org/wiki/Serial_comma: place comma before a conjunction, for n > 2
conjunction = (n <= 1) ? "" : (n == 2) ? conjunction : "," + conjunction;
return words.slice(0, -1).join(", ") + conjunction + words.slice (-1); };

module("StringUtilTests");

test("concatWordList", function()
{ expect(6); equals('Alpha', concatWordList(['Alpha'])); equals('Alpha and Beta', concatWordList(['Alpha', 'Beta'])); equals('Alpha, Beta, and Gamma', concatWordList(['Alpha', 'Beta', 'Gamma'])); equals('Neither Alpha, Beta, nor Gamma', 'Neither ' + concatWordList(['Alpha', 'Beta', 'Gamma'], 'nor'));
equals('Alpha, Beta, Gamma, and Delta', concatWordList(['Alpha', 'Beta', 'Gamma', 'Delta'])); equals('Alpha, Beta, Gamma, or Delta', concatWordList(['Alpha', 'Beta', 'Gamma', 'Delta'], 'or')); });

======== index.html ===========

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
dir="ltr" id="html">


JavaScript Test Suite


JavaScript Test Suite

<!-- this iframe is outside the #main so it won't reload constantly wasting time, but it means the tests must be "safe" and<br/> clean up after themselves -->


Comments and changes to this ticket

  • George V. Reilly

    George V. Reilly September 22nd, 2009 @ 02:07 PM

    Let's try that test case again. Lighthouse mangled the formatting.

       d:\WebClient_JSTests>"C:\Windows\System32\java.exe" -
    Dfile.encoding=utf-8 -jar "dist\env-js.jar" "d:\WebClient_JSTests
    \test2.js"
    
        INFO:  [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS} adding
    value to history: file:/d:/WebClient_JSTests/index.html
        ERROR: [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS} Fatal
    Error: Document: only comments, processing instructions, or whitespace
    allowed outside of document element
       Line: 1
       Column: 1
        Line: (line ?)
        ERROR: [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS}
        ERROR: [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS} [object
    Object] Line: (line ?)
        ERROR: [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS}
        INFO:  [Thu Sep 17 2009 18:13:16 GMT-0700 (PDT)] {ENVJS}
    Sucessfully loaded document at file:/d:/WebClient_JSTests/index.html
       PASS (1) [StringUtilTests] okay: Alpha
       PASS (2) [StringUtilTests] okay: Alpha and Beta
       PASS (3) [StringUtilTests] okay: Alpha, Beta, and Gamma
       PASS (4) [StringUtilTests] okay: Neither Alpha, Beta, nor Gamma
       PASS (5) [StringUtilTests] okay: Alpha, Beta, Gamma, and Delta
       PASS (6) [StringUtilTests] okay: Alpha, Beta, Gamma, or Delta
       6 Passed, 0 Failed, 0 Errors, 6 Total Tests
    
       Rhino exit code: 0
    
    ========= test2.js ===============
    
    load("dist/env.rhino.js");
    
    window.onload = function() {
       load("test/testrunner.js");
       load("StringUtil2.js");
       results();
    };
    
    window.location = "index.html";
    
    ======== StringUtil2.js ===========
    
    // Concatenate `words` into a comma-separated list, with `conjunction`
    as the final separator,
    // according to the normal rules of English.
    concatWordList = function(words, conjunction)
    {
       var n = words.length;
       conjunction = " " + (conjunction || "and") + " " ;
       // http://en.wikipedia.org/wiki/Serial_comma: place comma before a
    conjunction, for n > 2
       conjunction = (n <= 1) ? "" : (n == 2) ? conjunction : "," +
    conjunction;
       return words.slice(0, -1).join(", ") + conjunction + words.slice
    (-1);
    };
    
    module("StringUtilTests");
    
    test("concatWordList", function()
    {
       expect(6);
       equals('Alpha', concatWordList(['Alpha']));
       equals('Alpha and Beta', concatWordList(['Alpha', 'Beta']));
       equals('Alpha, Beta, and Gamma', concatWordList(['Alpha', 'Beta',
    'Gamma']));
       equals('Neither Alpha, Beta, nor Gamma', 'Neither ' +
    concatWordList(['Alpha', 'Beta', 'Gamma'], 'nor'));
       equals('Alpha, Beta, Gamma, and Delta', concatWordList(['Alpha',
    'Beta', 'Gamma', 'Delta']));
       equals('Alpha, Beta, Gamma, or Delta', concatWordList(['Alpha',
    'Beta', 'Gamma', 'Delta'], 'or'));
    });
    
    ======== index.html ===========
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
    www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
    dir="ltr" id="html">
    <head>
       <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
       <title>JavaScript Test Suite</title>
       <link rel="Stylesheet" media="screen" href="browser/
    testsuite.css" />
       <script type="text/javascript" src="../WebClient/scripts/third-
    party/jquery.js"></script>
       <script type="text/javascript" src="browser/testrunner.js"></
    script>
    
       <script type="text/javascript" src="StringUtil2.js"></script>
    </head>
    
    <body id="body">
       <h1 id="header">JavaScript Test Suite</h1>
       <h2 id="banner"></h2>
       <h2 id="userAgent"></h2>
    
       <!-- this iframe is outside the #main so it won't reload
    constantly wasting time, but it means the tests must be "safe" and
    clean up after themselves -->
       <iframe id="loadediframe" name="loadediframe"
    style="display:none;" src="browser/iframe.html"></iframe>
       <dl id="dl" style="display:none;">
       <div id="main" style="display:none;">
       </div>
       </dl>
    
       <ol id="tests"></ol>
    
    </body>
    </html>
    
  • Thatcher

    Thatcher October 28th, 2009 @ 01:23 PM

    • State changed from “new” to “open”
    • Milestone set to 1.1 Release

    [responsible:id#36440 state:"open" milestone:id#49862 bulk edit command]

  • Thatcher

    Thatcher October 29th, 2009 @ 04:30 PM

    going to reassign this to 1.2 since we are trying to release 1.1 and this is not quite a blocker. Thanks for the detailed description though. It still is an issue though and the new parser for 1.2 will likely resolve it.

  • Thatcher
  • Thatcher

    Thatcher November 12th, 2009 @ 05:11 AM

    • State changed from “open” to “resolved”
    • Milestone set to 1.1 Release

    should be fixed with new html5 parsing engine integration

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

a javascript browser environment

People watching this ticket

Referenced by

Pages