js/src/tests/js1_3/inherit/proto_10.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_10.js
     9    Section:
    10    Description:        Determining Instance Relationships
    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    Author:             christine@netscape.com
    21    Date:               12 november 1997
    22 */
    24 var SECTION = "proto_10";
    25 var VERSION = "JS1_3";
    26 var TITLE   = "Determining Instance Relationships";
    28 startTest();
    29 writeHeaderToLog( SECTION + " "+ TITLE);
    31 function InstanceOf( object, constructor ) {
    32   return object instanceof constructor;
    33 }
    34 function Employee ( name, dept ) {
    35   this.name = name || "";
    36   this.dept = dept || "general";
    37 }
    39 function Manager () {
    40   this.reports = [];
    41 }
    42 Manager.prototype = new Employee();
    44 function WorkerBee ( name, dept, projs ) {
    45   this.base = Employee;
    46   this.base( name, dept)
    47     this.projects = projs || new Array();
    48 }
    49 WorkerBee.prototype = new Employee();
    51 function SalesPerson () {
    52   this.dept = "sales";
    53   this.quota = 100;
    54 }
    55 SalesPerson.prototype = new WorkerBee();
    57 function Engineer ( name, projs, machine ) {
    58   this.base = WorkerBee;
    59   this.base( name, "engineering", projs )
    60     this.machine = machine || "";
    61 }
    62 Engineer.prototype = new WorkerBee();
    64 var pat = new Engineer();
    66 new TestCase( SECTION,
    67               "InstanceOf( pat, Engineer )",
    68               true,
    69               InstanceOf( pat, Engineer ) );
    71 new TestCase( SECTION,
    72               "InstanceOf( pat, WorkerBee )",
    73               true,
    74               InstanceOf( pat, WorkerBee ) );
    76 new TestCase( SECTION,
    77               "InstanceOf( pat, Employee )",
    78               true,
    79               InstanceOf( pat, Employee ) );
    81 new TestCase( SECTION,
    82               "InstanceOf( pat, Object )",
    83               true,
    84               InstanceOf( pat, Object ) );
    86 new TestCase( SECTION,
    87               "InstanceOf( pat, SalesPerson )",
    88               false,
    89               InstanceOf ( pat, SalesPerson ) );
    90 test();

mercurial