Commit Graph

2132 Commits

Author SHA1 Message Date
norris%netscape.com
07735d8e89 Fix build error. 2000-04-20 22:36:46 +00:00
norris%netscape.com
721391dfa7 Subject:
contextClassloader problem in ScriptRuntime.java
   Date:
        Tue, 11 Apr 2000 09:45:36 -0400
   From:
        "Howard Lin" <howard@softcom.com>
     To:
        "Norris Boyd" <norris@netscape.com>
    CC:
        "Andrew Wason" <aw@softcom.com>




Hi, Norris, we are trying to create a Java class in JavaScript. When security manager is on, everything works fine. But when security
manager is off, we got an error saying the "... is not defined". The problem is that in ScriptRuntime.java, when security is on,
getContextClassLoader is null due to SecurityException and Class.forName is used to find the class, which works fine. When security
is off, ContextClassLoaderMethod is invoked to find the class. Since we use a separate thread to load third party jar files,
ContextClassLoaderMethod will throw a ClassNotFound exception.

To illustrate this problem, I wrote a simple applet, evaluating a simple js file in its paint method, which is running on a separate thread.
When security is off, I got the following:

ReferenceError: "Global" is not defined.
        at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:
494)
        at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java, Compile
d Code)
        at org.mozilla.javascript.Interpreter.interpret(Interpreter.java, Compil
ed Code)
        at org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:
67)
        at org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:
54)
        at org.mozilla.javascript.Context.evaluateReader(Context.java:739)
        at test.evaluate(test.java:26)
        at test.paint(test.java:16)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:117)
        at java.awt.Component.dispatchEventImpl(Component.java:2447)
        at java.awt.Container.dispatchEventImpl(Container.java:1035)
        at java.awt.Component.dispatchEvent(Component.java:2307)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:287)
        at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:10
1)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)

When security is on, it runs fine. Or if the code moved to init method, it works fine regardless of security. We are using JDK 1.2.2.

Howard
2000-04-20 19:53:16 +00:00
jband%netscape.com
dc13704f3f Had the wrong clazz for the root! So it was better when the caching was broken. Now it works on MI objects with caching fixed. My bad copy/paste error from long ago. 2000-04-20 12:16:45 +00:00
jband%netscape.com
41e5c7514e backing out little fix from earlier today because it causes crashes in some MI cases. I'll investigate and do the right fix 2000-04-20 11:06:48 +00:00
brendan%mozilla.org
8dc79066e8 Check access and redeclaration legality when defining a getter/setter (36117, r=norris) 2000-04-20 07:10:14 +00:00
beard%netscape.com
40022cf8f5 removed extraneous semi-colons after namespace declarations. 2000-04-20 06:20:31 +00:00
beard%netscape.com
7279428cf8 warnings: commented out unused parameter name. 2000-04-20 06:19:43 +00:00
jband%netscape.com
a0b141afcc fix typo bug that was causing wrapper cache misses on wrapper around objects implementing multiple interfaces when the first wrapper is made for an interface that is not leftmost 2000-04-20 03:38:47 +00:00
norris%netscape.com
b27bb891d9 Add line number information. 2000-04-19 23:24:04 +00:00
rogerl%netscape.com
07efe443fa Removing variables. 2000-04-19 22:45:57 +00:00
rogerl%netscape.com
f07ec29168 Added hasOwnProperty, propertyIsEnumerable, isPrototypeOf to Object. 2000-04-19 22:32:50 +00:00
rogerl%netscape.com
2beda190e7 Began moving away from variables, fixed compare/branch ordering.
Testcases working.
2000-04-19 02:09:06 +00:00
scc%netscape.com
18ebe287b9 making string conversions explicit 2000-04-18 23:53:10 +00:00
rginda%netscape.com
4308ea7ed1 formatting changes. use only one tab regardless of nested namespaces 2000-04-18 21:51:45 +00:00
norris%netscape.com
d23d359cba Add missing method for 1.4R3 compatibility. 2000-04-18 16:53:28 +00:00
norris%netscape.com
564f1dca5b Fix bug where a bean property can conflict with a method name. 2000-04-18 16:52:00 +00:00
norris%netscape.com
3ef540f70d Fix bug:
var a = Math.abs;
  a(-245);

  gets the following error :

  org.mozilla.javascript.EvaluatorException: Method "abs" called on
  incompatible object.
2000-04-18 16:34:36 +00:00
rginda%netscape.com
6d135f273c removed superfluous ;s after namespace decs. 2000-04-18 07:14:49 +00:00
rginda%netscape.com
12509b464c regenerated opcode classes after grncode.pl changes 2000-04-18 07:06:25 +00:00
rginda%netscape.com
ad7e72b179 modified to print R~ if NotARegister 2000-04-18 07:04:24 +00:00
dp%netscape.com
fb1a037854 Implemented component unregister. 2000-04-18 05:26:40 +00:00
mccabe%netscape.com
9908d528c7 added files: mozilla/js/src/xpconnect/src/nsScriptError.cpp 2000-04-18 02:35:06 +00:00
mccabe%netscape.com
369030f2b6 Move nsIConsoleService and implementation into xpcom/base, and nsIScriptError and implementation into js/src/xpconnect. (A place for JavaScript-specific XPCOM would be better, but xpconnect will do). 2000-04-18 02:34:54 +00:00
rogerl%netscape.com
ef88b04ba2 added '(' for RegisterList output 2000-04-18 01:46:32 +00:00
rginda%netscape.com
c156b65e07 regenerated opcodenames to include padding, added label printing back into icg::print 2000-04-18 01:31:24 +00:00
rginda%netscape.com
a74abe59c8 space out opcodenames array 2000-04-18 01:19:12 +00:00
beard%netscape.com
f51bb4d1d9 std::pair 2000-04-18 00:52:07 +00:00
beard%netscape.com
cbc85867b4 moved initConsole() out to :: namespace. 2000-04-18 00:51:53 +00:00
beard%netscape.com
a45402c371 added vmtypes.h,.cpp 2000-04-18 00:50:58 +00:00
rogerl%netscape.com
f14edea523 added vmtypes/jstypes 2000-04-18 00:46:18 +00:00
rogerl%netscape.com
8812cb41bd Fixed WINDOZE build issues 2000-04-18 00:38:26 +00:00
rginda%netscape.com
0d5e50344a initial add of perl script to generate icode classes 2000-04-18 00:22:51 +00:00
rginda%netscape.com
17ec7b0f1a removing bogus file 2000-04-18 00:20:10 +00:00
rginda%netscape.com
501e880dcc adding files for namespace change 2000-04-18 00:19:09 +00:00
rginda%netscape.com
f8d4b9c989 added js::VM, ICG, JSTypes, and Interpreter namespaces; messed around with lots of code.
Created class for each ICode, adding a print() method (using formatters)
2000-04-18 00:17:34 +00:00
beard%netscape.com
8cdd6bce1b FASTLOCK changes. 2000-04-17 23:58:28 +00:00
braddr%puremagic.com
3d8106eb54 Implicit types are evil. Add PRUint32.
r=mccabe
2000-04-16 00:21:07 +00:00
jband%netscape.com
d946b71592 add a test with an 'out' array of strings 2000-04-15 18:44:22 +00:00
mccabe%netscape.com
149b12786e Print error diagnostics to stderr even when non-debug, to support those folks
that want to debug with the -console flag.
2000-04-15 06:59:21 +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
shaver%mozilla.org
94f9b142a7 Replace stupid and evil BYTECODE_ITER hack with proper use of back-patch
chained PatchGotos goodness.  (PatchGotos seasoned to taste.)
r=brendan
2000-04-14 23:27:09 +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
rogerl%netscape.com
d8559be163 Fxied oboscure bug when user defines function Object(), the next new Object
gets a stack crash looking for the prototype. (bug #32174)
2000-04-13 17:58:18 +00:00
beard%netscape.com
2abecb9b3f gc_base now used as common base class of GC allocated objects. 2000-04-13 04:54:41 +00:00
beard%netscape.com
3ee95dbd9c added gc_base, which defines a more generic operator new(). 2000-04-13 04:53:56 +00:00
beard%netscape.com
a011ebff90 builds gc 2000-04-13 00:37:00 +00:00
beard%netscape.com
926ba002f5 Added gc_allocator.h to project and gc.lib to link against. 2000-04-13 00:28:40 +00:00
beard%netscape.com
f1a26f0ae3 linking in gc.lib from ../../gc/boehm 2000-04-13 00:16:58 +00:00
beard%netscape.com
129ddf18e9 enabling GC on all platforms 2000-04-13 00:14:23 +00:00
norris%netscape.com
144d256be4 Fix bug 33841. 2000-04-12 17:30:32 +00:00
norris%netscape.com
1a915ed08b Remove obsolete statement from javadoc. 2000-04-11 18:24:08 +00:00
norris%netscape.com
171751afcb Update javadoc 2000-04-11 18:22:36 +00:00
beard%netscape.com
8aba8b4d32 JSActivation, JSFunction 2000-04-11 05:11:58 +00:00
beard%netscape.com
755c2cebf9 Added JSFunction, defineFunction() 2000-04-11 05:10:40 +00:00
beard%netscape.com
43a8442f14 defineFunction, added assert 2000-04-11 05:09:38 +00:00
beard%netscape.com
a1e930178f _Charalloc, deallocate(void*) for _WIN32 only 2000-04-11 04:55:27 +00:00
beard%netscape.com
38c0d29748 defineGlobalProperty 2000-04-11 03:11:47 +00:00
beard%netscape.com
61caef62db JSObject, JSArray : public JSMap, gc_object<T>. Frame -> JSFrame. Added JSFrameStack which is an std:stack<JSFrame*, std:vector<JSFrame*> >. 2000-04-11 03:11:00 +00:00
beard%netscape.com
7683394fc6 use gc_allocator<T> everywhere, addGlobalProperty -> defineGlobalProperty 2000-04-11 03:07:39 +00:00
beard%netscape.com
bf940ffbab removed commented out GET_PROP/SET_PROP. 2000-04-11 02:59:52 +00:00
beard%netscape.com
4ca0198d48 added gc_object. 2000-04-11 02:59:14 +00:00
beard%netscape.com
bbffbab18d fixing an assert and warnings 2000-04-11 01:10:26 +00:00
rogerl%netscape.com
bb3a13555c CALL opcode & frames etc. (r=beard) 2000-04-11 00:32:17 +00:00
waldemar%netscape.com
4e0864d1c2 Fixed delete/delete[] mismatch 2000-04-10 22:23:17 +00:00
waldemar%netscape.com
58dd2238a6 Fixed memory leak 2000-04-10 22:20:00 +00:00
beard%netscape.com
717ab59840 Fixed warnings about member initializers on Linux. Whatever. 2000-04-08 04:49:41 +00:00
beard%netscape.com
513caa886a Reduced size of args arrays to minimum. 2000-04-08 04:41:19 +00:00
beard%netscape.com
207529a65d Reordered parameters to getProperty()/setProperty() to be consistent with operand ordering. Added array allocation/indexing to testObjects(). 2000-04-08 04:15:02 +00:00
beard%netscape.com
65f51d1dc0 JSArray::elements(1), operator[](const JSValue&), fixed register-indexing. 2000-04-08 04:12:28 +00:00
beard%netscape.com
654a3c2f25 Fixed NEW_ARRAY, GET_ELEMENT, SET_ELEMENT printing., 2000-04-08 04:11:16 +00:00
beard%netscape.com
baed85e41a NEW_ARRAY 2000-04-08 03:37:49 +00:00
beard%netscape.com
3a59608302 Reordered GetProp/SetProp operands to base, name. Added NewArray, GetElement, SetElement instructions. 2000-04-08 03:37:18 +00:00
beard%netscape.com
5834a20d81 added JSArray, GET_ELEMENT, SET_ELEMENT, changed some ops to dest/src. 2000-04-08 03:23:44 +00:00
beard%netscape.com
fffdece17c added JSArray, comments. 2000-04-08 02:44:34 +00:00
beard%netscape.com
eecdd6e6fb Changed boilerplate, chmod -x 2000-04-08 02:29:07 +00:00
beard%netscape.com
bd9723a414 converted NotALabel to an enum, so it obeys proper scoping rules. 2000-04-08 02:25:37 +00:00
rogerl%netscape.com
5071a48e76 added interpreter & icodegenerator 2000-04-08 01:09:50 +00:00
rogerl%netscape.com
3e3b3e45fd Fixed wacky tabs 2000-04-08 01:08:01 +00:00
rogerl%netscape.com
4898874939 Added ICodeModule to collect extra info about executable chunks. 2000-04-08 01:04:55 +00:00
beard%netscape.com
365dd176a7 fixed LoadImmediate. 2000-04-08 00:57:28 +00:00
beard%netscape.com
13179cd572 reindented, introduced gc_map_allocator to hide platform differences 2000-04-08 00:52:59 +00:00
beard%netscape.com
cd69e46bec conforming to MSVC++ allocators 2000-04-08 00:48:13 +00:00
rogerl%netscape.com
adb5b77071 Re-ordered instructions so destination is always first.
Changed labels to be struct * instead of ints.
2000-04-07 22:19:36 +00:00
rogerl%netscape.com
748a0de92d fix invalid return in GC_free for win32 build 2000-04-07 21:58:33 +00:00
rginda%netscape.com
0bc7ecc593 #if out references to std::iterator to get gcc to compile 2000-04-07 21:11:40 +00:00
beard%netscape.com
545dc2fc59 printing code in testObjects(). 2000-04-07 04:59:57 +00:00
beard%netscape.com
8a93b77fcd added code to print SAVE_NAME, NEW_OBJECT, GET_PROP, and SET_PROP iCodes. 2000-04-07 04:58:58 +00:00
beard%netscape.com
0679b2e1cf JSObject and its elements now allocated using gc_allocator<T> (XP_MAC only). 2000-04-07 04:39:50 +00:00
beard%netscape.com
abdc92ce96 JSValues now using gc_allocator (XP_MAC only for now). 2000-04-07 04:38:18 +00:00
beard%netscape.com
1ec7e291c8 added gc library. 2000-04-07 04:36:38 +00:00
beard%netscape.com
eb84a5964f prebuilt gc library for bootstrapping. 2000-04-07 04:35:14 +00:00
beard%netscape.com
34e5ea1801 added stub implementations of GC entry points. 2000-04-07 04:00:21 +00:00
beard%netscape.com
28357888da added failed gc_rebind, for future compilers to ponder. 2000-04-07 03:11:38 +00:00
beard%netscape.com
dee4064778 duh, can't use wide string constants on Linux 2000-04-07 03:08:20 +00:00
beard%netscape.com
deb19d6e30 XP_MAC: no longer auto close upon exit (so we can see asserts, etc.). Renamed testInterpreter() to testFactorial(). Added testObjects(), which allocates an object, stores it in the global variable "global", assigns 0.0 to "global.counter", and finally defines a function "increment" which adds 1.0 to "global.counter" each time it is called. 2000-04-07 02:58:01 +00:00
beard%netscape.com
5e0d72e3ce Added preliminary object representation class JSObject, which is simply an STL map<String, JSValue> for now. Changed static globals to be a JSObject (can you say scope chain?). Implemented NEW_OBJECT, GET_PROP, and SET_PROP, all in terms of operations provided by JSObject. No GC (yet). 2000-04-07 02:52:07 +00:00
beard%netscape.com
82ea502a7c added forward declaration to class JSObject, and changed void* JSValue.ref to JSObject* JSValue.obj. 2000-04-07 02:47:53 +00:00
beard%netscape.com
1c75ce0fa0 fix calls to template superclass for gcc 2000-04-07 02:45:33 +00:00
beard%netscape.com
ec6420f75b added NEW_OBJECT instruction. unified typedef GetProp, SetProp. changed typedef Return to class Return, added class NewObject. These classes automatically pass their opcode to their base-class, and look better in the debugger. Added a virtual destructor to Instruction() #ifdef DEBUG. Added newObject(), saveName() and setProperty() methods to ICodeGenerator. 2000-04-07 02:41:21 +00:00
beard%netscape.com
b40caf2ec9 added newObject(), saveName() and setProperty(). 2000-04-07 02:41:08 +00:00
waldemar%netscape.com
5e1e49d9bb Worked around Visual C++ bugs 2000-04-07 00:47:39 +00:00
beard%netscape.com
cd193318c5 needed to qualify isFieldKind 2000-04-07 00:24:42 +00:00
beard%netscape.com
cddbf0e5ec adding int to printCharBufferSize 2000-04-07 00:23:33 +00:00
waldemar%netscape.com
c039ba6036 Fixed Mac MPW build 2000-04-07 00:06:05 +00:00
rginda%netscape.com
fc42f77598 fix to include java version info on rhino(i|ms|msi) engines 2000-04-07 00:05:50 +00:00
waldemar%netscape.com
7c8bcb9a14 Made Mac MPW js2 tool work 2000-04-07 00:05:23 +00:00
waldemar%netscape.com
e92d0084eb Added Buffer, BitSet, and implemented Formatters for output 2000-04-06 23:48:05 +00:00
waldemar%netscape.com
6e1ee07def Implemented Formatters for output 2000-04-06 23:47:33 +00:00
waldemar%netscape.com
8cc02a37b8 Implemented Formatters for output and added parseMember 2000-04-06 23:45:58 +00:00
waldemar%netscape.com
cd3fd34095 Fixed syntax errors 2000-04-06 23:43:08 +00:00
waldemar%netscape.com
52080f6c74 Commented out syntax error 2000-04-06 23:40:47 +00:00
rogerl%netscape.com
7741726bd9 Changed compare/branch handling to determine last compare opcode.
Made returnStatement a member in ICG.
2000-04-06 22:40:17 +00:00
rginda%netscape.com
7532a2af4c punctuation fix 2000-04-06 21:50:03 +00:00
rginda%netscape.com
9599baeb52 -- NOT PART OF THE DEFAULT BUILD --
Added -c (stackchunksize) option to the js shell, for testing purposes
r=pschwartau
2000-04-06 21:19:56 +00:00
rginda%netscape.com
fc2af836d3 added -o/--opt options to pass args to js engine 2000-04-06 21:14:23 +00:00
rginda%netscape.com
331f034b21 remove +x mode.
Not part of the default build.
2000-04-06 20:27:22 +00:00
beard%netscape.com
774881879c Added interpreter.o to build of js2. 2000-04-06 03:05:12 +00:00
beard%netscape.com
580c9ba5d4 cases for SUBTRACT, MULTIPLY, DIVIDE in print(). 2000-04-06 03:02:24 +00:00
beard%netscape.com
e6900034ca added testInterpreter(), which computes factorial using iCode (woo hoo!) 2000-04-06 02:59:16 +00:00
beard%netscape.com
fb68200586 more arithmetic, conditional branches, return instruction. 2000-04-06 02:58:22 +00:00
beard%netscape.com
c94d749d3f added new instructions, SUBTRACT, MULTIPLY, DIVICE, BRANCH_*, and RETURN. Changed LoadVar/SaveVar to have uint32 operand. Added optional paramter branchOp to ICodeGenerator::branchConditional() & endWhileExpression() to parametrize branch kind. Added complete(Register) to generate a RETURN instruction. 2000-04-06 02:57:42 +00:00
beard%netscape.com
22f7ad270e added a ref field, changed default constructor to initialize f64. 2000-04-06 02:52:51 +00:00
rogerl%netscape.com
a43377758b Resolved branch targets 2000-04-06 00:04:11 +00:00
beard%netscape.com
bb3c0f54a0 removed usage of labels (duh) 2000-04-05 23:57:51 +00:00
rogerl%netscape.com
0e8b29460c typedef'd instructions 2000-04-05 23:41:58 +00:00
beard%netscape.com
f1fef2ea55 Added default case to avoid warning 2000-04-05 21:26:01 +00:00
beard%netscape.com
f8999eeb8f added "globals", labels parameter for branches, combined some Instruction_N<> typedefs. 2000-04-05 20:33:41 +00:00
beard%netscape.com
3e4629d808 added labels parameter. 2000-04-05 20:29:09 +00:00
beard%netscape.com
fab870daa5 added Instruction::opcode(), and Instruction_N::oN(), and ICodeGenerator::getLabels(). 2000-04-05 20:28:17 +00:00
beard%netscape.com
1e6377ccaa moved declaration of lgBasicAlignment & basicAlignment inside the include guard. 2000-04-05 20:26:49 +00:00
rogerl%netscape.com
7925e76257 added missing semi in win32 case 2000-04-05 18:20:02 +00:00
beard%netscape.com
6e3b668298 added interpreter.cpp/.h 2000-04-05 18:06:04 +00:00
brendan%mozilla.org
889c987de0 Fix 22048 and 33391 (see bugs for details; r=jband@netscape.com). 2000-04-05 06:39:11 +00:00
beard%netscape.com
d9f7558a70 linux fixes 2000-04-05 06:10:53 +00:00
beard%netscape.com
8283b89064 first crack at an icode interpreter 2000-04-05 06:05:57 +00:00
beard%netscape.com
0b18dd168a turned off '\n' -> '\r' mapping 2000-04-05 04:25:51 +00:00
beard%netscape.com
a8127fa669 backed out "fix" (thanks waldemar) 2000-04-05 04:24:19 +00:00
beard%netscape.com
1da98657a9 removed newline mapping code (instead using compiler mapping of '\n' to '\r' in literals, which should do the right thing). 2000-04-05 03:57:57 +00:00
beard%netscape.com
a1c47ffba5 added JS2MPW target (non-debug), converted MPW targets to do newline mapping (rather than using explicit override functions). 2000-04-05 03:56:34 +00:00
beard%netscape.com
561078ba6b removed DEBUG 2000-04-05 03:54:46 +00:00
beard%netscape.com
7b9a3a6d76 debug prefix for MPW tool. 2000-04-05 03:54:30 +00:00
dveditz%netscape.com
a5cef05670 Use threadsafe ISupports for service 2000-04-05 03:31:57 +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
beard%netscape.com
75fe46e792 now using gc_container<T>. 2000-04-05 02:05:12 +00:00
beard%netscape.com
200888085c convenience container types that use the GC_allocator. 2000-04-05 02:03:03 +00:00
beard%netscape.com
39293204c1 added a comment. 2000-04-05 01:55:14 +00:00
beard%netscape.com
cf49d1a5d6 making icode generation test not mutually exclusive with the REPL. 2000-04-05 00:52:47 +00:00
beard%netscape.com
dde290c866 changed to use locally built gc.o library. 2000-04-05 00:50:59 +00:00
beard%netscape.com
2dec354876 gc configuration file. 2000-04-05 00:50:32 +00:00
beard%netscape.com
a5aa982d30 local project to build the gc itself. 2000-04-05 00:50:01 +00:00