3422 Commits

Author SHA1 Message Date
nboyd%atg.com
4132fc999b Patches from Igor:
-----
The patch changes NativeCall to use IdScriptable. This is done mostly
for uniformity with other Native* classes plus it would allow to call
NativeCall.init directly and make NativeCall package private.
-----
The patch changes NativeScript to use id-based properties. Due to
inheritance from NativeFunction, id support requires to take into
account the fact that there are instance ids available from
BaseFunction. This is the reason to use "int prototypeIdShift" instead
of "boolean prototypeFlag" so it can store instance id offset.

The patch updates ScriptRuntime.callOrNewSpecial to check against
IdFunction and not FunctionObject for the Script exec method where it
also add finally clause to make sure that Context.exit would always be
called after Context.enter in the evalScript method.
-----
After converting NativeScript and NativeFunction to use IdScriptable,
they get scope argument directly as a parameter of execMethod call, so
cx.ctorScope is not used any more. The patch removes code to set/unset
cx.ctorScope.
-----
[This patch depends on conversion of NativeScript and NativeCall to use
IdScriptable and the patch to remove access of ctorScope from
FunctionObject]

The patch changes Context.initStandardObjects to call NativeCall.init
and NativeScript.init directly plus it unrolls the lazily initialization
loop. Due to rather poor support of an array initialization in Java byte
code, it actually decreases code size while eliminating are creation of
array object. The patch also removes ctorScope field as unused.
-----
The patch makes sure that ids used by NativeGlobal are visible only in
the object instance that initializes global scope and removes some junk
white space at line ends.
-----
To use the idswitch tool to generate map for strings that can not be
part of Id_ Java identifier like $*, I added code to the tool to look
for "// #string=...#" in the id definition line. The attached README
file also contains some documentation about the tool and should go to
idswitch directory.

The patch was made from toolsrc/org/mozilla/javascript/tools via:
cvs diff -u > idswitch_patch


git-svn-id: svn://10.0.0.236/trunk@95908 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-25 13:24:17 +00:00
brendan%mozilla.org
bf20b1ca3d - 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)


git-svn-id: svn://10.0.0.236/trunk@95896 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-25 03:05:38 +00:00
nboyd%atg.com
ac7a4da62b Patches from Igor:
----
The patch changes Notification to extend from BaseFunction and adjusts
Context, FunctionObject and NativeScript accordingly.
----
The patch changes BaseFunction.jsConstructor to use the scope argument
passed to execMethod instead of using cx.ctorScope. This argument is
null in this case because when calling execMethod IdFunction.construct
does not set cx.ctorScope because scope is passed to execMethod as argument.


git-svn-id: svn://10.0.0.236/trunk@95869 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-24 13:38:12 +00:00
pschwartau%netscape.com
1408c7a297 Adding attribution to Mike Epstein, creator of this test.
git-svn-id: svn://10.0.0.236/trunk@95838 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-23 23:01:08 +00:00
pschwartau%netscape.com
a5fc56637a Initial add. Regression test for bug 82306.
git-svn-id: svn://10.0.0.236/trunk@95836 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-23 22:47:48 +00:00
brendan%mozilla.org
d442d78367 Fix failure to round up in chunked realloc test in AddCharsToURI (82306, r=rginda, sr=scc).
git-svn-id: svn://10.0.0.236/trunk@95819 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-23 06:49:19 +00:00
brendan%mozilla.org
5ec88cd71a Add intern help message, caught by epstein@tellme.com (not part of build).
git-svn-id: svn://10.0.0.236/trunk@95814 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-23 06:13:13 +00:00
brendan%mozilla.org
678d939e1c Lazily pin the less likely atoms when resolving standard class names (77861, r=jst, sr=jband).
git-svn-id: svn://10.0.0.236/trunk@95787 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-23 04:02:06 +00:00
jband%netscape.com
c3c82b5b1c fix bug 82220. enumeration of Components.interfaces should only include scriptable interfaces. r=vidur sr=jst
git-svn-id: svn://10.0.0.236/trunk@95742 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-23 00:12:04 +00:00
rginda%netscape.com
6cb853ad8b create a dummy stack frame before calling out to the new-script-hook. The dummy frame prevents the script from being affected by any GC the hook may trigger. See bug 77636. author=shaver, r=me, sr=brendan
git-svn-id: svn://10.0.0.236/trunk@95736 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-22 23:57:37 +00:00
brendan%mozilla.org
0bcb3723cd Warning abatement (r=polarbear, sr=lumpy).
git-svn-id: svn://10.0.0.236/trunk@95727 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-22 23:25:18 +00:00
nboyd%atg.com
12b4f86334 This patch renames in IdFunction the methodName field into functionName
and ads getFunctionName method to match NativeFunction.


git-svn-id: svn://10.0.0.236/trunk@95671 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-22 12:51:21 +00:00
nboyd%atg.com
ec5a045ef1 This patch fixes the bug when global With object was set to With
prototype and not With constructor, makes id for constructor property
visible only in a prototype instance and removes the unused scopeInit
function.


git-svn-id: svn://10.0.0.236/trunk@95670 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-22 12:51:02 +00:00
nboyd%atg.com
0a3fc7ffb6 The patch adds new class org.mozilla.javascript.BaseFunction as a base
for classes implementing the Function interface and switch
IdFunction.java to use it. The code in BaseFunction to serve as
Function.prototype is not used yet. The patch modifies NativeCall so it
can be used against BaseFunction.

The patch was made from org/mozilla directory via
diff -uN javascript.0 javascript > BaseFunction_patch


git-svn-id: svn://10.0.0.236/trunk@95669 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-22 12:50:26 +00:00
scc%mozilla.org
fccb53ea7f ok, but make this local bustage fix into a global one
git-svn-id: svn://10.0.0.236/trunk@95666 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-22 08:43:30 +00:00
scc%mozilla.org
e1841460d5 Fixing AIX/BeOS bustage. The statically determined length of the string was |0|, and on these ports, that was erroneously considered a candidate for conversion to a pointer, which made selection of the appropriate constructor for |nsDependentString| ambiguous ... go figure.
git-svn-id: svn://10.0.0.236/trunk@95664 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-22 08:02:58 +00:00
scc%mozilla.org
1b7f52f09f Fixing AIX/BeOS bustage. The statically determined length of the string was |0|, and on these ports, that was erroneously considered a candidate for conversion to a pointer, which made selection of the appropriate constructor for |nsDependentString| ambiguous ... go figure.
git-svn-id: svn://10.0.0.236/trunk@95659 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-22 07:25:25 +00:00
jband%netscape.com
cfb2c4ef41 - Fix bug 81341. Force creation of a WrappedJS around the JSObject of
aWrappedNative when doing aggregation. r=dradley sr=jst.
- Fix bug 81877. Avoid infinite recursion when reporting threadsafety
error. r=perterv,dradley sr=jst.
- Fix bug 81882. Use JS_AddNamedRootRT in XPCWrappedNative::AddRef to avoid
the unnecessary cost of creating an XPCCallContext in this frequently called
method. r=dbaron,dbradley sr=jst.


git-svn-id: svn://10.0.0.236/trunk@95624 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-21 22:45:14 +00:00
nboyd%atg.com
dae79027b2 This patch changes NativeError.java to store message and name properties
in fields of the object itself instead of using the standard property
hashtable in ScriptableObject.java. This saves 3 object instances per
NativeError (2 slot entries and hashtable array itself) and given the
fact that NativeGlobal defines a few permanent Error instances, it is
visible saving even after taking into account code size increase.

The change also gives a good test of IdScriptable implementation.

-----

This patch introduces the uniform decompile method for NativeFunction
and IdFunction with the signature:

public String decompile(Context cx, int indent, boolean justbody)

instead of NativeFunction.decompile(int indent, boolean toplevel,
boolean justbody) and IdScriptable.toStringForScript(Context cx) and
replaces the special treatment of NativeJavaMethod in
NativeFunction.jsFunction_toString by overriding decompile in
NativeJavaMethod

-----

This patch adds getFunctionName to NativeFunction to return function
name and replaces few places with jsGet_name usage by getFunctionName

The patch was made via
diff -ru javascript.0 javascript > name_patch
from org/mozilla directory


git-svn-id: svn://10.0.0.236/trunk@95602 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-21 15:04:54 +00:00
rginda%netscape.com
e0f36cbef2 - not built -
add enumerateScripts() method to jsdIDebugger service
don't create a new debugger context if the user trys to call on[ForRuntime]() multiple times


git-svn-id: svn://10.0.0.236/trunk@95587 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-21 07:18:10 +00:00
rginda%netscape.com
7b2d61c2b7 - not built -
add onForRuntime() method to jsdIDebuggerService to let native code turn on the deubgger (on() can only be called from js)
register an app-start observer so we can turn on the debugger at startup if "js.debugger.autostart" pref is true.
r=peterv, bug 81840


git-svn-id: svn://10.0.0.236/trunk@95583 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-21 06:00:12 +00:00
nboyd%atg.com
275058c8c5 Subject:
Rhino: behavior update for IdScriptable subclasses
        Date:
             Fri, 18 May 2001 11:45:00 +0200
       From:
             Igor Bukanov <igor.bukanov@windriver.com>
 Organization:
             Wind River
         To:
             Norris Boyd <nboyd@atg.com>




The attached patch introduces separation between id-base properties in
prototype instances and the rest of objects so it is possible to
allocate some ids for each instance and the rest only for prototype. The
patch adds to each descendants of IdScriptable a special prototypeFlag
which set to true only if object serves as a global prototype and all
methods that check/return ids first check for that flag. (This is the
reason for the patch size: diff is not very well in dealing with
indentation changes.)

In this way ids for prototype properties are completely hidden from
potential subclasses and there is no need to define methods like
getMaximumId in most cases, only if some ids present in each instance,
IdScriptable.maxInstanceId should be overridden to return max id present
in each instance.

The patch also replaces 2 boolean fields in IdScriptable by bit masks in
the setupFlag field.


git-svn-id: svn://10.0.0.236/trunk@95546 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-19 17:39:50 +00:00
jst%netscape.com
535c86019d scc checking in from jst's account. bug #75220: sr=jst, rs=brendan. renaming |nsPromiseC?Concatenation| to |nsDependentC?Concatenation|; |nsPromiseC?Substring| to |nsDependentC?Substring|; |nsLiteralC?String| and |nsLocalC?String| to |nsDependentC?String|, as these new names better reflect clients obligations to instances.
git-svn-id: svn://10.0.0.236/trunk@95533 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-19 11:27:30 +00:00
jband%netscape.com
c70bc4bbd4 fix bug 49017. This extends our mapping of idl [function] interfaces so that they will try to treat the JSObject as a callable function (as before), but if the JSObject is *not* a function object then xpconnect will fall back to the non-[function] behaviour of trying to lookup a named function on the JSObject and then call that. r=jst sr=brendan,vidur,jst,(and everyone else I guess)
git-svn-id: svn://10.0.0.236/trunk@95468 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-18 23:35:03 +00:00
jband%netscape.com
dba2f210f3 fix bug 81542. Reorder interface methods so that they do not break compatibility with previously deployed plugins that work with previous versions of our software. The error was that I moved some around at all rather than just adding them to the end of the interfaces! Also, I added back in one method and marked it deprecated. r=dbradley sr=jst
git-svn-id: svn://10.0.0.236/trunk@95467 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-18 23:30:28 +00:00
jband%netscape.com
dd0e8f1737 fix bug 81436. Some Solaris compilers screwup symbol resolution if there is a file scope var that is also declared as extern. So we'll just make it not declare these two static (thses are not names that is going to conflict with anything!) r=timeless rs=jband
git-svn-id: svn://10.0.0.236/trunk@95464 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-18 23:24:19 +00:00
pschwartau%netscape.com
1f1776d21d Improve code by using the apply method of Object.prototype.toString.
git-svn-id: svn://10.0.0.236/trunk@95462 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-18 23:20:25 +00:00
nboyd%atg.com
0777815a96 Fix problem in the following mail:
Subject:
             Embedding Rhino in an Applet
 Resent-Date:
             Thu, 17 May 2001 14:53:05 -0700 (PDT)
 Resent-From:
             mozilla-jseng@mozilla.org
        Date:
             Thu, 17 May 2001 16:39:14 -0700
        From:
             "Chester Kustarz II" <chester@monkey.org>
 Organization:
             monkey.org
          To:
             mozilla-jseng@mozilla.org
  Newsgroups:
             netscape.public.mozilla.jseng




Hello, I am trying to find a scripting language with an interpreter that I
can embed in an applet in order to run test scripts inside the applet. I
have already tried TCL-based Jacl and they do not support running inside an
applet. I then downloaded the Rhino/JS interpreter but am having trouble
getting it to run inside the browser (IE 5.5). Here is the exception I am
getting:

com.ms.security.SecurityExceptionEx[org/mozilla/javascript/ScriptRuntime.<cl
init>]: Reflective access to class java.lang.Thread prohibited.
 at com/ms/security/permissions/ReflectionPermission.check
 at com/ms/security/PolicyEngine.deepCheck
 at com/ms/security/PolicyEngine.checkPermission
 at com/ms/security/StandardSecurityManager.chk
 at com/ms/security/StandardSecurityManager.checkMemberAccess
 at java/lang/Class.checkMemberAccess
 at java/lang/Class.getDeclaredMethod
 at org/mozilla/javascript/ScriptRuntime.<clinit>
 at org/mozilla/javascript/ScriptableObject.getExclusionList
 at org/mozilla/javascript/ScriptableObject.defineClass
 at org/mozilla/javascript/Context.initStandardObjects
 at org/mozilla/javascript/Context.initStandardObjects
 at RhinoShellApplet.init
 at com/ms/applet/AppletPanel.securedCall0
 at com/ms/applet/AppletPanel.securedCall
 at com/ms/applet/AppletPanel.processSentEvent
 at com/ms/applet/AppletPanel.processSentEvent
 at com/ms/applet/AppletPanel.run
 at java/lang/Thread.run
com.ms.security.SecurityExceptionEx[org/mozilla/javascript/Context.initStand
ardObjects]: Unable to access system property:
org.mozilla.javascript.JavaAdapter
 at com/ms/security/permissions/PropertyPermission.check
 at com/ms/security/PolicyEngine.shallowCheck
 at com/ms/security/PolicyEngine.checkCallersPermission
 at com/ms/security/StandardSecurityManager.chk
 at com/ms/security/StandardSecurityManager.checkPropertyAccess
 at java/lang/System.getProperty
 at org/mozilla/javascript/Context.initStandardObjects
 at org/mozilla/javascript/Context.initStandardObjects
 at RhinoShellApplet.init
 at com/ms/applet/AppletPanel.securedCall0
 at com/ms/applet/AppletPanel.securedCall
 at com/ms/applet/AppletPanel.processSentEvent
 at com/ms/applet/AppletPanel.processSentEvent
 at com/ms/applet/AppletPanel.run
 at java/lang/Thread.run


git-svn-id: svn://10.0.0.236/trunk@95399 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-18 15:31:49 +00:00
rogerl%netscape.com
8396238b82 Fix bug #76054. sr=brendan, r=beard. Generate lower case tags for all the
string tagify'ing helper functions like 'big()' etc. to be XHTML compliant.


git-svn-id: svn://10.0.0.236/trunk@95312 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 21:37:33 +00:00
nboyd%atg.com
3a9576aeab Fix bug 80322.
git-svn-id: svn://10.0.0.236/trunk@95284 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 19:02:55 +00:00
pschwartau%netscape.com
fcec1f2488 Skipping two new tests with large switch statements. See bug 81086.
git-svn-id: svn://10.0.0.236/trunk@95280 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 18:52:43 +00:00
nboyd%atg.com
4e18d1c819 Mail gateway info.
git-svn-id: svn://10.0.0.236/trunk@95273 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 18:36:59 +00:00
jband%netscape.com
cb8d49d560 fix bug 81117. allow unsecure access to creating xpconnect wrappers around nsXPCException objects and expose the 'code' property. This saves us from cryptic errors in the JSConsole and DOMExceptions that don't work. r=mstoltz sr=jst
git-svn-id: svn://10.0.0.236/trunk@95266 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 18:25:06 +00:00
nboyd%atg.com
a123f793fd Just remove commented-out "final".
git-svn-id: svn://10.0.0.236/trunk@95263 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 17:29:19 +00:00
beard%netscape.com
33f6e00f51 bug #77856, r/sr=brendan.
git-svn-id: svn://10.0.0.236/trunk@95225 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 05:45:51 +00:00
beard%netscape.com
c214d9131c bug #77247, r/sr=brendan
git-svn-id: svn://10.0.0.236/trunk@95224 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 05:42:18 +00:00
vidur%netscape.com
46bb7a6e6f Reverting bogus assert. r/sr=brendan,jband
git-svn-id: svn://10.0.0.236/trunk@95209 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 04:55:49 +00:00
brendan%mozilla.org
0c0e5d9a7b Unified resolve recursion damping (70358) and resolve-from-js_SetProperty (72354), r/sr=jband,jst,shaver.
git-svn-id: svn://10.0.0.236/trunk@95183 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 01:43:58 +00:00
brendan%mozilla.org
152f495269 STORE_NUMBER's final param must be a jsdouble; fix INTEGER_OPs (81245, r=rogerl, sr=jband).
git-svn-id: svn://10.0.0.236/trunk@95182 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-17 01:40:32 +00:00
pschwartau%netscape.com
ec59ad1546 Whitespace cleanup.
git-svn-id: svn://10.0.0.236/trunk@95150 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-16 22:45:11 +00:00
brendan%mozilla.org
8425d31606 Fix ChangeTable and how it's called (74883, r=gordon, sr=waterson, mcafee approved).
git-svn-id: svn://10.0.0.236/trunk@95146 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-16 21:41:52 +00:00
pschwartau%netscape.com
bd16fd8f3b Initial add. Regression test for bug 76054 in SpiderMonkey and bug 78706 in Rhino.
git-svn-id: svn://10.0.0.236/trunk@95142 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-16 19:01:42 +00:00
nboyd%atg.com
faa367a725 Fix bug 78706
git-svn-id: svn://10.0.0.236/trunk@95134 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-16 14:07:00 +00:00
Xiaobin.Lu%eng.Sun.com
5f83020d4c r=timeless sr=shaver
bug 72807 "c++ style comment warning"


git-svn-id: svn://10.0.0.236/trunk@95089 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-16 02:24:44 +00:00
beard%netscape.com
f82f497bbb Removed:
ScopeInitializer.java


git-svn-id: svn://10.0.0.236/trunk@95077 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-16 01:10:19 +00:00
nboyd%atg.com
8573d14612 2 additional issues:
1. In that patch I forgot to remove "import org.mozilla.classfile.*" and
simply catch Exception in newInvokerMaster which is not a good practice.
The attached patch FunctionObject_patch fixes that and removes other
unused imports.

2. In org.mozilla.classfile.DefiningClassLoader defineClass method first
tries to call via ClassManager the defineClass method in a class loader
that loaded DefiningClassLoader itself. But this would define new
classes in that class loader so they would not be subject of the garbage
collection until a classloader that loads DefiningClassLoader would go
away even if a DefiningClassLoader instance is gone. The
DefiningClassLoader_patch removes that and simply calls super.defineClass.

The patch also change the order of class search in loadClass so the
loader first looks for a class among its defined classes and only after
that in parent loaders.

Regards, Igor


git-svn-id: svn://10.0.0.236/trunk@95071 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-16 00:24:37 +00:00
pschwartau%netscape.com
580ec950bc Initial add. Regression test for bug 74474.
git-svn-id: svn://10.0.0.236/trunk@95054 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-15 22:01:39 +00:00
pschwartau%netscape.com
dbc8de8609 Renaming this file as regress-74474-001.js
git-svn-id: svn://10.0.0.236/trunk@95053 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-15 22:00:42 +00:00
brendan%mozilla.org
d5037366b0 Add optional JSDHashTableOps.initEntry hook, spruce up comments (74883, r=waterson, sr=shaver).
git-svn-id: svn://10.0.0.236/trunk@95050 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-15 21:07:10 +00:00
sfraser%netscape.com
68e18960dd Testing, NOT PART OF ANYTHING
git-svn-id: svn://10.0.0.236/trunk@95045 18797224-902f-48f8-a5cc-f745e15eee43
2001-05-15 20:57:01 +00:00