tor-browser

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

test_bug1160342_marquee.html (11901B)


      1 <!DOCTYPE html>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1160342
      5 -->
      6 <head>
      7  <title>Test for Bug 411103</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     10 </head>
     11 <body>
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1160342">Mozilla Bug 1160342</a>
     13 <p id="display"></p>
     14 <div id="content">
     15 <marquee id="a" style="border: 1px solid black;">marquee</marquee>
     16 </div>
     17 
     18 <pre id="test">
     19 <script class="testbody" type="text/javascript">
     20 /* The todos are cases where IE/Edge is throwing errors, but
     21   for Mozilla it was decided to not do that for now */
     22  var x=document.getElementById('a');
     23 
     24  SimpleTest.waitForExplicitFinish();
     25 
     26  setTimeout(function() {
     27    is(x.behavior, "scroll", "Wrong behavior value");
     28    x.setAttribute('behavior', 'alternate');
     29    is(x.behavior, "alternate", "Wrong behavior value");
     30    x.setAttribute('behavior', 'invalid');
     31    is(x.behavior, "scroll", "Wrong behavior value");;
     32    x.setAttribute('behavior', 'Scroll');
     33    is(x.behavior, "scroll", "Wrong behavior value");
     34    x.setAttribute('behavior', 'Slide');
     35    is(x.behavior, "slide", "Wrong behavior value");
     36    x.setAttribute('behavior', '');
     37    is(x.behavior, "scroll", "Wrong behavior value");
     38    x.setAttribute('behavior', 'slide');
     39    x.removeAttribute('behavior');
     40    is(x.behavior, "scroll", "Wrong behavior value");
     41    is(x.getAttribute('behavior'), null, "Wrong behavior attribute");
     42 
     43    x.behavior = 'alternate';
     44    is(x.behavior, "alternate", "Wrong behavior value");
     45    x.behavior = 'invalid';
     46    is(x.behavior, "scroll", "Wrong behavior value");
     47    is(x.getAttribute('behavior'), "invalid", "Wrong behavior attribute");
     48    x.behavior = 'Slide';
     49    is(x.behavior, "slide", "Wrong behavior value");
     50    is(x.getAttribute('behavior'), "Slide", "Wrong behavior attribute");
     51    x.behavior = 'invalid';
     52    is(x.behavior, "scroll", "Wrong behavior value");
     53    x.behavior = null;
     54    is(x.behavior, "scroll", "Wrong behavior value");
     55    x.behavior = undefined;
     56    is(x.behavior, "scroll", "Wrong behavior value");
     57    is(x.getAttribute('behavior'), 'undefined', "Wrong behavior attribute");
     58    // This doesn't work in Mozilla due to chrome XBL security issues
     59    x.behavior = { toString: function _toString() { return "scroll"} }
     60    is(x.behavior, x.getAttribute('behavior'), "Wrong behavior value");
     61    x.behavior = 'scroll';
     62    is(x.behavior, "scroll", "Wrong behavior value");
     63 
     64    is(x.loop, -1, "Wrong loop value");
     65    x.setAttribute('loop', '1');
     66    is(x.loop, 1, "Wrong loop value");
     67    x.setAttribute('loop', 'invalid');
     68    is(x.loop, -1, "Wrong loop value");
     69    x.setAttribute('loop', '');
     70    is(x.loop, -1, "Wrong loop value");
     71    x.setAttribute('loop', '0');
     72    is(x.loop, -1, "Wrong loop value");
     73    x.setAttribute('loop', '1000');
     74    is(x.loop, 1000, "Wrong loop value");
     75    x.setAttribute('loop', '-0.123');
     76    is(x.loop, -1, "Wrong loop value");
     77    x.setAttribute('loop', '-1.123');
     78    is(x.loop, -1, "Wrong loop value");
     79    x.setAttribute('loop', '-1');
     80    is(x.loop, -1, "Wrong loop value");
     81    x.setAttribute('loop', '1000');
     82    is(x.loop, 1000, "Wrong loop value");
     83    x.removeAttribute('loop');
     84    is(x.loop, -1, "Wrong loop value");
     85    is(x.getAttribute('loop'), null, "Wrong loop attribute");
     86 
     87    x.loop = 1;
     88    is(x.loop, 1, "Wrong loop value");
     89    is(x.getAttribute('loop'), "1", "Wrong loop attribute");
     90    try {
     91      x.loop = -2;
     92      todo_is(false, true, "marquee.loop = -2 should throw");
     93    } catch(e) {
     94      ok(true, "Exception was raised");
     95    }
     96    is(x.loop, 1, "Wrong loop value");
     97    is(x.getAttribute('loop'), "1", "Wrong loop attribute");
     98    try {
     99      x.loop = 'invalid';
    100      todo_is(false, true, ".loop = 'invalid' should throw");
    101    } catch(e) {
    102      ok(true, "Exception was raised");
    103    }
    104    is(x.loop, 1, "Wrong loop value");
    105    is(x.getAttribute('loop'), "1", "Wrong loop attribute");
    106    try {
    107      x.loop = null;
    108      todo_is(false, true, "marquee.loop = null should throw");
    109    } catch(e) {
    110      ok(true, "Exception was raised");
    111    }
    112    is(x.loop, 1, "Wrong loop value");
    113    is(x.getAttribute('loop'), "1", "Wrong loop attribute");
    114    x.loop = -1;
    115    is(x.loop, -1, "Wrong loop value");
    116    is(x.getAttribute('loop'), "-1", "Wrong loop attribute");
    117    x.loop = '100';
    118    is(x.loop, 100, "Wrong loop value");
    119    is(x.getAttribute('loop'), "100", "Wrong loop attribute");
    120    try {
    121      x.loop = -0.123;
    122      todo_is(false, true, "marquee.loop = -0.123 should throw");
    123    } catch(e) {
    124      ok(true, "Exception was raised");
    125    }
    126    is(x.loop, 100, "Wrong loop value");
    127    is(x.getAttribute('loop'), "100", "Wrong loop attribute");
    128    try {
    129      x.loop = 0;
    130      todo_is(false, true, "marquee.loop = 0 should throw");
    131    } catch(e) {
    132      ok(true, "Exception was raised");
    133    }
    134    is(x.loop, 100, "Wrong loop value");
    135    is(x.getAttribute('loop'), "100", "Wrong loop attribute");
    136    x.loop = -1.123;
    137    is(x.loop, -1, "Wrong loop value");
    138    is(x.getAttribute('loop'), "-1", "Wrong loop attribute");
    139 
    140 
    141    is(x.scrollAmount, 6, "Wrong scrollAmount value");
    142    x.setAttribute('scrollAmount', '1');
    143    is(x.scrollAmount, 1, "Wrong scrollAmount value");
    144    x.setAttribute('scrollAmount', 'invalid');
    145    is(x.scrollAmount, 6, "Wrong scrollAmount value");
    146    x.setAttribute('scrollAmount', '1000');
    147    is(x.scrollAmount, 1000, "Wrong scrollAmount value");
    148    x.setAttribute('scrollAmount', '-1');
    149    is(x.scrollAmount, 6, "Wrong scrollAmount value");
    150    x.setAttribute('scrollAmount', '999');
    151    is(x.scrollAmount, 999, "Wrong scrollAmount value");
    152    x.setAttribute('scrollAmount', '');
    153    is(x.scrollAmount, 6, "Wrong scrollAmount value");
    154    x.setAttribute('scrollAmount', '999');
    155    x.removeAttribute('scrollAmount');
    156    is(x.scrollAmount, 6, "Wrong scrollAmount value");
    157    is(x.getAttribute('scrollamount'), null, "Wrong scrollamount attribute");
    158 
    159    x.scrollAmount = 1;
    160    is(x.scrollAmount, 1, "Wrong scrollAmount value");
    161    is(x.getAttribute('scrollamount'), "1", "Wrong scrollamount attribute");
    162    x.scrollAmount = -2;
    163    is(x.scrollAmount, 6, "Wrong scrollAmount value");
    164    is(x.getAttribute('scrollamount'), "6", "Wrong scrollamount attribute");
    165    x.scrollAmount = 'invalid';
    166    is(x.scrollAmount, 0, "Wrong scrollAmount value");
    167    is(x.getAttribute('scrollamount'), "0", "Wrong scrollamount attribute");
    168    x.scrollAmount = 1;
    169    x.scrollAmount = null;
    170    is(x.scrollAmount, 0, "Wrong scrollAmount value");
    171    is(x.getAttribute('scrollamount'), "0", "Wrong scrollamount attribute");
    172    x.scrollAmount = '2';
    173    is(x.scrollAmount, 2, "Wrong scrollAmount value");
    174    is(x.getAttribute('scrollamount'), "2", "Wrong scrollamount attribute");
    175 
    176    is(x.scrollDelay, 85, "Wrong scrollDelay value");
    177    x.setAttribute('scrollDelay', '1');
    178    is(x.scrollDelay, 1, "Wrong scrollDelay value");
    179    x.setAttribute('scrollDelay', 'invalid');
    180    is(x.scrollDelay, 85, "Wrong scrollDelay value");
    181    x.setAttribute('scrollDelay', '70');
    182    is(x.scrollDelay, 70, "Wrong scrollDelay value");
    183    x.setAttribute('scrollDelay', '59');
    184    is(x.scrollDelay, 59, "Wrong scrollDelay value");
    185    x.setAttribute('scrollDelay', '1000');
    186    is(x.scrollDelay, 1000, "Wrong scrollDelay value");
    187    x.setAttribute('scrollDelay', '-1');
    188    is(x.scrollDelay, 85, "Wrong scrollDelay value");
    189    x.setAttribute('scrollDelay', '');
    190    is(x.scrollDelay, 85, "Wrong scrollDelay value");
    191    x.setAttribute('scrollDelay', '1000');
    192    x.removeAttribute('scrollDelay');
    193    is(x.scrollDelay, 85, "Wrong scrollDelay value");
    194    is(x.getAttribute('scrolldelay'), null, "Wrong scrolldelay attribute");
    195 
    196    x.scrollDelay = 100;
    197    is(x.scrollDelay, 100, "Wrong scrollDelay value");
    198    is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute");
    199    x.scrollDelay = -2;
    200    is(x.scrollDelay, 85, "Wrong scrollDelay value");
    201    is(x.getAttribute('scrolldelay'), "85", "Wrong scrolldelay attribute");
    202    x.scrollDelay = 'invalid';
    203    is(x.scrollDelay, 0, "Wrong scrollDelay value");
    204    is(x.getAttribute('scrolldelay'), "0", "Wrong scrolldelay attribute");
    205    x.scrollDelay = null;
    206    is(x.scrollDelay, 0, "Wrong scrollDelay value");
    207    is(x.getAttribute('scrolldelay'), "0", "Wrong scrolldelay attribute");
    208    x.scrollDelay = -1;
    209    is(x.scrollDelay, 85, "Wrong scrollDelay value");
    210    is(x.getAttribute('scrolldelay'), "85", "Wrong scrolldelay attribute");
    211    x.scrollDelay = '50';
    212    is(x.scrollDelay, 50, "Wrong scrollDelay value");
    213    is(x.getAttribute('scrolldelay'), "50", "Wrong scrolldelay attribute");
    214 
    215 
    216    is(x.trueSpeed, false, "Wrong trueSpeed value");
    217    x.setAttribute('trueSpeed', '1');
    218    is(x.trueSpeed, true, "Wrong trueSpeed value");
    219    x.setAttribute('trueSpeed', 'false');
    220    is(x.trueSpeed, true, "Wrong trueSpeed value");
    221    x.setAttribute('trueSpeed', '');
    222    is(x.trueSpeed, true, "Wrong trueSpeed value");
    223    x.removeAttribute('trueSpeed');
    224    is(x.trueSpeed, false, "Wrong trueSpeed value");
    225    is(x.getAttribute('truespeed'), null, "Wrong truespeed attribute");
    226 
    227    x.trueSpeed = 1;
    228    is(x.trueSpeed, true, "Wrong trueSpeed value");
    229    is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute");
    230    x.trueSpeed = -2;
    231    is(x.trueSpeed, true, "Wrong trueSpeed value");
    232    is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute");
    233    x.trueSpeed = null;
    234    is(x.trueSpeed, false, "Wrong trueSpeed value");
    235    is(x.getAttribute('truespeed'), null, "Wrong truespeed attribute");
    236    x.trueSpeed = '100';
    237    is(x.trueSpeed, true, "Wrong trueSpeed value");
    238    is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute");
    239 
    240 
    241    is(x.direction, "left", "Wrong direction value");
    242    x.setAttribute('direction', 'right');
    243    is(x.direction, "right", "Wrong direction value");
    244    x.setAttribute('direction', 'invalid');
    245    is(x.direction, "left", "Wrong direction value");
    246    x.setAttribute('direction', 'RIGHT');
    247    is(x.direction, "right", "Wrong direction value");
    248    x.setAttribute('direction', '');
    249    is(x.direction, "left", "Wrong direction value");
    250    x.setAttribute('direction', 'right');
    251    x.removeAttribute('direction');
    252    is(x.direction, "left", "Wrong direction value");
    253    is(x.getAttribute('direction'), null, "Wrong direction attribute");
    254    x.setAttribute('direction', 'up');
    255    is(x.direction, "up", "Wrong direction value");
    256    x.setAttribute('direction', 'down');
    257    is(x.direction, "down", "Wrong direction value");
    258    x.removeAttribute('direction');
    259    is(x.direction, "left", "Wrong direction value");
    260    is(x.getAttribute('direction'), null, "Wrong direction attribute");
    261 
    262    x.direction = 'right';
    263    is(x.direction, "right", "Wrong direction value");
    264    is(x.getAttribute('direction'), "right", "Wrong direction attribute");
    265    x.direction = 'up';
    266    is(x.direction, "up", "Wrong direction value");
    267    is(x.getAttribute('direction'), "up", "Wrong direction attribute");
    268    x.direction = 'down';
    269    is(x.direction, "down", "Wrong direction value");
    270    is(x.getAttribute('direction'), "down", "Wrong direction attribute");
    271    x.direction = 1;
    272    is(x.direction, "left", "Wrong direction value");
    273    is(x.getAttribute('direction'), "1", "Wrong direction attribute");
    274    x.direction = null;
    275    is(x.direction, "left", "Wrong direction value");
    276    is(x.getAttribute('direction'), "null", "Wrong direction attribute");
    277    // This doesn't work in Mozilla due to chrome XBL security issues
    278    x.direction = { toString: function _toString() { return "right"} }
    279    is(x.direction, x.getAttribute('direction'), "Wrong direction value");
    280    x.direction = 'left';
    281    is(x.direction, "left", "Wrong direction value");
    282    SimpleTest.finish();
    283  }, 0);
    284 
    285 </script>
    286 </pre>
    287 </body>
    288 </html>