js/src/tests/js1_3/inherit/proto_7.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_7.js
     9    Section:
    10    Description:        Adding Properties to the Prototype Object
    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
    22    Author:             christine@netscape.com
    23    Date:               12 november 1997
    24 */
    26 var SECTION = "proto_6";
    27 var VERSION = "JS1_3";
    28 var TITLE   = "Adding properties to the Prototype Object";
    30 startTest();
    31 writeHeaderToLog( SECTION + " "+ TITLE);
    33 function Employee ( name, dept ) {
    34   this.name = name || "";
    35   this.dept = dept || "general";
    36 }
    37 function WorkerBee ( name, dept, projs ) {
    38   this.base = Employee;
    39   this.base( name, dept)
    40     this.projects = projs || new Array();
    41 }
    42 WorkerBee.prototype = new Employee();
    44 function Engineer ( name, projs, machine ) {
    45   this.base = WorkerBee;
    46   this.base( name, "engineering", projs )
    47     this.machine = machine || "";
    48 }
    49 // Engineer.prototype = new WorkerBee();
    51 var pat = new Engineer( "Toonces, Pat",
    52 			["SpiderMonkey", "Rhino"],
    53 			"indy" );
    55 Employee.prototype.specialty = "none";
    58 // Pat, the Engineer
    60 new TestCase( SECTION,
    61 	      "pat.name",
    62 	      "Toonces, Pat",
    63 	      pat.name );
    65 new TestCase( SECTION,
    66 	      "pat.dept",
    67 	      "engineering",
    68 	      pat.dept );
    70 new TestCase( SECTION,
    71 	      "pat.projects.length",
    72 	      2,
    73 	      pat.projects.length );
    75 new TestCase( SECTION,
    76 	      "pat.projects[0]",
    77 	      "SpiderMonkey",
    78 	      pat.projects[0] );
    80 new TestCase( SECTION,
    81 	      "pat.projects[1]",
    82 	      "Rhino",
    83 	      pat.projects[1] );
    85 new TestCase( SECTION,
    86 	      "pat.machine",
    87 	      "indy",
    88 	      pat.machine );
    90 new TestCase( SECTION,
    91 	      "pat.specialty",
    92 	      void 0,
    93 	      pat.specialty );
    95 test();

mercurial