Граф коммитов

389 Коммитов

Автор SHA1 Сообщение Дата
brendan%mozilla.org b02c276f35 Stop evals and Script object calls/execs that cross trust domains (289074, r=shaver, sr=jst, a=drivers). 2005-04-07 02:22:24 +00:00
brendan%mozilla.org e676c738fd Fix ancient misordering of addProperty before slot store (279289, r=shaver). 2005-03-29 19:24:33 +00:00
brendan%mozilla.org 67a8f727f7 Fix so JSNewResolveOp can define id in an unrelated object and return it (not needed now for 274784, may be useful later, good for js, r=shaver). 2005-03-24 22:28:09 +00:00
brendan%mozilla.org 8e1b9d4f60 Fix instanceof to throw a TypeError if the RHS doesn't have a [[HasInstance]] internal method, per ECMA-262 Ed. 3 (r=shaver). 2005-02-24 00:06:43 +00:00
shaver%mozilla.org c6a1ca5969 Bug 273931: pop With objects from scope chain as appropriate, when resetting
stack depth due to exception-handling flow control jumps. r=brendan.
2005-02-18 16:06:49 +00:00
brendan%mozilla.org 203a9641ad Fix Detecting to cope with no active frames on cx (281984, r=jst). 2005-02-15 19:20:00 +00:00
brendan%mozilla.org c4f9945247 Remove bogus assert in MarkGCThing, fix order of operation in js_NewObject to avoid losing the newborn root (278725, r=shaver). 2005-01-19 02:25:40 +00:00
jst%mozilla.jstenback.com 0472c0073e Fixing bug 265174. Quiet down compiler warnings on Linux x86_64. r+sr=brendan@mozilla.org 2005-01-12 19:56:32 +00:00
brendan%mozilla.org 92552356eb Revamp the GC to fix E4X private data dueling GC bugs, to reduce malloc costs for small-ish objects and functions, and to pave the way for further GC wins (123668, r=shaver, TAKE 2). 2005-01-05 06:15:03 +00:00
brendan%mozilla.org 412eb31b82 Back out, broke liveconnect at least. 2005-01-05 03:58:19 +00:00
brendan%mozilla.org 90eaa50664 Revamp the GC to fix E4X private data dueling GC bugs, to reduce malloc costs for small-ish objects and functions, and to pave the way for further GC wins (123668, r=shaver). 2005-01-05 02:56:36 +00:00
brendan%mozilla.org 931f64581c Propagate a flag induced by JSOPTION_XML into script and context version fields, for proper run- and compile-time consistency (275742, r=shaver). 2004-12-24 00:03:59 +00:00
brendan%mozilla.org 91272a112c Fix for bug 244619 from aviary/1.7 branches, r=shaver. 2004-12-16 00:25:03 +00:00
brendan%mozilla.org 54e9fe4050 Null, not false (fix copy-paste error). 2004-12-10 01:31:16 +00:00
brendan%mozilla.org 5c38e1a00c Implement Deutsch-Schorr-Waite, plus related GC metering improvements, to avoid stack overflow crashes when marking very deep object lists (203278, r=igor@fastmail.fm and Igor wrote the tail-recursion elimination code). 2004-12-06 23:17:19 +00:00
brendan%mozilla.org 428b8a8546 E4X, configured off, code-complete. 2004-11-17 07:43:01 +00:00
brendan%mozilla.org 04b24dd95c Skip deleted/misidentified properties in js_obj_toSource (233483, patch from shaver+timeless, r=me). 2004-11-04 01:52:28 +00:00
brendan%mozilla.org 5eb78fc669 Initial E4X check-in, configured off (246441, rs=shaver). 2004-10-05 10:19:07 +00:00
brendan%mozilla.org a7487d7136 Add JSRESOLVE_DECLARING and JSRESOLVE_CLASSNAME support for better DOM quirk emulation (257602, r=shaver). 2004-09-01 20:51:39 +00:00
brendan%mozilla.org 5a95353303 Add scoped local root support, plus a few cleanups from the huge e4x patch (40757, r=shaver). 2004-08-19 17:57:36 +00:00
brendan%mozilla.org 1efe559390 Fix bug 254375 by quoting negative integer property ids in js_obj_toSource. 2004-08-05 08:06:26 +00:00
brendan%mozilla.org 652a45f1d5 Improve JSRESOLVE_DETECTING to handle typeof, ==, !=, etc.; don't give undefined property strict warning for detecting cases (253150, r=shaver). 2004-07-29 20:44:20 +00:00
brendan%mozilla.org d608b3e898 Update map->freeslot in js_SetRequiredSlot if obj has its own scope (245890, r=shaver); also clear pending exceptions as needed in js_TryMethod (old unreported bug, r=self). 2004-07-22 15:47:22 +00:00
brendan%mozilla.org c654a3f978 Improve JSRESOLVE_DETECTING by treating 'terminal' uses of, e.g., document.all as detecting (248549, r=jst). 2004-07-15 18:53:59 +00:00
brendan%mozilla.org bb87816784 Add JSRESOLVE_DETECTING (246964, r=shaver). 2004-06-16 21:15:35 +00:00
brendan%mozilla.org 1a78cd61c8 Give JSObjectOps.setRequiredSlot a JSBool return value so it can propagate errors (part of 245890, r=shaver). 2004-06-12 01:50:09 +00:00
brendan%mozilla.org c44082952a Back out patch for bug 245890 for now. 2004-06-09 19:39:53 +00:00
brendan%mozilla.org e4dad6cb67 Fix bug caused by bug 165201's checkin, where regexp-valued slots in function object clones might dangle after GC (245890, r=shaver). 2004-06-08 21:58:52 +00:00
brendan%mozilla.org 6e8f8f0e72 Make dynamically defined getters and setters enumerable (per afri posting to m.jseng; consistent with original getter=/setter= support in jsinterp.c). 2004-05-12 00:44:23 +00:00
brendan%mozilla.org 320d95637a Sigh, go back to requiring a native object for the global object in FindConstructor, to unbreak lazy class init. 2004-04-20 18:02:49 +00:00
brendan%mozilla.org ab1b721b28 Fix old watchpoint function vs. clone bug (240577) and undo bogus strict warning from lazy class init (240404 in part). 2004-04-15 09:05:46 +00:00
brendan%mozilla.org f3e73b9da0 Er, let's try caillon's patch (bug 240458, r=me). 2004-04-14 02:36:37 +00:00
brendan%mozilla.org e4d5924763 Fix cosmetic bug pointed out by caillon, passing JS_FALSE rather than 0 to js_DecompileValueGenerator (API change wasn't tracked long ago). 2004-04-14 02:35:34 +00:00
brendan%mozilla.org ff71873e75 - Improve global variable performance from 3x slower to 1.2x slower than
locals (169559, r=shaver).
- Also fix longstanding bug where global regexps in precompiled scripts were
  wrongly shared among threads/contexts (165201, r=shaver).
- Also fix strict-aliasing gcc warning causes (206599, r=bryner).
2004-04-13 01:25:17 +00:00
brendan%mozilla.org 13512ddbd3 NARCISSUS ifdefs and related general fixes (r=shaver). 2004-02-11 07:21:59 +00:00
gerv%gerv.net 29cfd51965 Bug 205418 - Relicense Spidermonkey (js/src) to MPL/LGPL/GPL. Patch by gerv; r,a=brendan. 2003-11-15 00:11:16 +00:00
brendan%mozilla.org 24e5990b0c Remove JS_UnsealObject, optimize locking of sealed objects, shrink JSContext by two JSArenaPool members (224306, r=shaver). 2003-11-11 01:28:17 +00:00
brendan%mozilla.org c85bc41f9e Use eval's object principals if possible, ditto for other eval-like methods (223041, r=caillon, sr=shaver). 2003-11-02 01:04:50 +00:00
brendan%mozilla.org a15916b480 Add __noSuchMethod__ handler support, and clean up js_ValueToFunction/js_ReportIsNotDefined error diagnosis hard cases (196097, r=sparky). 2003-10-22 06:26:03 +00:00
brendan%mozilla.org 7cb2529128 Check in my version of a patch to avoid thread or process stack overflow from Igor Bukanov <igor@fastmail.fm> (192414, r=shaver). 2003-09-24 16:49:58 +00:00
brendan%mozilla.org 9d6835e2ba Prevent recursive divergence via watchpoint handlers (213482, r=scole). 2003-08-03 21:59:50 +00:00
brendan%mozilla.org 4fa5213a91 Big dynamic footprint win via script filename caching, plus line number fix for strict/const diags (see http://bugzilla.mozilla.org/attachment.cgi?id=127130&action=view for detailed checkin comments; 208030, r/rs=shaver, r=rginda on the jsd change, r=jst on the dom change). 2003-07-26 22:37:11 +00:00
brendan%mozilla.org 05be1e35a2 More resolve cleanup: eliminate cx->resolving (redundant w.r.t. cx->resolvingTable && cx->resolvingTable->entryCount); use JS_DHASH_ADD and test for non-null key part, not LOOKUP-and-test-non-busy-then-ADD. 2003-06-11 23:43:56 +00:00
brendan%mozilla.org b7c5f4bd8b Subtly better comment for last change. 2003-06-08 20:31:06 +00:00
brendan%mozilla.org 668326c888 Followup fix to remaining problem pointed out by Itaj Sherman (208496). 2003-06-08 18:55:53 +00:00
brendan%mozilla.org d484baa7a8 Minimal ECMA-262 Edition 3 config, plus cleanup to other configs (208586, r=shaver). 2003-06-07 21:08:45 +00:00
brendan%mozilla.org cbad68cb9e Hide arg and var properties of function objects from with statements (208496, r=rogerl). 2003-06-06 21:43:14 +00:00
brendan%mozilla.org 27c26166cd Unify on JS_DHASH_ADD to avoid gratuitous lookup-before-add in cx->resolvingTable (r=me again). 2003-06-05 18:49:13 +00:00
brendan%mozilla.org 803d51df77 Fix ancient ECMA conformance bug to-do with implicit variable definition order in assignments (204919, r=rogerl, a=asa). 2003-05-14 20:57:47 +00:00
brendan%mozilla.org 061ad75168 Restore lost API compatibility: copy getter and setter as well as shortid when shadowing a prototype property that has a shortid (203084, r=rogerl, sr=shaver). 2003-05-02 17:36:58 +00:00
brendan%mozilla.org 4b0d94c93a More cleanup/followup: eliminate single-use rt variable in js_SetProperty, move clasp decl and first-def down, fix comments, strip trailing whitespace. 2003-04-14 04:14:57 +00:00
brendan%mozilla.org 3fb113994f Improve one comment slightly. 2003-04-14 03:32:55 +00:00
brendan%mozilla.org 40334ba064 Quick followup to last checkin, to optimize OBJ_DROP_PROPERTY to JS_UNLOCK_SCOPE in the one place in js_SetProperty that didn't follow the comments and do that. 2003-04-14 03:26:47 +00:00
brendan%mozilla.org fd011d535b Fix ancient ECMA violation where proto-property attrs, etc., were inherited when shadowing (90596, r=rogerl). 2003-04-13 23:33:34 +00:00
brendan%mozilla.org c251d3600f Fix set-property on sealed object to throw error (94693, r=rogerl). 2003-04-11 21:02:29 +00:00
seawood%netscape.com 42ee530683 Purge XP_PC.
Bug #74999 r=mkaply sr=brendan
2003-04-03 19:35:29 +00:00
brendan%mozilla.org f0404b0df8 Work around OpenVMS compiler bug: it reserves |readonly| (199366, r=me, patch from colin@theblakes.com). 2003-03-27 00:04:51 +00:00
brendan%mozilla.org c0fc066a01 Don't override a prototype property iff it is JSPROP_SHARED (not also if it's a JSPROP_SETTER; 197940, r=rogerl). 2003-03-19 02:25:39 +00:00
brendan%mozilla.org f2c8bb3531 Move readonly pre-ECMA error report down to new place peculiar to sealed
scopes, and share it via downward goto from the old place (which should go
away when a bug on khanson's list whose # I forget is fixed).  This fixes
the hole in sealed scope support mentioned in bug 94693 (r=rogerl/shaver).
2003-03-19 00:53:45 +00:00
brendan%mozilla.org 25b813e602 Implement SCOPE_IS_SEALED, JS_SealObject, JS_UnsealObject, etc. to support
sealed standard object graphs, as well as to pave the way for optimizations
to object literals (94693, r=shaver).
2003-03-14 05:24:58 +00:00
brendan%mozilla.org dd545c2cb9 Fix JS_[GS]etContextThread return type; add JSCLASS_NEW_RESOLVE_GETS_START (196966, r=shaver). 2003-03-12 20:29:16 +00:00
brendan%mozilla.org 6e0c7cdde4 Constipation of (JS|PL)DHashTableOps (195298, r/sr=shaver/alecf). 2003-02-28 07:17:59 +00:00
brendan%mozilla.org 4b0d8710d7 Fix blunder in obj_propertyIsEnumerable from last checkin (156354, r=shaver). 2002-09-16 23:00:03 +00:00
brendan%mozilla.org d02561c5d2 Restore enumeable, permanent, readonly single-char elements to string objects; fix propertyIsEnumerable to work with shared permanent proto-properties (167910, r=rogerl). 2002-09-12 19:34:59 +00:00
brendan%mozilla.org 873971ec4c Fix js_NewObject not to share proto's map if proto and obj don't have the same number of reserved slots (112974, r=rogerl, sr=jband). 2002-08-08 21:51:54 +00:00
brendan%mozilla.org 703c294a0e Null-check prop before dropping it (156354, r=khanson, sr=shaver). 2002-07-09 02:24:51 +00:00
brendan%mozilla.org 1740ef44a7 Respect addProperty failure (148899, r=khanson, sr=shaver). 2002-06-04 18:13:55 +00:00
dbaron%fas.harvard.edu 412d54c9d6 Fix Mac bustage from brendan's checkin. 2002-05-22 00:53:12 +00:00
brendan%mozilla.org f1f6f1398e Don't fail to call OBJ_CHECK_ACCESS for o.__proto__ = x, with enough mode bits to say what's happening (143369, r=shaver, sr=jst). 2002-05-22 00:06:40 +00:00
brendan%mozilla.org bf8e80d0d1 Fix js_SetProtoOrParent to handle non-native and native-but-incompatible-class-change proto-setting scenarios (140164, r=khanson, sr=jband). 2002-05-02 20:59:35 +00:00
timeless%mac.com dec943eb10 Bug 106386 rid source of misspellings
r=db48x sr=blake a=asa
2002-03-19 04:30:17 +00:00
brendan%mozilla.org 1e126a67d9 Restore non-bogus assertion removed in last rev, and fix the case that tripped it in js_ChangeScopeProperty, by not removing [and maybe freeing sprop->slot] before re-adding sprop; also fix all engine-defined getters and setters to have no slot [to be JSPROP_SHARED] (130970, r/sr=shaver&jband, a=asa). 2002-03-16 04:51:29 +00:00
khanson%netscape.com e67d7ec049 bug #130991 (Out-of-Memory in jsshell causes assertion failure in jsobj.c) patch by Brendan, sr=jband, r=khanson, a=asa 2002-03-15 06:22:00 +00:00
brendan%mozilla.org 62bc0d659b No strict warnings without the strict option, and other js1.5/mozilla1.0 tidying (129972, r=shaver, sr=jband, a=asa). 2002-03-14 00:14:48 +00:00
brendan%mozilla.org 5074f6ebd1 Don't forget to lock obj in js_AddNativeProperty and js_ChangeNativePropertyAttrs (130137, r=jband, sr=shaver, a=roc+moz). 2002-03-12 07:17:30 +00:00
brendan%mozilla.org efe08cd95c Fix longstanding bug where watchpoints didn't work with JSPROP_SETTER (127243, r=rginda, sr=shaver, a=dbaron). 2002-03-08 22:46:13 +00:00
brendan%mozilla.org be783ec091 Runaway recursion safety for Exception and js_ErrorToException.
The latter no longer calls the former via js_ConstructObject, to
minimize failure opportunities when converting an error into an
exception.  Also, the 'stack' property of exception objects
faithfully preserves Unicode in function names and decompiled
actual argument sources.

Also, fun_xdrObject was reversing property order when encoding;
fixed to maximize property tree compression gain.

Also^2, js_ConstructObject was not handling success+not-found
return from FindConstructor.

bug 127136, r=rginda, sr=shaver, a=chofmann
2002-03-03 00:59:16 +00:00
brendan%mozilla.org 57483a3082 Major footprint/perf win: share property state using a tree whose root represents empty scopes, and whose non-root nodes represent scopes with properties added in order from the root to that node; to use double hashing to map these tree-paths for per-scope property lookup; and avoid locking where possible through immutability and mostly-benign&rare race tolerance (62164, r=shaver, sr=jband). 2002-02-23 03:49:27 +00:00
brendan%mozilla.org aba15fbd2d Construct error objects to consolidate their default property setting; this entails adding JS_ConstructObjectWithArguments (123177, r=rginda, sr=shaver). 2002-02-14 07:25:34 +00:00
brendan%mozilla.org 2c41247d14 Fix failure to check for JS_InitClass failure, reported by Eric Brueggemann <eric_brueggemann@yahoo.com>, r=shaver, sr=mozbot. 2002-02-06 07:01:37 +00:00
brendan%mozilla.org 8b9fb46499 Avoid ClaimScope (lock-free to -full transition) in JS_GetClass and js_FinalizeObject called from the GC (109183, r=shaver, sr=jband). 2001-11-11 21:25:13 +00:00
brendan%mozilla.org c220d0c707 Avoid recursive join/toString death (108440, r=shaver, sr=jband). 2001-11-07 00:15:44 +00:00
brendan%mozilla.org d27c4cb86f Followup to bug 56940's big patch, tighten GC-mark case analysis, assume atom strings are immutable. 2001-10-28 22:37:25 +00:00
brendan%mozilla.org 894b19f8c3 Add mutable (growable or dependent, two subtypes) strings to solve O(n^2) and O(n^3) growth rates (56940, r=rogerl, sr=jband&shaver). 2001-10-25 00:26:38 +00:00
brendan%mozilla.org eb9671e246 Add SetAlphaBounds, TABLE_SIZE, and MIN_ALPHA APIs (103990, r=dbaron, sr=waterson). 2001-10-16 05:40:27 +00:00
brendan%mozilla.org 9324b81dee Fix for bug 99663 (for loop resolves properties of the object being enumerated
with JSRESOLVE_ASSIGNING, wrongly), plus a few miscellaneous bugfixes.

- Combine the JSStackFrame members constructing, special, overrides, and
  reserved into a uint32 flags member.

- Separate JOF_ASSIGNING from the JOF_SET bytecode format flag, and impute
  JSRESOLVE_ASSIGNING from the presence of JOF_ASSIGNING among the current
  opcode's format flags.  To handle the for-in loop opcodes, which do more
  than simply assign -- in particular, they do property lookups whose resolve
  hook outcalls should not be flagged with JSRESOLVE_ASSIGNING -- a new frame
  flag, JSFRAME_ASSIGNING, has been added.

- Fix interpreter version selection to respect JS_SetVersion, whose effect on
  cx->version is "sticky".

- Fix js_DecompileValueGenerator to deal with JSOP_ENUMELEM -- it never had,
  as this testcase shows (it crashes without this patch):

    version(120);
    eval("function fe(s) { for (it[s] in this); }");
    try { fe('rdonly'); } catch (e) { print(e); }
2001-10-03 06:39:30 +00:00
gerv%gerv.net 1856815ff1 Oops. 2001-09-20 00:02:59 +00:00
scc%mozilla.org bc444f528a bug #98089: ripped new license 2001-09-19 22:39:41 +00:00
brendan%mozilla.org cf80f7240c Fix unsafe JS_DHashTableRawRemove usage; unoverload cx->resolving into a counter and a JSDHashTable pointer (94422, r/sr=jband,waterson with dbaron sanity checks). 2001-09-14 03:37:15 +00:00
brendan%mozilla.org 3efd0e519f 1. Fix jsdhash/pldhash.[ch] so that add/remove cycles for a given k do not
create a long chain of removed sentinels.  Also, when adding k to a table
    where k is not mapped, but where k hashes to a chain that includes removed
    sentinels, recycle the first removed sentinel in the chain for k's entry.
2.  Cache cx->resolving till js_DestroyContext, to avoid high JSDHashTable
    new/destroy overhead in js_LookupProperty.
3.  Add NS_TraceStack to nsTraceMalloc.[ch] and clean the .c file up a bit.
2001-09-12 06:39:31 +00:00
jband%netscape.com 23d7dc717d fix bug 97444. It is not good to patch a different fun into the frame. Let's safely shunt aside the callee frame instead. r=rogerl sr=brendan 2001-09-05 21:25:09 +00:00
brendan%mozilla.org 622522e134 Ignore property found in non-native prototype (12367, sr=jband&shaver, a=asa). 2001-09-03 22:29:12 +00:00
brendan%mozilla.org f319c1d822 Check keyword version when scanning, not by installing different keywords on version selection (when starting to compile; bug 96562, r=rogerl, sr=shaver&jband, a=dbaron). 2001-08-24 03:32:31 +00:00
brendan%mozilla.org 52f4ef75ac Fix 3-way deadlock by never nesting rt->gcLock inside rt->setSlotLock (90994, sr=shaver&jband). 2001-07-25 02:43:40 +00:00
jst%netscape.com 030da7b1b9 Fixing bug 86147. Adding code that does security checks on access to getter and setter functions for properties of DOM objects in JS. Also fixing a JS engine bug that caused problems with the real fix for this bug, the JS engine bug was that a jsid was passed as a jsval to the checkAccess() class hook. r=mstolts@netscape.com, sr=brendan@mozilla.org 2001-07-04 09:44:57 +00:00
jband%netscape.com ea41e651fd fix bug 78428 by making sure to use the lesser of the freeslot or nslots value when marking slots. This is necessary because objects can now be in an initial state where the freeslots is a larger number than the nslots - and the actual number of slots in the array. sr=brendan r=beard a=drivers 2001-06-05 00:47:56 +00:00
brendan%mozilla.org 769e09a93e - Add a generation number to JSDHashTable that counts entryStore changes due
to grows, shrinks, and compresses.  This helps JS_DHashTableOperate callers
  who hold returned entry pointers to validate those pointers and avoid having
  to re-lookup an entry by its key.
- Balance that addition by removing JSDHashTable.sizeMask, which is induced by
  JSDHashTable.sizeLog2 at the cost of two typically single-cycle instructions.
- Use JSDHashTable.generation in jsobj.c to avoid unsafely dereferencing an
  entry pointer held across calls to JSClass.resolve from js_LookupProperty,
  which may recur and add entries to cx->resolving, growing that table and
  invalidating entry pointers held by earlier js_LookupProperty activations.
(bug 78121, r=jst@netscape.com, sr=jband@netscape.com, a=asa@mozilla.org)
2001-05-25 03:05:38 +00:00
brendan%mozilla.org e46d5f7fc4 Warning abatement (r=polarbear, sr=lumpy). 2001-05-22 23:25:18 +00:00
brendan%mozilla.org a10d5eb5aa Unified resolve recursion damping (70358) and resolve-from-js_SetProperty (72354), r/sr=jband,jst,shaver. 2001-05-17 01:43:58 +00:00
jst%netscape.com ea706038cf Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com. 2001-05-08 17:42:36 +00:00
brendan%mozilla.org 841f7a55dd - Fix bug 79054, AB-BA deadlock between rt->setSlotLock and one or more claimed scopes (r=shaver, sr=jband)
js_SetProtoOrParent should always have used a condvar in addition to a lock.
- Fix bug 79129, assert-botch in js_AllocSlot (r/sr=jband, sr=shaver)
  JS_INITIAL_NSLOTS is the minimum number of slots, js_FreeSlot guarantees it.
2001-05-08 01:31:02 +00:00
brendan%mozilla.org ef5f23f75e Use parent, if non-null, as scope chain with which to find default proto from Class.prototype, in js_{New,Construct}Object (75975, sr=jband&jst). 2001-04-14 07:34:58 +00:00
brendan%mozilla.org 7c4a8fb64d Add __lookupGetter__ and __lookupSetter__ (71992, r=rogerl, sr=shaver). 2001-04-08 23:23:34 +00:00
brendan%mozilla.org cd37f8447b - Add JS_GetReservedSlot, JS_SetReservedSlot, and JSCLASS_HAS_RESERVED_SLOTS(n)
to the JS API, for per class extra slots beyond JSSLOT_PRIVATE (or starting
  there for a class that lacks JSCLASS_HAS_PRIVATE).  To avoid penalizing all
  instances, these slots are allocated only upon first property-owned slot
  allocation, or upon first JS_SetReservedSlot.

  This entailed adding getRequiredSlot and setRequiredSlot hooks to the
  JSObjectOps struct, and making obj->slots self-describing, a la BSTR.  It
  also afforded me a chance to clean up obj->slots locking so that non-native
  JSObjectOps didn't risk unlocked accesses!  Now there are thread-safe hooks
  for all uses of obj.

  First consumer is the new, DOM-glue-unifying XPConnect, which needs two
  slots per wrapped function.  Hence the change to js_FunctionClass.flags'
  initializer.

- Commented the heck out of JSClass and JSObjectOps function typedefs in
  jspubtd.h.  I hope embedders see these comments!

- Fix JS_XDRValue's default case to handle int exclusively, there is no other
  possible type (and therefore no JSMSG_BAD_JVAL_TYPE error).

- Clean up tabs in select old, tab-ridden files and sections.

- s/\<fh\>/file/g for stdio FILE * canonical variable names.
2001-04-05 01:53:24 +00:00
brendan%mozilla.org e29e0e312d Quote reserved identifiers as well as non-lexical-identifier property ids in object literals (73598, r=jband, sr=shaver). 2001-04-04 07:45:22 +00:00
brendan%mozilla.org b0da40da16 - [jsemit.c] Fix horrid stupid bugs generating JSOP_ARGCNT and JSOP_ARGSUB,
where any occurrence of arguments.length or arguments[0], e.g., would be
  "optimized" to use those bytecodes.  This is just wrong if the occurrence
  is an operand of delete, ++, --, or the left-hand-side of an assignment
  operator!

- [jsfun.c, jsinterp.c]  args_getProperty etc. must use JS_GetInstancePrivate,
  not JS_GetPrivate, as the arguments object is exposed, and can be made a
  prototype of other objects that do not have private data, or private data
  that's a JSStackFrame*.  Same goes for fun_getProperty, js_GetArgument, etc.

- [jsfun.c, jsobj.c, jsstr.c]  No need to specialize fun_delProperty and
  str_delProperty to help convince users and ECMA conformance tests that
  fun.length and str.length are direct properties of instances, instead of
  being delegated to Function.prototype.length and String.prototype.length.
  This special case is done universally in js_DeleteProperty for all SHARED
  and PERMANENT proto-properties.

- [jshash.c]  Sneaking this followup-fix for bug 69271 in: use JS_HASH_BITS
  rather than hardcoded 32.

- [jsobj.c, jsscope.[ch]]  Fix misnamed js_HashValue (it takes a jsid, so it
  is now js_HashId).

- [jsscript.c] script_compile needs to call JS_InstanceOf, to ensure that obj
  is a Script object.
2001-03-22 02:52:42 +00:00
brendan%mozilla.org b1bad82b83 Fix js_LookupProperty to resolve iff the resolved-in object owns its own scope (jband private bug, r=jband, sr=shaver). 2001-03-11 02:35:10 +00:00
brendan%mozilla.org 69ab37f337 bugs 31003 and (mostly) 68045, r=rogerl, sr=shaver&hyatt
- Fix bug where script jssrcnote vector terminator was not XDRed.
- Ensure that memory is cleared by serializing zero padding bytes as needed
  under JS_XDRBytes and JS_XDRString.
- Fix JS_XDRValue to handle undefined and null JS types properly (bug 31003).
  Also make it cast from jsint to uint32 and back carefully, so as to work
  with negative numbers even on targets where jsval is a signed 64 bit type.
- Add JS_XDRScript public API.
- Optimize the per-JSXDRState class registry so it uses a JSDHashTable upon
  searching for a class-id by name in an overpopulated (for linear search)
  registry table.
- Clean up API nits such as JS_XDRNewBase => JS_XDRInitBase, with parameter
  list rotation to put cx last (JS_XDRInitBase is an infallible init helper,
  not an error-reporting, cx-comes-first, API entry point).
- Fix some XXX comments, unneeded masks, other nits.
- Make sure all JS XDR API functions start with JS_XDR.
2001-03-06 01:56:30 +00:00
brendan%mozilla.org 55d5713602 Don't deprecate __proto__, there ain't no forward-compatible alternative (68401, r=timeless, sr=shaver). 2001-02-24 03:07:58 +00:00
brendan%mozilla.org 8aa6c94c12 Crash fix (first part, two more files to come) for old-style obj.eval in a function (68498, r=bryner, sr=jband). 2001-02-14 09:11:09 +00:00
brendan%mozilla.org e23a1be36f Fix for bug 44009 (r=rogerl, sr=shaver)
- Remove bogus JS_ASSERT(!outermost) from the code that deals with a "#n="
  type string being returned from js_EnterSharpObject, where the hash entry
  is not yet sharp (because we haven't seen the object twice during depth
  first search).  This case trivially arises for the outermost object in,
  e.g., 'o={}; o.foo=o; uneval(o)'.
- Avoid parenthesizing #n={...} object initializers for uneval, as they are
  not ambiguous (whereas {foo:1}, e.g., is ambiguous because it could be a
  block statement containing a labeled expression statement, or it could be
  an object initializer).
- Death to tabs!
2001-02-06 23:19:44 +00:00
brendan%mozilla.org d0385b286a Throw EvalError for indirect eval calls iff strict+werror (38512, r=rogerl, sr=shaver). 2001-01-31 01:12:15 +00:00
brendan%mozilla.org 499dcb0009 2nd attempt: Fix API botch where 'var x=0' vs. 'x=0' could put x in a different object (65553, r=mccabe, sr=jband). 2001-01-20 01:41:55 +00:00
kin%netscape.com 31dc7d8cfc Temporary fix for Bug #65828: mozilla installer.exe fails with "-229 script error"
Backing out Brendan's previous checkin for bug #65553 (jsapi.c, jsdbgapi.c, jsemit.c, jsinterp.c, jsinterp.h, jsobj.c, and jsscript.c), so we can get smoke tests going.

r=attinasi@netscape.com (sheriff)
2001-01-18 22:10:12 +00:00
brendan%mozilla.org e6b898515c Fix API botch where 'var x=0' vs. 'x=0' could put x in a different object (65553, r=mccabe, sr=jband). 2001-01-18 03:00:31 +00:00
brendan%mozilla.org 241d647c16 Fix ABW impurities under JS_ClearScope on an unmutated obj (64958, r=shaver, sr=jband). 2001-01-11 23:55:30 +00:00
brendan%mozilla.org 7b1d57a4dc Don't fatten a flyweight lock unnecessarily in JS_SetPrototype; misc. cleanups (63097, r=mccabe, sr=jband). 2000-12-20 22:36:01 +00:00
jband%netscape.com 33ab5378a8 fix bug 59588. Since js_MarkAtom is called *so* often but is usually short-circuited, we add a macro to get the shortcircuit flag in the 3 callers and avoid most of the calls. r=mccabe sr=brendan 2000-12-06 06:03:30 +00:00
brendan%mozilla.org 38504ea317 JSPROP_SHARED implies no slot to entrain garbage (bug 61482, r=mccabe, sr=jband). 2000-12-05 21:47:23 +00:00
brendan%mozilla.org 0e3fd5e8ba All this r=mccabe, r=beard, and sr=jband -- many thanks to all who helped,
especially to jband for his great stress-test setup and particularly helpful
(in terms of reproducing bugs in draft patches) MP and laptop machines.

- Radical(*) object (scope) locking optimization: don't lock if a scope is
  accessed on the context that exclusively owns it (initially, the context
  on which the scope was created).  Once a scope becomes shared among more
  than one owner-context, give it the usual thin or fat lock, per existing
  jslock.c code.

  I did this at the memory cost of another word per JSScope, ownercx, which
  raised scope size from 12 to 13 words if !DEBUG.  I also added a linked
  list head pointer, rt->scopeSharingTodo, and a scopeSharingDone condition
  variable to JSRuntime, and a scopeToShare pointer to JSContext that's
  necessary for deadlock avoidance.

  The rt->scopeSharingTodo list links JSScopes through the scope->u.link
  union arm, which overlays the pre-existing scope->count (now u.count)
  member.  This list holds scopes still exclusively owned by a context, but
  wanted by js_LockScope calls active on other threads.  Those calls wait
  on the rt->scopeSharingDone condition, which is notified every time an
  owner-context ends the request running on it, in which code active on
  that context may be using scope freely until end of request.

  The code that waits on rt->scopeSharingDone must first suspend any and
  all requests active on the calling context, and resume those contexts
  after the wait is notified.  This means a GC could happen while the
  thread locking a scope owned by another thread's context blocks; all
  calls to JS_LOCK_OBJ must therefore first home fp->sp above any live
  operands, e.g.  The interpreter takes care to do that already.

  To avoid AB-BA deadlocks, if a js_LockScope attempt on one context finds
  that the owner-context of the scope is already waiting on a scope owned
  by the current context (or indirectly depending on such a scope lock),
  the attempt converts the scope from lock-free exclusive ownership to
  shared ownership (thin or fat lock).

- Fix js_SetupLocks and the js_LockGlobal/js_UnlockGlobal code to avoid
  divmod instruction costs, strength-reducing to bit-mask instructions.

- The radical lock-free scope change required care in handling the 0=>1
  and 1=>0 transitions of cx->requestDepth, which was till now thread-local
  because part of the JSContext not manipulated by other threads.  It's
  still updated only by cx's thread, but it is read by other threads in
  the course of attempting to claim exclusive ownership of a scope for more
  lock-free JS object operations.

- The JS_SuspendRequest and JS_ResumeRequest APIs have changed incompatibly
  to require their caller to save and restore the requestCount found when
  JS_SuspendRequest is called.  This is necessary to avoid deadlock; sorry
  for the incompatible change.

- Fixed various nits in jslock.[ch], including using Init/Finish rather
  than New/Destroy for the methods that take a JSThinLock and initialize
  and finish/free its members.  Another example: JS_ATOMIC_ADDREF is now
  JS_ATOMIC_INCREMENT and JS_ATOMIC_DECREMENT, so the two cases can be
  mapped to PR_AtomicIncrement and PR_AtomicDecrement.  This entailed
  changing jsrefcount from jsword to int32 (PRInt32).

- No need to use JS_ATOMIC_INCREMENT on JSScopeProperty.nrefs, as it is
  always and everywhere protected by the property's JSScope.lock.

- Cleaned up gratuitous casts in jscntxt.c by using &cx->links, etc.

- The lock used for mutual exclusion around both request begin and end vs.
  GC synchronization is rt->gcLock, and this lock now also protects all
  scope->ownercx pointer changes from non-null (exclusive) to null (shared),
  the rt->scopeSharingTodo/scope->u.link list operations, and of course the
  rt->scopeSharingDone condition.

  But this means that js_GC cannot hold rt->gcLock across the bulk of its
  body, in particular the mark phase, during which JS_GetPrivate calls,
  e.g., may need to "promote" scope locks from lock-free to thin or fat,
  because doing so would double-trip.  There never was any good reason to
  hold rt->gcLock so long, of course -- locks are for mutual exclusion, not
  for waiting or notifying a thread -- those operations require a condition,
  rt->gcDone, which we already use along with rt->gcLevel to keep racing GC
  attempts at bay.

  So now that rt->gcLock does not protect the mark phase, the enumeration
  of rt->gcRootsHash can race badly with JS_RemoveRootRT, an API that may
  legitimately be called outside of a request, without even a context.  It
  turns out that people may be cheating on the request model even with
  JS_AddRoot, JS_AddNamedRoot, and JS_RemoveRoot calls, so we must make
  all of those interlock with the GC using gcLevel and gcDone, unless they
  are called on the gcThread.

  Also, since bug 49816 was fixed, there has been no need for a separate
  finalize phase, or for rt->gcFinalVec.  Finalizers can no longer allocate
  newborn GC-things that might be swept (because unmarked), or double-trip
  on rt->gcLock (which is no longer held).  So js_GC finalizes as it sweeps,
  just as it did in days of old.

- I added comments to jslock.h making it plain that callers of JS_LOCK_OBJ
  and JS_UNLOCK_OBJ must either be implementations of js_ObjectOps hooks,
  or code reachable only from those hooks; or else must be predicated on
  OBJ_IS_NATIVE tests.  It turns out jsinterp.c's CACHED_GET and CACHED_SET
  macros neglected to do such tests, limiting the ability of JS embeddings
  to implement JSObjectOps with their own non-JSScope JSObjectMap subclass.
  Fixed, small performance hit that the lock-free optimization should more
  than make up for.

- jslock.c now gives a #error if you try to compile it on a platform that
  lacks a compare-and-swap instruction.  The #error says to use NSPR locks.
  Before this change, some platforms would emulate compare-and-swap using
  a global PRLock, which is always worse in runtime than using per-scope
  PRLocks.
2000-12-04 02:43:31 +00:00
mccabe%netscape.com 239ac07da7 Fix to 57048. Bring the JS engine's implementation of Object.prototype.propertyIsEnumerable in line with the ECMA spec.
Thanks to David Flanagan for noticing this problem.

r=rogerl
2000-11-29 02:05:10 +00:00
brendan%mozilla.org bc3f635a48 Use 0 - i rather than -i to avoid unsigned warning on Windows. 2000-10-29 18:08:40 +00:00
brendan%mozilla.org 12e9876d3d Handle negative-int-fits-in-jsval string literals as property names equivalent to their int conversions (57043, r=shaver, sr=jband). 2000-10-29 01:30:16 +00:00
brendan%mozilla.org 1dbf40a31a Fix obj.toSource to get attributes using the object in which id was found (56482, r=jband, sr=shaver). 2000-10-25 07:00:31 +00:00
brendan%mozilla.org 616048726d Remove not-found property caching (55624, r=shaver a=jband). 2000-10-09 14:38:21 +00:00
brendan%mozilla.org 3fb6399734 Fix 53268, r=jband. 2000-09-21 01:37:02 +00:00
brendan%mozilla.org 293ddb04d6 Add strict warning for undefined property reference (foo.bar where bar names no object in foo or its prototypes; r=jband). 2000-09-19 02:24:11 +00:00
brendan%mozilla.org 76a1bda8a7 Fixes to make JS GC truly exact:
- All jsvals for which JSVAL_IS_GCTHING evaluates to true must contain tagged
pointers into the GC heap -- therefore jsapi.c's JS_DefineConstDoubles cannot
"cheat" by tagging addresses of static jsdoubles to avoid js_NewNumberValue.

- Finalization is now interleaved with the Sweep phase, to avoid allocating
memory for finalization records while sweeping.  Instead, the JSRuntime holds a
preallocated JSGCThing vector (gcFinalVec) that the Sweep phase fills and
flushes via gc_finalize_phase, repeatedly.

This means that finalizers cannot allocate a new GC thing, an incompatible but
plausible change.  js_AllocGCThing asserts and then checks whether it is called
while rt->gcLevel is non-zero, and fails the allocation attempt if so.  But this
fixes bug 38942, where the old sweep-then-finalize with a sweep => malloc
dependency could lead to memory exhaustion.

- Instead of scanning whole stackPool arenas, which led to UMRs (bug 27924) and
sometimes to gross over-scanning that depended on the GC bounds-checking all
thing pointers against its heap, we scan exactly those stack slots in use:
  - arguments reachable from fp->argv;
  - variables reachable from fp->vars;
  - operands now reachable from fp->spbase, bounded above by the lesser of
    fp->sp or fp->spbase + fp->script->depth for an interpreted frame; if the
    latter, fp->sp has advanced logically above the operand budget, in order to
    call a native method, and all unused slots from fp->sp up to depth slots
    above fp->spbase must be set to JSVAL_VOID;
  - stack segments pushed when calling native methods, prefixed by JSStackHeader
    structs and linked from cx->stackSegments through each header.
The stack segment headers help the GC avoid scanning unused portions of the
stack: the generating pc slots running depth slots below fp->spbase, and slots
at the end of an arena that aren't sufficient to satisfy a contiguous allocation
for more args, vars, or operands.

- Exact GC means the stack pointer must remain above live operands until the
interpreter is done with them, so jsinterp.c got heavily whacked.  Instead of
POPs of various kinds followed by a PUSH for binary operators (e.g.), we use
FETCH and STORE macros that index by -1 and -2 from sp, and minimize adjustments
to sp.  When sp is homed to fp->sp, this allows js_DecompileValueGenerator to
find the value reliably, and if possible its generating pc.

- Finally, the O(n**2) growth rate of gc_find_flags has been fixed, using the
scheme sketched in bug 49816 and documented in a new major comment in jsgc.c.
Briefly, by allocating flags and things from one arena, we can align things on
1024-byte "thing page" boundaries, and use JSGCPageInfo headers in each page to
find a given thing's flags in O(1) time.

/be
2000-09-14 06:14:45 +00:00
brendan%mozilla.org e185d5b9b7 Fix js_EnterSharpObject to clean up sharpObjectMap on error (44009, r=shaver). 2000-09-01 18:01:04 +00:00
mccabe%netscape.com 5c644e8fc3 Potential fix to 50313
Initialize stack variable to NULL on suspicion that later possibly-unset use of it is causing crash.
2000-08-26 07:10:31 +00:00
brendan%mozilla.org c77f05ae2e Clean up JSObjectOps layering violations by adding mark and clear ops; JSClass gets a corresponding mark op so classes with unregistered roots in private data can mark them. The JS API gets a new JS_MarkGCThing entry point for JSObjectOps.mark implementors. Prerequisite check-in for bug 49816 and others (r=shaver). 2000-08-26 02:30:22 +00:00
brendan%mozilla.org 6aea0bf81f Re-constipate JSClass.name. 2000-08-19 19:17:32 +00:00
jband%netscape.com 577d93dfb4 fix the warnings that went along with the last bustage fix - in case one of the compilers needs it. brendan can fix as he likes in the morning 2000-08-19 10:36:45 +00:00
brendan%mozilla.org f59c35edb2 Support lazy initialization of standard classes and their associated global functions/properties (46703, r=jband,rogerl). 2000-08-19 08:37:07 +00:00
rogerl%netscape.com 9d79d55a1b r,a=brendan@mozilla.org. Adding missing ECMA3 compliance toLocaleXXX
functions to built-in Array, Date and Object object prototypes.
2000-08-09 21:46:03 +00:00
brendan%mozilla.org ef35aeadcc Fix second (prototype-owns-property) setter/shared special case to unlock properly (45940, r=mccabe). 2000-07-22 01:03:04 +00:00
rogerl%netscape.com abddb6b6be r=brendan@mozilla.org, Fix for #44013 - enforce security for defineGetter
& defineSetter by calling OBJ_CHECK_ACCESS.
2000-07-10 20:21:38 +00:00
brendan%mozilla.org 6afe0ed1a7 Fix JS_SetPrototype and __proto__ setting to deal with shared scopes; use JSObjectOps for setProto and setParent operations, and add spare op slots (41126, r=shaver@mozilla.org,pschwartau@netscape.com). 2000-06-27 02:37:25 +00:00
brendan%mozilla.org 6ca20f928f Fix ECMA DontDelete compliance problems, which create getter/setter security holes (40760, r=shaver). 2000-06-02 00:02:46 +00:00
brendan%mozilla.org aca040859b Use JS_ValueToId to go from user to internal property id, for integer-id optimality (40731, r=shaver). 2000-05-31 22:10:53 +00:00
brendan%mozilla.org 53e6c7a2fa Cleanups from tlundeen@webcrossing.com, plus fun->call=>native renaming. 2000-05-15 03:54:50 +00:00
rogerl%netscape.com 0d6de00daf r=norris@netscape.com
Bug #34187, adding 'eval' as property of global object.
Bug #31864, decompiler failure when attempting to invoke a non-function
where that object is accessed via an incoming argument of the current
function.
2000-05-01 21:55:52 +00:00
brendan%mozilla.org 5e87596782 Always call resolve for each object in a prototype chain (35738, r=shaver). 2000-04-15 02:01:02 +00:00
norris%netscape.com e356de6476 Fix
28390, 28866, 34364
r=brendan@mozilla.org
35701
r=jst@netscape.com
2000-04-14 03:14:53 +00:00
brendan%mozilla.org ec99956290 Clean up ugly whitespace, some of which survived my r=brendan comments. 2000-04-05 02:17:38 +00:00
brendan%mozilla.org e7aad0c475 Eliminate unused var warning and clean up other stuff not in the patch I reviewed and approved! 2000-04-04 08:17:05 +00:00
brendan%mozilla.org 6fd7f42463 Don't forget to drop property in getter/setter case (34069, r=jband,a=leaf). 2000-04-01 04:23:04 +00:00
norris%netscape.com 060e388a6b Files:
caps/idl/nsICertificatePrincipal.idl
	caps/idl/nsIPrincipal.idl
	caps/src/nsBasePrincipal.cpp
Implement the ability to manipulate multiple capabilties simultaneously.
r=mstoltz@netscape.com

Files:
	caps/src/nsCodebasePrincipal.cpp
Codebase equality should be based upon origin, not full path.
r=mstoltz@netscape.com

Files:
	caps/src/nsScriptSecurityManager.cpp
Change URI checking to deny based upon scheme rather than allow based upon
scheme for greater flexibility.
r=mstoltz@netscape.com

Files:
	dom/public/nsDOMPropEnums.h
	dom/public/nsDOMPropNames.h
	dom/src/base/nsGlobalWindow.cpp
	modules/libpref/src/init/all.js
Fix bug 20469 Seeing JS functions and global variables from arbitrary host
r=vidur@netscape.com

Files:
	dom/src/base/nsJSUtils.cpp
	dom/src/base/nsJSUtils.h
	dom/src/base/nsJSEnvironment.cpp
	dom/tools/JSStubGen.cpp
	layout/base/src/nsDocument.cpp
	layout/html/content/src/nsGenericHTMLElement.cpp
Improve performance by removing NS_WITH_SERVICE call for every DOM access.
Propagate XPCOM failure codes out properly.
r=vidur@netscape.com

Files:
	layout/html/document/src/nsFrameFrame.cpp
Fix 27387 Circumventing Same Origin security policy using setAttribute
r=vidur@netscape.com
2000-03-11 06:32:42 +00:00
rogerl%netscape.com 429c1db8e9 r=brendan,rginda
Added ECMA3 compliant getter/setter syntax.
Fixed bugs
	- #28686, mishandling of \$ in replace()
	- #27902, eval not detected as heavyweight indicator for non ECMA
			context version.
2000-03-02 23:21:03 +00:00
jband%netscape.com 417094058a Fix bug 28982. Call to JS_ClearScope in property setter (e.g. window.location = "foo")
was causing defered calls to js_FreeSlot to do wild pointer writes into slots that
were no longer owned by the object. Also this improves the fix to 14462 (see note
in 28982 from brendan). r=brendan@mozilla.org a=jar@netscape.com
2000-02-26 23:47:33 +00:00
rogerl%netscape.com 1b01852975 r=brendan@mozilla.org
Bug #14462, lot's of discussin there about these changes, but here's
Brendan's description :
In order, changes in the patch are:

- Rename JSSLOT_ITR_STATE to be JSSLOT_ITER_STATE (avoid cybercrud abbreviation
as cbrcrd, no more six-char id limits!).

- Property cache tests must occur with the object's scope-lock held, to close a
race with delete (js_DestroyProperty, always called with the property's scope
locked).  Once the cache has been hit, and before the lock is released, the
property's refcount must be bumped.  This requires re-acquisition of the lock
and js_DropScopeProperty afterward.

- Reworked js_FindProperty to use a do-while loop, as cx->fp->scopeChain must be
non-null.  This avoids a gratuitous lastobj init done to "Suppress gcc warning"
in the old revision.

- Akin to the property cache hit cases in jsinterp.c and jsobj.c's
js_FindProperty, code to hold and drop the scope-property by its refcount that
was #ifdef JS_THREADSAFE must be unconditional, now that user-defined getters
and setters may delete the property id they're getting or setting.

- Fixed overlong continuation line in jsobj.h.

/be
2000-02-08 01:24:53 +00:00
brendan%mozilla.org 1462b9a294 - Eliminate ancient, bogus proxying of function object for its call objects (23346, r=jband@netscape.com).
- Tabs expanded as much as I could stand, without taking too much cvsblame.
2000-02-04 02:01:49 +00:00
mccabe%netscape.com e2e7c63c10 Changes to allow Spider Monkey to be compiled under C++.
Courtesy Bill Gibbons <bill@gibbons.org>

His comments:

Here are the changes to JSRef to make it compile either as C or C++. Mostly the changes are to add missing casts (since C++ doesn't have implict conversion from void* to other pointer types nor implicit casts from ints to enumerations) plus a few random things like the use of "private" as a variable name.

There are a few other minor bug fixes; in particular:

  * A long statement with and'ed conditions is reformatted to make it easier to remove other builtin objects (e.g. Date).

  * A #if was added to jsscript.c for the JS_HAS_SCRIPT_OBJECT off case.

  * In jsmath a #ifdef was changed to #if.

My notes also mention...

  * jsobj.c should include jsopcode.h

  * jsfun.c - doesn't link if JS_HAS_ARGS_OBJECT is off

  * jsarray.c - a reference to js_ValueToSource should be conditional on JS_HAS_TOSOURCE

r=mccabe
2000-02-02 01:10:31 +00:00
norris%netscape.com c04c4d51f9 Fix bug #25864 watch() vulnerability
r=vidur,rogerl
2000-02-02 00:22:58 +00:00
brendan%mozilla.org db78bfb8b1 JS1.5 fixes (17290, 21618, plus shaver's 22243 fix, r=shaver@mozilla.org). 2000-01-18 11:06:05 +00:00
brendan%mozilla.org 46665376d1 Fix obscure eval bug and ECMA conformance issue (20256, r=rginda@netscape.com). 1999-12-01 04:30:04 +00:00
brendan%mozilla.org 92490cbc03 Whitespace, comment, and bracing diffs. 1999-11-17 04:32:37 +00:00
rogerl%netscape.com 3118263222 r=norris
Fix for toString under 1.2 - calls toSource which provides extra '{}' that
doesn't match previous behaviour.
1999-11-16 23:53:33 +00:00
brendan%mozilla.org 367ea33053 XULDOMJS_19991106_BRANCH landing (15146, 18025, r=shaver@mozilla.org) 1999-11-12 06:03:40 +00:00
mccabe%netscape.com 5b9d75022d Fix most remaining warnings in js/src. Patch courtesy slamm.
r=mccabe.
1999-11-11 21:52:35 +00:00
brendan%mozilla.org 9d476409b6 Fixed getter/setters, pave way for brutal sharing (15146, r=shaver@mozilla.org,rogerl@netscape.com) 1999-11-02 02:23:50 +00:00
brendan%mozilla.org 526bfd1116 - Chouck's changes to grow a JSIdArray if necessary in JS_Enumerate, with my
code review and fixes (r=chouck@geocast.com).  He needs this cuz he has no
  knowledge of exact number of properties before new-style enumerating them.
- Patch up jsdbgapi.c a bit -- it needs to use OBJ_GET_ATTRIBUTES and new APIs
  to do a better job describing properties to a debugger.
- Add JSMSG_CANT_DESCRIBE_PROPS for bogus non-native error case in jsdbgapi.c.
- Fix "Inappropriate" => "invalid" in JSMSG_BAD_ARRAY_LENGTH message.
1999-10-25 19:24:03 +00:00
brendan%mozilla.org f1534c54ea Avoid gratuitous initialization and extra sets of ok (r=shaver@mozilla.org). 1999-10-22 01:44:47 +00:00
shaver%netscape.com 34010403ff fix obj_getCount to property destroy state and propagate error (r=jband) 1999-10-15 04:32:46 +00:00
norris%netscape.com 8a23341b00 Fix unix build warning.
Reviewed by rogerl@netscape.com.
1999-10-12 22:48:17 +00:00
brendan%mozilla.org 78daa5976c Fix Object.prototype.toSource so it parenthesizes outermost-toSource literals for eval roundtrips. 1999-10-06 09:09:31 +00:00
norris%netscape.com d21c5596fd Fix the following bugs:
14443 "Same origin" security policy may be circumvented using docu
14820 Fixing up the relationship between nsCodeBasePrincipal and n
14919 Crash in JS MM code
Reviewed by mstoltz, approved by scc.
1999-10-02 03:41:37 +00:00
dmose%mozilla.org 16e0d1f95e update license boilerplate to NPL-1.1 dual-licensed with the GPL. a=brendan, r=brendan. 1999-09-28 23:12:09 +00:00
brendan%mozilla.org d70aa0ef6b - Enable JS_HAS_NEW_OBJ_METHODS (Object.prototype.hasOwnProperty, isPrototypeOf
and propertyIsEnumerable) for JS1.5.
- Optimize obj_propertyIsEnumerable to avoid extra lookup code bloat, requiring
  fix to js_GetAttributes (unset out param on successful early retunr) that it
  exposed.
- Use more righteous else-if style in shaver's jsarray.c change.
1999-09-22 05:54:44 +00:00
brendan%mozilla.org 94a86fe442 - Bumped default compile-time JS version from 1.4 to 1.5.
- Add JS1.5 getter/setter support in all its glory:

  * getter function SN() {return ++x} at top-level or as a closure binds an SN
    property getter than returns the incremented value of x.  Likewise for
    setter function SN(y) {return y = x}.

  * getters and setters may be defined in an object literal:
      o = {p getter:function() {return ++this.x},
           p setter:function(y){return this.x = y},
           x:42};

  * getter= and setter= operators (compound tokens) may be used to bind getter
    and setter properties dynamically:
      o = new Object;
      o.p getter= function() {return ++this.x};
      o.p setter= function(y){return this.x = y};
      o.x = 42;

    Waldemar is concerned that this form will collide semantically with JS2, so
    I am not committing to keeping it in JS1.5.  I'd like to check my code in
    ASAP so shaver can use it, and I'd also like to see this form get used (or
    not) during Mozilla betas.  Caveat emptor, and if you find this "dynamic"
    or "imperative" form necessary and hard to substitute, please let me know.
    If this proves important to users, then I think JS1.5 should keep it.

- Cleaned up property flags (in a binary-incompatible fashion -- who cares?) by
  eliminating JSPROP_ASSIGNHACK and JSPROP_TINYIDHACK.

- Added JS_DONT_PRETTY_PRINT flag to be ORed with the indent argument to the
  several JS_Decompile*() API calls.  This avoids any newlines or identation in
  the decompiled string.
 
- Improved and extended (for getter/setter non-reservation) scanner lookahead
  by using a circular (power-of-2 sized) token buffer.

- Fix ECMA Edition 3 deviation where function f(){function g(){}} bound f.g by
  mistake (it should arrange to make a closure named g in activations of f, but
  it should not bind a property of function f).
1999-09-21 00:13:48 +00:00
jband%netscape.com 83ffb3a7d0 check resolve op for null before trying to use it 1999-09-11 05:22:42 +00:00
brade%netscape.com d2b75277c5 remove mac compiler warnings 1999-08-20 13:30:39 +00:00
brendan%mozilla.org ed627432e2 Fix warnings reported at http://tinderbox.mozilla.org/SeaMonkey/warnings.html, mostly unsigned/signed bothers. 1999-07-28 06:48:44 +00:00
brendan%mozilla.org 3f05c43fc5 Bugs, bugs bugs:
- js_DecompileValueGenerator had rusted due to bytecode/source-note changes,
  or maybe parts of it never worked right.  Anyway, it now does not induce a
  crashing underflow in the decompiler.  As part of this fix, it now takes a
  checkStack flag telling whether to look for the jsval v argument on the JS
  stack.  The calls from ImportProperty, js_SetProperty, and js_DeleteProperty
  pass in v a jsval for the property id, which should not be sought after on
  the stack (it might happen to be there due to o['p'] = 2, but we want to
  decompile o["p"], not "p").
- js_DecompileValueGenerator would load a generating pc even if the value v
  did not match the pc's corresponding stack item!  Oops.  This lead to less
  than idea diagnostics.
- js_DecompileValueGenerator was also not mapping JSOP_TRAP to the real op at
  a sufficiently early and univeral point in its control flow.
- Fix PopOff to assert and check for stack underflow in the decompiler, and
  beef up PushOff too (it asserted, but did not check).
- js_ReportIsNotFunction now avoids JS_InternString by indexing directly into
  cx->runtime->atomState.typeAtoms with the result of JS_TypeOfValue.
- Removed unnecessary local GC root reserved by non-zero trailing member of
  obj_eval's JSFunctionSpec initializer.
1999-07-23 08:01:54 +00:00
brendan%mozilla.org 7fa05e97d9 - Fix for..in bug where ECMA 12.6.3 steps 5 and 6 are reversed: the effect was
to define an unbound global variable used to enumerate an empty object, when
  the standard says no variable should be defined.
- Clean up minor nits, make comment style match prevailing, tighten up for..in
  element-indexing special case comments.
- Fix js_Invoke to take CONSTRUCT and INTERNAL flags arg instead of a construct
  boolean arg and the JSStackFrame internalCall mis-located boolean non-arg.
  Use these flags correctly in all calls (previous version failed to set the
  bogus frame.internalCall around js_Invoke calls from jsfun.c and jsstr.c).
1999-07-15 02:24:23 +00:00
brendan%mozilla.org 1eed515ae6 Rip out assign hack, simplify boolean value synthesis, minor cleanups. 1999-07-01 02:24:32 +00:00
brendan%netscape.com 54eafda12a - Rename js_CallFunctionValue to js_InternalCall to distinguish it from all
"external" calls compiled from scripts, which have stack budget depth slots
  under the return value slot for the call expression's generating pc.
- New internalCall packed boolean flag in JSStackFrame to distinguish callers
  of js_InternalCall so the generating pc isn't mistakenly stored depth slots
  below stack space allocated on-the-fly for internal call args/rval.
- Fixed bugzilla bug 8042, finally by storing the call expression's generating
  pc -- but only for external calls.
- Whitespace policing, gratuitous parenthesization reduction, etc.
1999-06-26 03:28:47 +00:00
rogerl%netscape.com 5f9a2314ee Fixed bug #7635. instanceof now starts the chain walk from the object
prototype.
1999-06-15 23:44:30 +00:00
fur%netscape.com 543e6e7fe4 Merge changes from SpiderMonkey140_BRANCH. Note: none of the
added files participate in the client build.
1999-04-27 15:18:57 +00:00
brendan%netscape.com d46bbcad44 Cast printf %p args to (void*). 1999-04-27 03:42:28 +00:00
jband%netscape.com 2e68a1089d js_DefaultValue now accepts that it is OK for a request with hint of JSTYPE_OBJECT to result in an object of type JSTYPE_FUNCTION. This is done so that objects that happen to have 'call' ops will not fail when being 'converted' to 'Object'. This Fix is going onto the trunk, SpiderMonkeyDev_BRANCH, and SpiderMonkey140_BRANCH 1999-04-02 23:16:40 +00:00
mccabe%netscape.com 7949df7b77 Stable drop of JavaScript interpreter code from SpiderMonkey140_BRANCH 1998-11-05 00:08:43 +00:00
fur%netscape.com 7b75221d8c Checkpoint JS1.4 from JS_STABLE_10131998_BRANCH. Changes include:
+ merging of js/src and js/ref
 + elimination of most dependencies on NSPR
 + JS1.4 feature additions and accumulated bug fixes

More details are in last week's mozilla status report.
1998-10-14 10:22:38 +00:00
shaver%netscape.com 52c57fa8ce JS_ConstructObject: fill NULL proto/parent like JSOP_NEW would 1998-08-26 06:14:55 +00:00
warren%netscape.com c9bd5d8074 Landing changes in the OJI_19980727_BRANCH since the OJI_19980727_TIP_MERGE tag. 1998-07-31 20:19:50 +00:00
mccabe%netscape.com 0ed94e2af6 Propagating numerous fixes from js/ref
and development branches, including but
not limited to:

- Preliminary exception handling per
ECMA proposal; try, multiple
catchblocks, and finally.  Catchblocks
are of the form catch (v) or
catch(v:<guard>), where guard is an
optional boolean expression that is
evaluated to determine whether the
exception is to be caught by that block.

- ECMA-proposed 'in' operator; "'foo' in
o" or "4 in o" asks if o has property
foo or element 4.

- Added a new set of defines in
jsconfig.h for js 1.4
features-in-progress.  (in, instanceof,
exception handling.)  Default build
version is now 1.4.  Fixed a few
conditional features that had become
broken.

- Progress towards porting to FreeBSD
and Alpha; casts of NaN and friends to
int are a little more localized.  Not
there yet...

- New config files to compile on more
OSes; various fixes to improve
portability.
1998-07-31 00:07:22 +00:00
fur b8940b6cb4 Propagation of numerous bug fixes from 4.06 (which have been reviewed
and tested in that release):

#114564: Fix JS_Enumerate to return an empty id array instead of null
#115395: Fix JS garbage collection
#115200: Security dialog no longer blows assertion
#123211: Make sure output of sort array function is -1, 0, or 1.
#116195: Fix ImportProperty(), cope with an existing local variable
         of the same name as the imported property
         Unbusticate JS_invoke() so that closures work again
#115384,#115395: Handle bugs in toSource that strike when
         getProperty is non-idempotent.  Fix crash during JavaScript
         garbage collection after enumerating object properties.

#??????: mjudge - Win16 files to make ptrdiff_t be 32 bits on Win16
1998-06-09 23:04:48 +00:00
fur ddc67e87cf Initial checkin of JavaScript 1.3, migrated from JSFUN13_BRANCH in /m/src repository 1998-04-24 00:31:11 +00:00
ltabb 3b56a9af51 Free the lizard 1998-03-28 02:44:41 +00:00