Home | History | Annotate | Download | only in webkit
      1 # Copyright 2013 the V8 project authors. All rights reserved.
      2 # Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
      3 #
      4 # Redistribution and use in source and binary forms, with or without
      5 # modification, are permitted provided that the following conditions
      6 # are met:
      7 # 1.  Redistributions of source code must retain the above copyright
      8 #     notice, this list of conditions and the following disclaimer.
      9 # 2.  Redistributions in binary form must reproduce the above copyright
     10 #     notice, this list of conditions and the following disclaimer in the
     11 #     documentation and/or other materials provided with the distribution.
     12 #
     13 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
     14 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     15 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     16 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     17 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     18 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     19 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
     20 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     21 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     22 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     23 
     24 Test prototypes of various objects and the various means to access them.
     25 
     26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     27 
     28 
     29 PASS ('').__proto__ is String.prototype
     30 PASS (0).__proto__ is Number.prototype
     31 PASS ([]).__proto__ is Array.prototype
     32 PASS ({}).__proto__ is Object.prototype
     33 PASS (new Date).__proto__ is Date.prototype
     34 PASS (new Number).__proto__ is Number.prototype
     35 PASS (new Object).__proto__ is Object.prototype
     36 PASS (new String).__proto__ is String.prototype
     37 PASS Array.prototype.__proto__ is Object.prototype
     38 PASS Date.prototype.__proto__ is Object.prototype
     39 PASS Number.prototype.__proto__ is Object.prototype
     40 PASS Object.prototype.__proto__ is null
     41 PASS String.prototype.__proto__ is Object.prototype
     42 PASS Array.__proto__ is Object.__proto__
     43 PASS Date.__proto__ is Object.__proto__
     44 PASS Number.__proto__ is Object.__proto__
     45 PASS String.__proto__ is Object.__proto__
     46 PASS Object.getPrototypeOf('') threw exception TypeError: Object.getPrototypeOf called on non-object.
     47 PASS Object.getPrototypeOf(0) threw exception TypeError: Object.getPrototypeOf called on non-object.
     48 PASS Object.getPrototypeOf([]) is Array.prototype
     49 PASS Object.getPrototypeOf({}) is Object.prototype
     50 PASS Object.getPrototypeOf(new Date) is Date.prototype
     51 PASS Object.getPrototypeOf(new Number) is Number.prototype
     52 PASS Object.getPrototypeOf(new Object) is Object.prototype
     53 PASS Object.getPrototypeOf(new String) is String.prototype
     54 PASS Object.getPrototypeOf(Array.prototype) is Object.prototype
     55 PASS Object.getPrototypeOf(Date.prototype) is Object.prototype
     56 PASS Object.getPrototypeOf(Number.prototype) is Object.prototype
     57 PASS Object.getPrototypeOf(Object.prototype) is null
     58 PASS Object.getPrototypeOf(String.prototype) is Object.prototype
     59 PASS Object.getPrototypeOf(Array) is Object.__proto__
     60 PASS Object.getPrototypeOf(Date) is Object.__proto__
     61 PASS Object.getPrototypeOf(Number) is Object.__proto__
     62 PASS Object.getPrototypeOf(String) is Object.__proto__
     63 PASS String.prototype.isPrototypeOf('') is false
     64 PASS Number.prototype.isPrototypeOf(0) is false
     65 PASS Array.prototype.isPrototypeOf([]) is true
     66 PASS Object.prototype.isPrototypeOf({}) is true
     67 PASS Date.prototype.isPrototypeOf(new Date) is true
     68 PASS Number.prototype.isPrototypeOf(new Number) is true
     69 PASS Object.prototype.isPrototypeOf(new Object) is true
     70 PASS String.prototype.isPrototypeOf(new String) is true
     71 PASS Object.prototype.isPrototypeOf(Array.prototype) is true
     72 PASS Object.prototype.isPrototypeOf(Date.prototype) is true
     73 PASS Object.prototype.isPrototypeOf(Number.prototype) is true
     74 PASS Object.prototype.isPrototypeOf(String.prototype) is true
     75 PASS Object.__proto__.isPrototypeOf(Array) is true
     76 PASS Object.__proto__.isPrototypeOf(Date) is true
     77 PASS Object.__proto__.isPrototypeOf(Number) is true
     78 PASS Object.__proto__.isPrototypeOf(String) is true
     79 PASS var wasSet = false; var o = { }; o.__defineGetter__("__proto__", function() { wasSet = true }); o.__proto__; wasSet; is true
     80 PASS var wasSet = false; var o = { }; o.__defineSetter__("__proto__", function() { wasSet = true }); o.__proto__ = {}; wasSet; is true
     81 PASS var wasSet = false; var o = { }; Object.defineProperty(o, "__proto__", { "get": function() { wasSet = true } }); o.__proto__; wasSet; is true
     82 PASS var wasSet = false; var o = { }; Object.defineProperty(o, "__proto__", { "__proto__": function(x) { wasSet = true } }); o.__proto__ = {}; wasSet; is false
     83 PASS var o = {}; o.__proto__ = { x:true }; o.x is true
     84 PASS var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__') is false
     85 PASS var o = {}; o.__proto__ = { x:true }; o.x is undefined.
     86 PASS var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__') is true
     87 PASS successfullyParsed is true
     88 
     89 TEST COMPLETE
     90 
     91