2452 Commits

Author SHA1 Message Date
rginda%netscape.com
f05ffa274c removing bogus assert (per rogerl)
git-svn-id: svn://10.0.0.236/trunk@74278 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-15 00:01:25 +00:00
beard%netscape.com
04ddc4f4ec added operator[](const char*) to StringAtomTable.
git-svn-id: svn://10.0.0.236/trunk@74273 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-14 23:10:02 +00:00
rogerl%netscape.com
b8f931c969 Fixed slots for non-function vars, plus bug in slot xcrement.
git-svn-id: svn://10.0.0.236/trunk@74265 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-14 22:23:20 +00:00
brendan%mozilla.org
b5e74c9818 Fix for..in loop bug that reopened 41126 (r=jband@netscape.com).
git-svn-id: svn://10.0.0.236/trunk@74241 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-14 05:37:40 +00:00
brendan%mozilla.org
00f93edbeb Fix 41381 regression from last fix attempt (r=jband).
git-svn-id: svn://10.0.0.236/trunk@74240 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-14 05:35:08 +00:00
jband%netscape.com
8ddf28d7f5 Fix dropProperty crash. This is needed because the JSObjects used by xpconnect wrapped natives need to act both as host objects with non-slot properties and as a plain JSObjects using the default JSOps and all that entails. So, we can't be passing the host-style props to dropProperty though we do still need to do so for other props. This has only been working up to now by luck. r=brendan@mozilla.org a=brendan@mozilla.org
git-svn-id: svn://10.0.0.236/trunk@74239 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-14 05:34:46 +00:00
rogerl%netscape.com
3b8f784bce Backed out time()
git-svn-id: svn://10.0.0.236/trunk@74229 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-14 01:46:14 +00:00
rogerl%netscape.com
d2493254c5 Type targetted binary operators.
Added 'time()' function as native.


git-svn-id: svn://10.0.0.236/trunk@74226 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-14 01:00:53 +00:00
jband%netscape.com
7b95a566f5 add THREADSAFE nsISupports implementation macros to some of the classes which lacked them. bug 45404. a=brendan@mozilla.org
git-svn-id: svn://10.0.0.236/trunk@74193 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 23:04:15 +00:00
brendan%mozilla.org
5ecfd2355f Why didn't the lack of this break Linux, where I tested?
git-svn-id: svn://10.0.0.236/trunk@74160 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 05:56:28 +00:00
syd%netscape.com
3ffc713fbf Add support to JS profiler for collecting min, max, and average execution
times of functions. Doesn't yet handle rentrancy. Create Makefile.in files
so this stuff will build on *nix. r=jband, a=leaf


git-svn-id: svn://10.0.0.236/trunk@74157 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 05:19:22 +00:00
brendan%mozilla.org
854313ee5e Try again for bug 41381, r=wtc@netscape.com
git-svn-id: svn://10.0.0.236/trunk@74155 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 05:08:35 +00:00
brendan%mozilla.org
281682666b Uh oh. Back out last change until I'm sure I'm not an idiot.
git-svn-id: svn://10.0.0.236/trunk@74151 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 04:00:33 +00:00
brendan%mozilla.org
8f313d2720 Fix ancient bugs: compare-and-swap is not threadsafe given A-B-A address replay via malloc/free; release to mark in pool->first empty arena would not free anything, as troy@tellme.com found (41381, r=wtc@netscape.com).
git-svn-id: svn://10.0.0.236/trunk@74150 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 03:49:22 +00:00
beard%netscape.com
c9aa3f4e54 need <stdio.h> for fopen on the Mac.
git-svn-id: svn://10.0.0.236/trunk@74142 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 02:23:55 +00:00
beard%netscape.com
29fcfa000e fixing readEvalFile to save off important Context data members. implemented identical_Default for string
git-svn-id: svn://10.0.0.236/trunk@74140 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 01:35:57 +00:00
beard%netscape.com
fe002abe93 fixing readEvalFile() by creating another Context
git-svn-id: svn://10.0.0.236/trunk@74136 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 00:44:30 +00:00
rogerl%netscape.com
1fc062cb5a Switching to generic binary operator in order to distinguish situation
where Operators package had been loaded and be able to generate typed
versions of the binary operators otherwise.


git-svn-id: svn://10.0.0.236/trunk@74134 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 00:14:54 +00:00
dougt%netscape.com
db2c70c95b bug 40750.
Adding followSymlink flag to nsILocalFile.
Adjusting callers.
windows shortcut optimizations.
r=blizzard@mozilla.org.
a=brendan@mozilla.org


git-svn-id: svn://10.0.0.236/trunk@74127 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-12 23:31:31 +00:00
jdunn%netscape.com
8dd9b14bc1 do not include -lm for HPUX (as well as BeOS)
r= leaf@mozilla.org


git-svn-id: svn://10.0.0.236/trunk@74114 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-12 22:41:17 +00:00
brendan%mozilla.org
d6a267cf1e Fix 'out of order' malloc failure-handling bug found by cgn1234@yahoo.com (41022, r=cgn1234).
git-svn-id: svn://10.0.0.236/trunk@74069 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-12 01:44:12 +00:00
rogerl%netscape.com
0fbe7a0bf0 Implemented Import -only it's not in the parser yet.
Added missing defineXXX functions.


git-svn-id: svn://10.0.0.236/trunk@74053 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-11 23:49:20 +00:00
rginda%netscape.com
f86893a190 cleaned up linux warnings, minor debugger tweaks
git-svn-id: svn://10.0.0.236/trunk@74039 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-11 23:08:03 +00:00
rogerl%netscape.com
6a8822a673 More on @ operator. Fixed R 4billion print bug.
git-svn-id: svn://10.0.0.236/trunk@74024 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-11 20:54:06 +00:00
rogerl%netscape.com
11c82ac5b9 Some parts of x@<name> working.
git-svn-id: svn://10.0.0.236/trunk@73964 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-10 23:18:07 +00:00
jband%netscape.com
473f5b8879 add previously overlooked support for nsIXPCNativeCallContext implementors to signal that they have set the method return value for the JS caller. a=brendan@mozilla.org r=vidur@netscape.com
git-svn-id: svn://10.0.0.236/trunk@73959 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-10 22:39:37 +00:00
rogerl%netscape.com
09961860fe r=brendan@mozilla.org, Fix for #31255, support '-->' on line by itself as
a line comment - allows old, bogus HTML to execute a la 4.X.


git-svn-id: svn://10.0.0.236/trunk@73935 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-10 20:23:54 +00:00
rogerl%netscape.com
babc9d3604 r=brendan@mozilla.org, Fix for #44013 - enforce security for defineGetter
& defineSetter by calling OBJ_CHECK_ACCESS.


git-svn-id: svn://10.0.0.236/trunk@73934 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-10 20:21:38 +00:00
brendan%mozilla.org
c096fdd686 Fix an out-of-date comment.
git-svn-id: svn://10.0.0.236/trunk@73873 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-08 02:35:56 +00:00
brendan%mozilla.org
e59f31abff Make it safe to nest a GC from js_AllocGCThing, ultimately from the interpreter; also make sure we collect all garbage (even garbage created by finalizers who unroot or unlock GC-things) when destroying the last context (39125, 44376, r=mccabe@netscape.com).
git-svn-id: svn://10.0.0.236/trunk@73871 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-08 02:06:01 +00:00
rogerl%netscape.com
07b641917e Support for 'constructor'.
git-svn-id: svn://10.0.0.236/trunk@73865 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-08 01:08:29 +00:00
nboyd%atg.com
6081b3a66b Deprecate FlattenedObject.
git-svn-id: svn://10.0.0.236/trunk@73818 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-07 14:41:35 +00:00
waterson%netscape.com
1cebde4f7e Brendan meant to add jsdhash.h to the Mac build, too.
git-svn-id: svn://10.0.0.236/trunk@73776 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-06 20:55:23 +00:00
waterson%netscape.com
c198a05e61 Brendan meant add jsdhash.c to the Mac build, too.
git-svn-id: svn://10.0.0.236/trunk@73775 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-06 20:54:17 +00:00
rogerl%netscape.com
ceb54a7f92 Removed preprocess step, consolidated identifier handling.
git-svn-id: svn://10.0.0.236/trunk@73767 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-06 18:26:26 +00:00
brendan%mozilla.org
352c59dcb8 Fix lying comment, pick control flow nit (r=lumpy,a=jack).
git-svn-id: svn://10.0.0.236/trunk@73753 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-06 07:38:11 +00:00
brendan%mozilla.org
65b8bdd99e Add jsdhash.h to export/install lists, and jsdhash.c/.obj.
git-svn-id: svn://10.0.0.236/trunk@73747 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-06 04:46:18 +00:00
brendan%mozilla.org
729aa3812c Avoid 80th column violations and unnecessary local variable.
git-svn-id: svn://10.0.0.236/trunk@73722 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-06 01:15:08 +00:00
brendan%mozilla.org
2bec829503 Undo teeny optimization from rev 3.28, alas it breaks ECMA Ed. 3, 15.5.4.15.
git-svn-id: svn://10.0.0.236/trunk@73717 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-06 00:30:46 +00:00
nboyd%atg.com
e100ec45de Remove obsolete references to NodeFactory.
git-svn-id: svn://10.0.0.236/trunk@73674 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-05 17:08:26 +00:00
nboyd%atg.com
a1a769b259 Subject:
Re: Rhino1.5.R1: problems with multithreaded embedded application.
        Date:
             Mon, 03 Jul 2000 14:38:56 -0400
       From:
             Norris Boyd <nboyd@atg.com>
 Organization:
             Art Technology Group
         To:
             Fergus Gallagher <Fergus.Gallagher@orbisuk.com>
 Newsgroups:
             netscape.public.mozilla.jseng
  References:
             1




You found a bug in Rhino; I wonder if others have been running into the same thing.

The problem is with a class called LazilyLoadedCtor. I wrote this class to reduce the
time
required by initStandardObjects by only creating standard objects when the associated
constructors are first accessed. The problem is that this class was not threadsafe.
I've
made changes to that class, and to ScriptableObject as well. The design of dynamic
properties calling getters and setters (which LazilyLoadedCtor uses) didn't really
allow
any way for the getter/setter to replace itself without a thread hazard. I've now
extended
setters so that they can return a value which replaces the getter/setter to avoid this
problem.

Thanks for finding this problem. There have been a couple of other reports of problems
in
this area, so I hope this will fix them.

The patch follows.

--N

Index: LazilyLoadedCtor.java
===================================================================
RCS file: /cvsroot/mozilla/js/rhino/org/mozilla/javascript/LazilyLoadedCtor.java,v
retrieving revision 1.1
diff -u -r1.1 LazilyLoadedCtor.java
--- LazilyLoadedCtor.java 2000/02/29 21:34:37 1.1
+++ LazilyLoadedCtor.java 2000/07/03 18:31:03
@@ -58,9 +58,12 @@
     }

     public Object getProperty(ScriptableObject obj) {
-        obj.delete(ctorName);
         try {
-            ScriptableObject.defineClass(obj, Class.forName(className));
+            synchronized (obj) {
+                if (!isReplaced)
+                    ScriptableObject.defineClass(obj, Class.forName(className));
+                isReplaced = true;
+            }
         }
         catch (ClassNotFoundException e) {
             throw WrappedException.wrapException(e);
@@ -83,11 +86,14 @@
         return obj.get(ctorName, obj);
     }

-    public void setProperty(ScriptableObject obj, Object val) {
-        obj.delete(ctorName);
-        obj.put(ctorName, obj, val);
+    public Object setProperty(ScriptableObject obj, Object val) {
+        synchronized (obj) {
+            isReplaced = true;
+            return val;
+        }
     }

     private String ctorName;
     private String className;
+    private boolean isReplaced;
 }
Index: ScriptableObject.java
===================================================================
RCS file: /cvsroot/mozilla/js/rhino/org/mozilla/javascript/ScriptableObject.java,v
retrieving revision 1.17
diff -u -r1.17 ScriptableObject.java
--- ScriptableObject.java 2000/03/13 17:12:36 1.17
+++ ScriptableObject.java 2000/07/03 18:31:04
@@ -246,11 +246,21 @@
                             break;
                         }
                     }
-                    getterSlot.setter.invoke(start, arg);
+                    Object v = getterSlot.setter.invoke(start, arg);
+                    if (getterSlot.setterReturnsValue) {
+                        slots[slotIndex].value = v;
+                        if (!(v instanceof Method))
+                            slots[slotIndex].flags = 0;
+                    }
                     return;
                 }
                 Object[] args = { this, actualArg };
-                getterSlot.setter.invoke(getterSlot.delegateTo, args);
+                Object v = getterSlot.setter.invoke(getterSlot.delegateTo, args);
+                if (getterSlot.setterReturnsValue) {
+                    slots[slotIndex].value = v;
+                    if (!(v instanceof Method))
+                        slots[slotIndex].flags = 0;
+                }
                 return;
             }
             catch (InvocationTargetException e) {
@@ -1183,6 +1193,7 @@
         slot.delegateTo = delegateTo;
         slot.getter = getter;
         slot.setter = setter;
+        slot.setterReturnsValue = setter != null && setter.getReturnType() !=
Void.TYPE;
         slot.value = null;
         slot.attributes = (short) attributes;
         slot.flags = flags;
@@ -1551,6 +1562,7 @@
     Object delegateTo;  // OPT: merge with "value"
     Method getter;
     Method setter;
+    boolean setterReturnsValue;
 }




Fergus Gallagher wrote:

> I am having problems getting my head around contexts and scopes and my
> multi-threaded application fall over.
>
> If I set "global=false" the following code used a per-thread
> initStandardObject() and this seems to work.  But when I set
> "global=true", the global "parentScope" is used and I get some wierd
> errors.
>
> If I change "__CODE__.slice(0,5)" to
> 1. "__CODE__" - works
> 2. "__CODE__.substring(0,5)" - fails
> 3. "__CODE__.toString()" - works
>
> Any help appreciated.
>
> Fergus
>
> ===== Test.java =========================================
> import java.io.*;
> import org.mozilla.javascript.*;
>
> public class Test implements Runnable {
>         private Script script;
>         private Scriptable parentScope;
>         private String __CODE__="ABCDEFGHIJK";
>         private boolean global = true;
>         private static Context globalContext = null;
>         public Test() throws Exception {
>                 String js= "java.lang.System.out.println(__CODE__.slice(0,5));";
>                 globalContext.setCompileFunctionsWithDynamicScope(false);
>                 parentScope = globalContext.initStandardObjects(null);
>                 StringReader sr = new StringReader(js);
>                 script = globalContext.compileReader(parentScope, sr, "(compiled)",
> 1,null);
>         }
>
>         public void run() {
>                 try {
>                         Context context = Context.enter();
>                         Scriptable threadScope;
>                         if (global) {
>                                 threadScope = context.newObject(parentScope);
>                                 threadScope.setPrototype(parentScope);
>                                 threadScope.setParentScope(null);
>                         } else {
>                                 threadScope = context.initStandardObjects(null);
>                         }
>                         threadScope.put("__CODE__",threadScope,__CODE__);
>                         script.exec(context,threadScope);
>                 }
>                 catch (Exception e) {
>                         System.err.println(e.getClass().getName()+":
"+e.getMessage());
>                 }
>                 finally {
>                         Context.exit();
>                 }
>         }
>
>         public static void main(String args[]) throws Exception {
>         globalContext = Context.enter();
>                 Test me = new Test();
>                 int count=10;
>                 Thread[] threads = new Thread[count];
>                 for (int i=0; i<count; i++) {
>                         Thread t = new Thread(me);
>                         threads[i] = t;
>                         t.start();
>                 }
>                 for (int i=0; i<count; i++) {
>                         threads[i].join();
>                 }
>                 Context.exit();
>         }
> }
>
> ==== OUTPUT ===============================================
> ABCDE
> ABCDE
> org.mozilla.javascript.EcmaError: undefined is not a function.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> org.mozilla.javascript.EvaluatorException: Constructor for "String" not
> found.
> ===========================================================
>
> The number and type of exceptions is highly variable from run to run -
> anywhere from 1-9 out of 10.
> The EcmaError in particular only happens occasionally.
>
> --
> Fergus Gallagher          Tel: +44 (20) 8 987 0717
> Orbis                     Fax: +44 (20) 8 742 2649
> The Swan Centre           email: Fergus.Gallagher@orbisuk.com
> Fishers Lane              Web: http://www.orbisuk.com
> London W4 1RX / UK


git-svn-id: svn://10.0.0.236/trunk@73650 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-03 18:40:35 +00:00
jband%netscape.com
1cf39227e9 updating readme. Not part of build
git-svn-id: svn://10.0.0.236/trunk@73645 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-02 19:37:57 +00:00
cls%seawood.org
91d683a067 Removed obsolete REQUIRES variable from every Makefile.in/makefile.win
git-svn-id: svn://10.0.0.236/trunk@73583 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-30 08:08:04 +00:00
jband%netscape.com
ce4fc31a2d Fix dogfood/crash bugs: 42750, 39858 and fix 43897 and improve JS/XPConnect error reporting to help with crasher 40792. r=mccabe@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@73574 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-30 04:04:46 +00:00
beard%netscape.com
57307567af Fix build bustage.
git-svn-id: svn://10.0.0.236/trunk@73530 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-29 18:40:58 +00:00
rogerl%netscape.com
a02f6ce0d8 use handleDot for call, too.
git-svn-id: svn://10.0.0.236/trunk@73525 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-29 18:30:47 +00:00
beard%netscape.com
ea7ae68414 delete property support.
git-svn-id: svn://10.0.0.236/trunk@73523 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-29 18:14:14 +00:00
beard%netscape.com
8f71e889d8 DELETE_PROP
git-svn-id: svn://10.0.0.236/trunk@73522 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-29 18:13:46 +00:00
beard%netscape.com
1ef1eb154f DELETE_PROP
git-svn-id: svn://10.0.0.236/trunk@73521 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-29 17:14:56 +00:00
beard%netscape.com
aa7664867d added DELETE_PROP instruction to implement the "delete" operation.
git-svn-id: svn://10.0.0.236/trunk@73520 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-29 17:11:50 +00:00