js/src/tests/js1_3/inherit/proto_12.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.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8    File Name:          proto_12.js
     9    Section:
    10    Description:        new PrototypeObject
    12    This tests Object Hierarchy and Inheritance, as described in the document
    13    Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
    14    15:19:34 on http://devedge.netscape.com/.  Current URL:
    15    http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
    17    No Multiple Inheritance
    19    Author:             christine@netscape.com
    20    Date:               12 november 1997
    21 */
    23 var SECTION = "proto_12";
    24 var VERSION = "JS1_3";
    25 var TITLE   = "No Multiple Inheritance";
    27 startTest();
    28 writeHeaderToLog( SECTION + " "+ TITLE);
    30 function Employee ( name, dept ) {
    31   this.name = name || "";
    32   this.dept = dept || "general";
    33   this.id = idCounter++;
    34 }
    35 function Manager () {
    36   this.reports = [];
    37 }
    38 Manager.prototype = new Employee();
    40 function WorkerBee ( name, dept, projs ) {
    41   this.base = Employee;
    42   this.base( name, dept)
    43     this.projects = projs || new Array();
    44 }
    45 WorkerBee.prototype = new Employee();
    47 function SalesPerson () {
    48   this.dept = "sales";
    49   this.quota = 100;
    50 }
    51 SalesPerson.prototype = new WorkerBee();
    53 function Hobbyist( hobby ) {
    54   this.hobby = hobby || "yodeling";
    55 }
    57 function Engineer ( name, projs, machine, hobby ) {
    58   this.base1 = WorkerBee;
    59   this.base1( name, "engineering", projs )
    61     this.base2 = Hobbyist;
    62   this.base2( hobby );
    64   this.projects = projs || new Array();
    65   this.machine = machine || "";
    66 }
    67 Engineer.prototype = new WorkerBee();
    69 var idCounter = 1;
    71 var les = new Engineer( "Morris, Les",  new Array("JavaScript"), "indy" );
    73 Hobbyist.prototype.equipment = [ "horn", "mountain", "goat" ];
    75 new TestCase( SECTION,
    76 	      "les.name",
    77 	      "Morris, Les",
    78 	      les.name );
    80 new TestCase( SECTION,
    81 	      "les.dept",
    82 	      "engineering",
    83 	      les.dept );
    85 Array.prototype.getClass = Object.prototype.toString;
    87 new TestCase( SECTION,
    88 	      "les.projects.getClass()",
    89 	      "[object Array]",
    90 	      les.projects.getClass() );
    92 new TestCase( SECTION,
    93 	      "les.projects[0]",
    94 	      "JavaScript",
    95 	      les.projects[0] );
    97 new TestCase( SECTION,
    98 	      "les.machine",
    99 	      "indy",
   100 	      les.machine );
   102 new TestCase( SECTION,
   103 	      "les.hobby",
   104 	      "yodeling",
   105 	      les.hobby );
   107 new TestCase( SECTION,
   108 	      "les.equpment",
   109 	      void 0,
   110 	      les.equipment );
   112 test();

mercurial