js/src/tests/js1_5/Regress/regress-246964.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_5/Regress/regress-246964.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,160 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +//-----------------------------------------------------------------------------
    1.10 +var BUGNUMBER = 246964;
    1.11 +// see also bug 248549, bug 253150, bug 259935
    1.12 +var summary = 'undetectable document.all';
    1.13 +var actual = '';
    1.14 +var expect = '';
    1.15 +
    1.16 +printBugNumber(BUGNUMBER);
    1.17 +printStatus (summary);
    1.18 +
    1.19 +if (typeof document == 'undefined')
    1.20 +{
    1.21 +  expect = actual = 'Test requires browser: skipped';
    1.22 +  reportCompare(expect, actual, summary);
    1.23 +}
    1.24 +else
    1.25 +{
    1.26 +  status = summary + ' ' + inSection(1) + ' if (document.all) ';
    1.27 +  expect = false;
    1.28 +  actual = false;
    1.29 +  if (document.all)
    1.30 +  {
    1.31 +    actual = true;
    1.32 +  }
    1.33 +  reportCompare(expect, actual, status);
    1.34 +
    1.35 +  status = summary + ' ' + inSection(2) + 'if (isIE) ';
    1.36 +  expect = false;
    1.37 +  actual = false;
    1.38 +  var isIE = document.all;
    1.39 +  if (isIE)
    1.40 +  {
    1.41 +    actual = true;
    1.42 +  }
    1.43 +  reportCompare(expect, actual, status);
    1.44 +
    1.45 +  status = summary + ' ' + inSection(3) + ' if (document.all != undefined) ';
    1.46 +  expect = false;
    1.47 +  actual = false;
    1.48 +  if (document.all != undefined)
    1.49 +  {
    1.50 +    actual = true;
    1.51 +  }
    1.52 +  reportCompare(expect, actual, status);
    1.53 +
    1.54 +
    1.55 +  status = summary + ' ' + inSection(4) + ' if (document.all !== undefined) ';
    1.56 +  expect = true;
    1.57 +  actual = false;
    1.58 +  if (document.all !== undefined)
    1.59 +  {
    1.60 +    actual = true;
    1.61 +  }
    1.62 +  reportCompare(expect, actual, status);
    1.63 +
    1.64 +  status = summary + ' ' + inSection(5) + ' if (document.all != null) ' ;
    1.65 +  expect = false;
    1.66 +  actual = false;
    1.67 +  if (document.all != null)
    1.68 +  {
    1.69 +    actual = true;
    1.70 +  }
    1.71 +  reportCompare(expect, actual, status);
    1.72 +
    1.73 +  status = summary + ' ' + inSection(6) + ' if (document.all !== null) ' ;
    1.74 +  expect = true;
    1.75 +  actual = false;
    1.76 +  if (document.all !== null)
    1.77 +  {
    1.78 +    actual = true;
    1.79 +  }
    1.80 +  reportCompare(expect, actual, status);
    1.81 +
    1.82 +  status = summary + ' ' + inSection(7) + ' if (document.all == null) ';
    1.83 +  expect = true;
    1.84 +  actual = false;
    1.85 +  if (document.all == null)
    1.86 +  {
    1.87 +    actual = true;
    1.88 +  }
    1.89 +  reportCompare(expect, actual, status);
    1.90 +
    1.91 +  status = summary + ' ' + inSection(8) + ' if (document.all === null) ';
    1.92 +  expect = false;
    1.93 +  actual = false;
    1.94 +  if (document.all === null)
    1.95 +  {
    1.96 +    actual = true;
    1.97 +  }
    1.98 +  reportCompare(expect, actual, status);
    1.99 +
   1.100 +  status = summary + ' ' + inSection(9) + ' if (document.all == undefined) ';
   1.101 +  expect = true;
   1.102 +  actual = false;
   1.103 +  if (document.all == undefined)
   1.104 +  {
   1.105 +    actual = true;
   1.106 +  }
   1.107 +  reportCompare(expect, actual, status);
   1.108 +
   1.109 +  status = summary + ' ' + inSection(10) + ' if (document.all === undefined) ';
   1.110 +  expect = false;
   1.111 +  actual = false;
   1.112 +  if (document.all === undefined)
   1.113 +  {
   1.114 +    actual = true;
   1.115 +  }
   1.116 +  reportCompare(expect, actual, status);
   1.117 +
   1.118 +  status = summary + ' ' + inSection(11) +
   1.119 +    ' if (typeof document.all == "undefined") ';
   1.120 +  expect = true;
   1.121 +  actual = false;
   1.122 +  if (typeof document.all == 'undefined')
   1.123 +  {
   1.124 +    actual = true;
   1.125 +  }
   1.126 +  reportCompare(expect, actual, status);
   1.127 +
   1.128 +  status = summary + ' ' + inSection(12) +
   1.129 +    ' if (typeof document.all != "undefined") ';
   1.130 +  expect = false;
   1.131 +  actual = false;
   1.132 +  if (typeof document.all != 'undefined')
   1.133 +  {
   1.134 +    actual = true;
   1.135 +  }
   1.136 +  reportCompare(expect, actual, status);
   1.137 +
   1.138 +  status = summary + ' ' + inSection(13) + ' if ("all" in document) ';
   1.139 +  expect = (document.compatMode == 'CSS1Compat') ? false : true;
   1.140 +  actual = false;
   1.141 +  if ('all' in document)
   1.142 +  {
   1.143 +    actual = true;
   1.144 +  }
   1.145 +  reportCompare(expect, actual, status);
   1.146 +
   1.147 +  status = summary + ' ' + inSection(14) + ' if (f.ie) ';
   1.148 +  var f = new foo();
   1.149 +
   1.150 +  expect = false;
   1.151 +  actual = false;
   1.152 +  if (f.ie)
   1.153 +  {
   1.154 +    actual = true;
   1.155 +  }
   1.156 +  reportCompare(expect, actual, status);
   1.157 +
   1.158 +}
   1.159 +
   1.160 +function foo()
   1.161 +{
   1.162 +  this.ie = document.all;
   1.163 +}

mercurial