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