js/src/tests/js1_3/inherit/proto_1.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_1.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    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_1";
    25 var VERSION = "JS1_3";
    26 var TITLE   = "new PrototypeObject";
    28 startTest();
    29 writeHeaderToLog( SECTION + " "+ TITLE);
    31 function Employee () {
    32   this.name = "";
    33   this.dept = "general";
    34 }
    35 function Manager () {
    36   this.reports = [];
    37 }
    38 Manager.prototype = new Employee();
    40 function WorkerBee () {
    41   this.projects = new Array();
    42 }
    43 WorkerBee.prototype = new Employee();
    45 function SalesPerson () {
    46   this.dept = "sales";
    47   this.quota = 100;
    48 }
    49 SalesPerson.prototype = new WorkerBee();
    51 function Engineer () {
    52   this.dept = "engineering";
    53   this.machine = "";
    54 }
    55 Engineer.prototype = new WorkerBee();
    57 var jim = new Employee();
    59 new TestCase( SECTION,
    60 	      "jim = new Employee(); jim.name",
    61 	      "",
    62 	      jim.name );
    65 new TestCase( SECTION,
    66 	      "jim = new Employee(); jim.dept",
    67 	      "general",
    68 	      jim.dept );
    70 var sally = new Manager();
    72 new TestCase( SECTION,
    73 	      "sally = new Manager(); sally.name",
    74 	      "",
    75 	      sally.name );
    76 new TestCase( SECTION,
    77 	      "sally = new Manager(); sally.dept",
    78 	      "general",
    79 	      sally.dept );
    81 new TestCase( SECTION,
    82 	      "sally = new Manager(); sally.reports.length",
    83 	      0,
    84 	      sally.reports.length );
    86 new TestCase( SECTION,
    87 	      "sally = new Manager(); typeof sally.reports",
    88 	      "object",
    89 	      typeof sally.reports );
    91 var fred = new SalesPerson();
    93 new TestCase( SECTION,
    94 	      "fred = new SalesPerson(); fred.name",
    95 	      "",
    96 	      fred.name );
    98 new TestCase( SECTION,
    99 	      "fred = new SalesPerson(); fred.dept",
   100 	      "sales",
   101 	      fred.dept );
   103 new TestCase( SECTION,
   104 	      "fred = new SalesPerson(); fred.quota",
   105 	      100,
   106 	      fred.quota );
   108 new TestCase( SECTION,
   109 	      "fred = new SalesPerson(); fred.projects.length",
   110 	      0,
   111 	      fred.projects.length );
   113 var jane = new Engineer();
   115 new TestCase( SECTION,
   116 	      "jane = new Engineer(); jane.name",
   117 	      "",
   118 	      jane.name );
   120 new TestCase( SECTION,
   121 	      "jane = new Engineer(); jane.dept",
   122 	      "engineering",
   123 	      jane.dept );
   125 new TestCase( SECTION,
   126 	      "jane = new Engineer(); jane.projects.length",
   127 	      0,
   128 	      jane.projects.length );
   130 new TestCase( SECTION,
   131 	      "jane = new Engineer(); jane.machine",
   132 	      "",
   133 	      jane.machine );
   136 test();

mercurial