tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

regress-31255.js (1980B)


      1 /* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 /*
      7 *
      8 * Date:    09 November 2002
      9 * SUMMARY: JS should treat --> as a single-line comment indicator.
     10 *          Whitespace may occur before the --> on the same line.
     11 *
     12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=31255
     13 * and http://bugzilla.mozilla.org/show_bug.cgi?id=179366 (Rhino version)
     14 *
     15 * Note: <!--, --> are the HTML multi-line comment opener, closer.
     16 * JS already accepted <!-- as a single-line comment indicator.
     17 *
     18 */
     19 //-----------------------------------------------------------------------------
     20 var UBound = 0;
     21 var BUGNUMBER = 31255;
     22 var summary = 'JS should treat --> as a single-line comment indicator';
     23 var status = '';
     24 var statusitems = [];
     25 var actual = '';
     26 var actualvalues = [];
     27 var expect= '';
     28 var expectedvalues = [];
     29 
     30 
     31 <!-- HTML comment start is already a single-line JS comment indicator
     32 var x = 1; <!-- until end-of-line
     33 
     34      status = inSection(1);
     35 actual = (x == 1);
     36 expect = true;
     37 addThis();
     38 
     39 --> HTML comment end is JS comments until end-of-line
     40 --> but only if it follows a possible whitespace after line start
     41 --> so in the following --> should not be treated as comments
     42 if (x-->0)
     43  x = 2;
     44 
     45 status = inSection(2);
     46 actual = (x == 2);
     47 expect = true;
     48 addThis();
     49 
     50 
     51 
     52 //-----------------------------------------------------------------------------
     53 test();
     54 //-----------------------------------------------------------------------------
     55 
     56 
     57 
     58 function addThis()
     59 {
     60  statusitems[UBound] = status;
     61  actualvalues[UBound] = actual;
     62  expectedvalues[UBound] = expect;
     63  UBound++;
     64 }
     65 
     66 
     67 function test()
     68 {
     69  printBugNumber(BUGNUMBER);
     70  printStatus(summary);
     71 
     72  for (var i=0; i<UBound; i++)
     73  {
     74    reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
     75  }
     76 }