js/src/tests/js1_3/inherit/proto_6.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_6.js
     9    Section:
    10    Description:        Logical OR || in constructors
    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    This tests the syntax ObjectName.prototype = new PrototypeObject using the
    18    Employee example in the document referenced above.
    20    This tests the logical OR opererator || syntax in constructors.
    22    Author:             christine@netscape.com
    23    Date:               12 november 1997
    24 */
    26 var SECTION = "proto_6";
    27 var VERSION = "JS1_3";
    28 var TITLE   = "Logical OR || in constructors";
    30 startTest();
    31 writeHeaderToLog( SECTION + " "+ TITLE);
    33 function Employee ( name, dept ) {
    34   this.name = name || "";
    35   this.dept = dept || "general";
    36 }
    37 function Manager () {
    38   this.reports = [];
    39 }
    40 Manager.prototype = new Employee();
    42 function WorkerBee ( name, dept, projs ) {
    43   this.base = Employee;
    44   this.base( name, dept)
    45     this.projects = projs || new Array();
    46 }
    48 WorkerBee.prototype = new Employee();
    50 function SalesPerson () {
    51   this.dept = "sales";
    52   this.quota = 100;
    53 }
    54 SalesPerson.prototype = new WorkerBee();
    56 function Engineer ( name, projs, machine ) {
    57   this.base = WorkerBee;
    58   this.base( name, "engineering", projs )
    59     this.machine = machine || "";
    60 }
    61 Engineer.prototype = new WorkerBee();
    63 var pat = new Engineer( "Toonces, Pat",
    64 			["SpiderMonkey", "Rhino"],
    65 			"indy" );
    67 var les = new WorkerBee( "Morris, Les",
    68 			 "Training",
    69 			 ["Hippo"] )
    71   var terry = new Employee( "Boomberi, Terry",
    72 			    "Marketing" );
    74 // Pat, the Engineer
    76 new TestCase( SECTION,
    77 	      "pat.name",
    78 	      "Toonces, Pat",
    79 	      pat.name );
    81 new TestCase( SECTION,
    82 	      "pat.dept",
    83 	      "engineering",
    84 	      pat.dept );
    86 new TestCase( SECTION,
    87 	      "pat.projects.length",
    88 	      2,
    89 	      pat.projects.length );
    91 new TestCase( SECTION,
    92 	      "pat.projects[0]",
    93 	      "SpiderMonkey",
    94 	      pat.projects[0] );
    96 new TestCase( SECTION,
    97 	      "pat.projects[1]",
    98 	      "Rhino",
    99 	      pat.projects[1] );
   101 new TestCase( SECTION,
   102 	      "pat.machine",
   103 	      "indy",
   104 	      pat.machine );
   107 // Les, the WorkerBee
   109 new TestCase( SECTION,
   110 	      "les.name",
   111 	      "Morris, Les",
   112 	      les.name );
   114 new TestCase( SECTION,
   115 	      "les.dept",
   116 	      "Training",
   117 	      les.dept );
   119 new TestCase( SECTION,
   120 	      "les.projects.length",
   121 	      1,
   122 	      les.projects.length );
   124 new TestCase( SECTION,
   125 	      "les.projects[0]",
   126 	      "Hippo",
   127 	      les.projects[0] );
   129 // Terry, the Employee
   130 new TestCase( SECTION,
   131 	      "terry.name",
   132 	      "Boomberi, Terry",
   133 	      terry.name );
   135 new TestCase( SECTION,
   136 	      "terry.dept",
   137 	      "Marketing",
   138 	      terry.dept );
   139 test();

mercurial