From nobody@FreeBSD.org  Thu May 31 01:42:56 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3D014106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 31 May 2012 01:42:56 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 254058FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 31 May 2012 01:42:56 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q4V1gtCf098977
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 31 May 2012 01:42:55 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q4V1gtsa098976;
	Thu, 31 May 2012 01:42:55 GMT
	(envelope-from nobody)
Message-Id: <201205310142.q4V1gtsa098976@red.freebsd.org>
Date: Thu, 31 May 2012 01:42:55 GMT
From: lKcoxFCOkUi <gillian.lindner@uct.ac.za>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ukPZrCVllcy
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         168482
>Category:       junk
>Synopsis:       ukPZrCVllcy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 31 01:50:02 UTC 2012
>Closed-Date:    Mon Jun 04 02:38:53 UTC 2012
>Last-Modified:  Mon Jun 04 02:38:53 UTC 2012
>Originator:     lKcoxFCOkUi
>Release:        sVRryPOrosiWpTdd
>Organization:
ExQLqffiuiwZgO
>Environment:
Re: Issue: #181There is a pseudo-workaround for this bug.While you canont do direct inheritance, you can "clone" the Array prototype and get a mostly functional length property.Code:// create your class  MyArray = function(){// instantiates the "length" property so that it is non-enumerable this.push.apply(this,[]); // set the length property to 0, otherwise it is effectively undefined this.length=0; return this;  }; // create an explicit list of Array prototype properties to "steal" as you canont use for/in loop to retrieve  var p=['push','concat'];// manually copy the properties from the Array prototype to MyArray prototype  for(var x=0; x<p.length; x++){ MyArray.prototype[p[x]]=Array.prototype[p[x]];  }  var a=new MyArray();  a.push(1);  alert(a.length);// 1// this fails, length property is only updated using the Array native functions  a[1]=2;  alert(a.length);// 1end codeWhile this has some obvious drawbacks,it does get you a pseudo-subclass that works across all b
 rowsers.
>Description:
Re: Issue: #181There is a pseudo-workaround for this bug.While you canont do direct inheritance, you can "clone" the Array prototype and get a mostly functional length property.Code:// create your class  MyArray = function(){// instantiates the "length" property so that it is non-enumerable this.push.apply(this,[]); // set the length property to 0, otherwise it is effectively undefined this.length=0; return this;  }; // create an explicit list of Array prototype properties to "steal" as you canont use for/in loop to retrieve  var p=['push','concat'];// manually copy the properties from the Array prototype to MyArray prototype  for(var x=0; x<p.length; x++){ MyArray.prototype[p[x]]=Array.prototype[p[x]];  }  var a=new MyArray();  a.push(1);  alert(a.length);// 1// this fails, length property is only updated using the Array native functions  a[1]=2;  alert(a.length);// 1end codeWhile this has some obvious drawbacks,it does get you a pseudo-subclass that works across all browsers.
>How-To-Repeat:
Re: Issue: #181There is a pseudo-workaround for this bug.While you canont do direct inheritance, you can "clone" the Array prototype and get a mostly functional length property.Code:// create your class  MyArray = function(){// instantiates the "length" property so that it is non-enumerable this.push.apply(this,[]); // set the length property to 0, otherwise it is effectively undefined this.length=0; return this;  }; // create an explicit list of Array prototype properties to "steal" as you canont use for/in loop to retrieve  var p=['push','concat'];// manually copy the properties from the Array prototype to MyArray prototype  for(var x=0; x<p.length; x++){ MyArray.prototype[p[x]]=Array.prototype[p[x]];  }  var a=new MyArray();  a.push(1);  alert(a.length);// 1// this fails, length property is only updated using the Array native functions  a[1]=2;  alert(a.length);// 1end codeWhile this has some obvious drawbacks,it does get you a pseudo-subclass that works across all browsers.
>Fix:
Re: Issue: #181There is a pseudo-workaround for this bug.While you canont do direct inheritance, you can "clone" the Array prototype and get a mostly functional length property.Code:// create your class  MyArray = function(){// instantiates the "length" property so that it is non-enumerable this.push.apply(this,[]); // set the length property to 0, otherwise it is effectively undefined this.length=0; return this;  }; // create an explicit list of Array prototype properties to "steal" as you canont use for/in loop to retrieve  var p=['push','concat'];// manually copy the properties from the Array prototype to MyArray prototype  for(var x=0; x<p.length; x++){ MyArray.prototype[p[x]]=Array.prototype[p[x]];  }  var a=new MyArray();  a.push(1);  alert(a.length);// 1// this fails, length property is only updated using the Array native functions  a[1]=2;  alert(a.length);// 1end codeWhile this has some obvious drawbacks,it does get you a pseudo-subclass that works across all browsers.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Mon Jun 4 02:38:11 UTC 2012 
State-Changed-Why:  
spam 


Responsible-Changed-From-To: freebsd-bugs->gnats-admin 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Jun 4 02:38:11 UTC 2012 
Responsible-Changed-Why:  

http://www.freebsd.org/cgi/query-pr.cgi?pr=168482 
>Unformatted:
