/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* *Date:2001-07-03 * *SUMMARY:Testingscopewithnestedfunctions * *FromcorrespondencewithChristopherOliver<coliver@mminternet.com>: * *>RunningthistestwithRhinoproducesthefollowingexception: *> *>uncaughtJavaScriptexception:undefined:Cannotfinddefaultvaluefor *>object.(line3) *> *>Thisisduetoabuginorg.mozilla.javascript.NativeCallwhichdoesn't *>implementtoStringorvalueOforoverridegetDefaultValue. *>However,evenafterIhackedinanimplementationofgetDefaultValuein *>NativeCall,RhinostillproducesadifferentresultthenSpiderMonkey: *> *>[objectCall] *>[objectObject] *>[objectCall] * *Notetheresultsshouldbe: * *[objectglobal] *[objectObject] *[objectglobal] * *Thisiswhatwearecheckingforinthistestcase-
*/ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = '(none)'; var summary = 'Testing scope with nested functions'; var statprefix = 'Section '; var statsuffix = ' of test -'; var self = this; // capture a reference to the global object; var cnGlobal = self.toString(); var cnObject = (new Object).toString(); var statusitems = []; var actualvalues = []; var expectedvalues = [];
function a()
{ function b()
{
capture(this.toString());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.