js/src/tests/js1_3/inherit/proto_4.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 File Name: proto_4.js
michael@0 9 Section:
michael@0 10 Description: new PrototypeObject
michael@0 11
michael@0 12 This tests Object Hierarchy and Inheritance, as described in the document
michael@0 13 Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
michael@0 14 15:19:34 on http://devedge.netscape.com/. Current URL:
michael@0 15 http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
michael@0 16
michael@0 17 This tests the syntax ObjectName.prototype = new PrototypeObject using the
michael@0 18 Employee example in the document referenced above.
michael@0 19
michael@0 20 If you add a property to an object in the prototype chain, instances of
michael@0 21 objects that derive from that prototype should inherit that property, even
michael@0 22 if they were instatiated after the property was added to the prototype object.
michael@0 23
michael@0 24
michael@0 25 Author: christine@netscape.com
michael@0 26 Date: 12 november 1997
michael@0 27 */
michael@0 28
michael@0 29 var SECTION = "proto_3";
michael@0 30 var VERSION = "JS1_3";
michael@0 31 var TITLE = "Adding properties to the prototype";
michael@0 32
michael@0 33 startTest();
michael@0 34 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 35
michael@0 36 function Employee () {
michael@0 37 this.name = "";
michael@0 38 this.dept = "general";
michael@0 39 }
michael@0 40 function Manager () {
michael@0 41 this.reports = [];
michael@0 42 }
michael@0 43 Manager.prototype = new Employee();
michael@0 44
michael@0 45 function WorkerBee () {
michael@0 46 this.projects = new Array();
michael@0 47 }
michael@0 48
michael@0 49 WorkerBee.prototype = new Employee();
michael@0 50
michael@0 51 function SalesPerson () {
michael@0 52 this.dept = "sales";
michael@0 53 this.quota = 100;
michael@0 54 }
michael@0 55 SalesPerson.prototype = new WorkerBee();
michael@0 56
michael@0 57 function Engineer () {
michael@0 58 this.dept = "engineering";
michael@0 59 this.machine = "";
michael@0 60 }
michael@0 61 Engineer.prototype = new WorkerBee();
michael@0 62
michael@0 63 var jim = new Employee();
michael@0 64 var terry = new Engineer();
michael@0 65 var sean = new SalesPerson();
michael@0 66 var wally = new Manager();
michael@0 67
michael@0 68 Employee.prototype.specialty = "none";
michael@0 69
michael@0 70 var pat = new Employee();
michael@0 71 var leslie = new Engineer();
michael@0 72 var bubbles = new SalesPerson();
michael@0 73 var furry = new Manager();
michael@0 74
michael@0 75 Engineer.prototype.specialty = "code";
michael@0 76
michael@0 77 var chris = new Engineer();
michael@0 78
michael@0 79
michael@0 80 new TestCase( SECTION,
michael@0 81 "jim = new Employee(); jim.specialty",
michael@0 82 "none",
michael@0 83 jim.specialty );
michael@0 84
michael@0 85 new TestCase( SECTION,
michael@0 86 "terry = new Engineer(); terry.specialty",
michael@0 87 "code",
michael@0 88 terry.specialty );
michael@0 89
michael@0 90 new TestCase( SECTION,
michael@0 91 "sean = new SalesPerson(); sean.specialty",
michael@0 92 "none",
michael@0 93 sean.specialty );
michael@0 94
michael@0 95 new TestCase( SECTION,
michael@0 96 "wally = new Manager(); wally.specialty",
michael@0 97 "none",
michael@0 98 wally.specialty );
michael@0 99
michael@0 100 new TestCase( SECTION,
michael@0 101 "furry = new Manager(); furry.specialty",
michael@0 102 "none",
michael@0 103 furry.specialty );
michael@0 104
michael@0 105 new TestCase( SECTION,
michael@0 106 "pat = new Employee(); pat.specialty",
michael@0 107 "none",
michael@0 108 pat.specialty );
michael@0 109
michael@0 110 new TestCase( SECTION,
michael@0 111 "leslie = new Engineer(); leslie.specialty",
michael@0 112 "code",
michael@0 113 leslie.specialty );
michael@0 114
michael@0 115 new TestCase( SECTION,
michael@0 116 "bubbles = new SalesPerson(); bubbles.specialty",
michael@0 117 "none",
michael@0 118 bubbles.specialty );
michael@0 119
michael@0 120
michael@0 121 new TestCase( SECTION,
michael@0 122 "chris = new Employee(); chris.specialty",
michael@0 123 "code",
michael@0 124 chris.specialty );
michael@0 125 test();

mercurial