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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // |reftest| skip -- obsolete test
     2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 //-----------------------------------------------------------------------------
     8 var BUGNUMBER = 320119;
     9 var summary = 'delegating objects and arguments, arity, caller, name';
    10 var actual = '';
    11 var expect = '';
    13 printBugNumber(BUGNUMBER);
    14 printStatus (summary);
    16 printStatus('original test');
    18 function origtest(name, bar)
    19 {
    20   this.name = name;
    21   this.bar = bar;
    22 }
    24 function Monty(id, name, bar)
    25 {
    26   this.id = id;
    27   this.base = origtest;
    28   this.base(name, bar);
    29 }
    31 Monty.prototype = origtest;
    33 function testtwo(notNamedName, bar)
    34 {
    35   this.name = notNamedName;
    36   this.bar = bar;
    37 }
    39 function Python(id, notNamedName, bar)
    40 {
    41   this.id = id;
    42   this.base = origtest;
    43   this.base(notNamedName, bar);
    44 }
    46 Python.prototype = testtwo;
    48 var foo = new Monty(1, 'my name', 'sna!');
    50 var manchu = new Python(1, 'my name', 'sna!');
    52 printStatus('foo.name: ' + foo.name);
    53 printStatus('manchu.name: ' + manchu.name);
    55 expect = 'my name:my name';
    56 actual = foo.name + ':' + manchu.name;
    57 reportCompare(expect, actual, summary + ': override function..name');
    59 // end original test
    61 printStatus('test shared properties');
    63 function testshared()
    64 {
    65 }
    67 expect = false;
    68 actual = testshared.hasOwnProperty('arguments');
    69 reportCompare(expect, actual, summary + ': arguments no longer shared');
    71 expect = false;
    72 actual = testshared.hasOwnProperty('caller');
    73 reportCompare(expect, actual, summary + ': caller no longer shared');
    75 expect = false;
    76 actual = testshared.hasOwnProperty('arity');
    77 reportCompare(expect, actual, summary + ': arity no longer shared');
    79 expect = false;
    80 actual = testshared.hasOwnProperty('name');
    81 reportCompare(expect, actual, summary + ': name no longer shared');
    83 expect = true;
    84 actual = testshared.hasOwnProperty('length');
    85 reportCompare(expect, actual, summary + ': length still shared');
    87 printStatus('test overrides');
    89 function Parent()
    90 {
    91   this.arguments = 'oarguments';
    92   this.caller = 'ocaller';
    93   this.arity = 'oarity';
    94   this.length = 'olength';
    95   this.name = 'oname';
    96 }
    98 function Child()
    99 {
   100   this.base = Parent;
   101   this.base();
   102 }
   104 Child.prototype = Parent;
   106 Child.prototype.value = function()
   107 {
   108   return this.arguments + ',' + this.caller + ',' + this.arity + ',' +
   109   this.length + ',' + this.name;
   110 };
   112 var child = new Child();
   114 expect = 'oarguments,ocaller,oarity,0,oname';
   115 actual = child.value();
   116 reportCompare(expect, actual, summary + ': overrides');

mercurial