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

43320 Коммитов

Автор SHA1 Сообщение Дата
kipp%netscape.com 9188a67914 r=dp,vidur,beard; close up some memory leaks related to shutdown of the viewer 1999-10-04 23:41:25 +00:00
kipp%netscape.com 596f2c8f8b r=dp; implement some macros to help track memory leaks 1999-10-04 23:36:18 +00:00
kipp%netscape.com c90dade264 r=brendan; applied changes recommended by brendan 1999-10-04 23:35:51 +00:00
peterl%netscape.com 2359b25588 fixed leak of undisplayed content map nodes (which leak style contexts)
r=kipp
1999-10-04 23:33:23 +00:00
valeski%netscape.com 619b4e2843 NOT part of the build. 1999-10-04 23:13:11 +00:00
valeski%netscape.com 4f374676cc NOT part of the build. 1999-10-04 23:12:02 +00:00
norris%netscape.com 312ce3abcc Fix up makefiles; previous patch was mis-applied. 1999-10-04 21:31:21 +00:00
morse%netscape.com 1ca3e95ba7 oops -- I carelessly left out a carriage return in my last checkin 1999-10-04 21:07:01 +00:00
morse%netscape.com c4f107c715 fix profile-manager bustage in todays build, checked in by request of leaf 1999-10-04 20:59:16 +00:00
kipp%netscape.com ceb59da99b Fixed uninitialized members in the TreeNode struct 1999-10-04 20:25:53 +00:00
norris%netscape.com 6c5683afd4 Fix bug found by Andrew Wason (see below).
Problem was that one transformation of a node to GETVAR wasn't protected by a check of inWithStatement().

======================================
Subject:
        multiple scopes
   Date:
        Fri, 01 Oct 1999 12:39:14 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        Howard Lin <howard@softcom.com>




When I create two scopes, and one scope evaulates a string in the other
scope, it works.  However, if I do this while handling an exception thrown
within a JavaAdapter method, it fails with an exception.

Run the attached Java program with the two script files.  scope1.js
evaluates a string "printMessage" in the scope of scope2.js.  This returns
a function object which is then invoked.  This works in 3 cases, but fails
in the 4th (in the catch in the JavaAdapter).  Even in the 4th case where
it fails, printing the function object looks normal.

Am I doing something wrong, or is there a bug here?

java CrossScope scope1.js scope2.js

Outside of JavaAdapter
works before exception
works after exception
Inside of JavaAdapter
works before exception
Caught exception
pma=
function printMessage(msg) {
     java.lang.System.out.println(msg);
}

Exception in thread "main" org.mozilla.javascript.JavaScriptException:
org.mozilla.javascript.EvaluatorException: The undefined value has no
properties.
         at
org.mozilla.javascript.JavaScriptException.wrapException(JavaScriptException
.java:61)
         at
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java,
Compiled Code)
         at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1256)
         at org.mozilla.javascript.Interpreter.interpret(Interpreter.java,
Compiled Code)
         at
org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:49)
         at
org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:37)
         at org.mozilla.javascript.Context.evaluateReader(Context.java:697)
         at CrossScope.<init>(CrossScope.java:30)
         at CrossScope.main(CrossScope.java:10)


Thanks,
Andrew

import java.io.*;
import org.mozilla.javascript.*;

public class CrossScope {
	private Context m_jsContext;
	private Scriptable m_scope1;
	private Scriptable m_scope2;

	public static void main(String args[]) throws Exception {
		new CrossScope(args[0], args[1]);
	}

	private CrossScope(String strFile1, String strFile2) throws Exception {
		// Associate Context with main thread
		m_jsContext = Context.enter();
                m_jsContext.setOptimizationLevel(-1);

		// Init scope1, expose Scope object
  		m_scope1 = m_jsContext.initStandardObjects(new ImporterTopLevel());
		m_scope1.put("Scope", m_scope1, this);

		// Init scope2
		m_scope2 = m_jsContext.initStandardObjects(new ImporterTopLevel());

		// Run script in scope2
		Reader r2 = new FileReader(strFile2);
		m_jsContext.evaluateReader(m_scope2, r2, strFile2, 1, null);

		// Eval input JS in scope1 - it can in turn eval JS over in scope2
		Reader r1 = new FileReader(strFile1);
		Object obj = m_jsContext.evaluateReader(m_scope1, r1, strFile1, 1, null);
		if (obj instanceof Throwable)
			((Throwable)obj).printStackTrace();

		m_jsContext.exit();
	}

	public Object scope1Eval(String str) throws JavaScriptException {
			Context cx = Context.enter(m_jsContext);
			Object objResult = cx.evaluateString(m_scope1, str, "scope1EvalString", 1, null);
			cx.exit();
			return objResult;
	}

	public Object scope2Eval(String str) throws JavaScriptException {
			Context cx = Context.enter(m_jsContext);
			Object objResult = cx.evaluateString(m_scope2, str, "scope2EvalString", 1, null);
			cx.exit();
			return objResult;
	}
}


// Scope1

importPackage(java.lang);

System.out.println("Outside of JavaAdapter");

try {
	var pm = Scope.scope2Eval("printMessage");
	pm("works before exception");
	System.arraycopy(null, 5, null, 5, 100);
} catch (e) {
	var pma = Scope.scope2Eval("printMessage");
	pma("works after exception");
}

var obj = new Runnable() {
	run: function() {
		System.out.println("Inside of JavaAdapter");
		try {
			var pm = Scope.scope2Eval("printMessage");
			pm("works before exception");
			System.arraycopy(null, 5, null, 5, 100);
		} catch (e) {
			System.out.println("Caught exception");
			var pma = Scope.scope2Eval("printMessage");
			System.out.println("pma=" + pma);
			pma("works after exception");
		}
	}
};

obj.run();



// Scope2

function printMessage(msg) {
	java.lang.System.out.println(msg);
}
1999-10-04 18:27:30 +00:00
endico%mozilla.org a553e33723 make file searches case insentive 1999-10-04 18:11:27 +00:00
tao%netscape.com ef868e18ad First checkin of da-DK files (from Henrik) into l10n/lang. 1999-10-04 18:01:19 +00:00
valeski%netscape.com f14fd6ae87 adding keyword protocol handler to tree. this code is NOT in the build yet. 1999-10-04 16:34:45 +00:00
kipp%netscape.com e580602d8c Added -R flag and logic for managing refcnt dumping better 1999-10-04 16:32:03 +00:00
neeti%netscape.com 43f4c335d4 cookie module conversion done 1999-10-04 14:34:54 +00:00
neeti%netscape.com 32f3c83b10 *** empty log message *** 1999-10-04 14:08:52 +00:00
rods%netscape.com 5e72f97bb8 fixes bug #15265, changes reviewed by kmcclusk. Changes in the way it used the computed values 1999-10-04 13:49:00 +00:00
colin%theblakes.com af2317e98b Don't link against xptinfo - its not needed. r=ramiro 1999-10-04 10:44:49 +00:00
colin%theblakes.com 8bb365320a Make mkdepend lines shorter (OpenVMS only). r=ramiro 1999-10-04 10:43:28 +00:00
duncan%be.com 55eb29fcd7 Hack into compileable shape. 1999-10-04 08:52:17 +00:00
karnaze%netscape.com 309344c93c column allocation does fixed and adjusted fixed (colspans) in separate steps. Simplified AllocateConstrained. Fixed bug 14332. 1999-10-04 05:19:32 +00:00
ramiro%netscape.com c6973263b7 Fix for xlib build bustage. 1999-10-04 04:49:45 +00:00
karnaze%netscape.com 3e8a5ce4bb regression test changes 1999-10-04 04:48:13 +00:00
dp%netscape.com 47410542d5 bug# 15433 Fixed call to NS_ADDREF() that would cause double
evaluation when MOZ_REFCNT is defined. Fixed checking for
OUT_OF_MEMORY condition. r=hyatt
1999-10-04 02:27:09 +00:00
mscott%netscape.com 24e5b5c726 Bug #14680...migrating this bug from the M10 branch. make input and output stream for the converter pipe non-blocking.
r=ducarroz
1999-10-04 01:01:48 +00:00
mscott%netscape.com 8c733e1580 Bug #11837 --> rewrite the imap factory to use nsIModule. This meant adding appropriate factory methods to the components.
r=bienvenu
1999-10-04 00:29:18 +00:00
mscott%netscape.com 4fc2bee2dc Bug #11837 --> rewrite the imap factory to use nsIModule.
r=bienvenu
1999-10-04 00:27:42 +00:00
mscott%netscape.com af94d3daf3 Bug #15192 --> build the pab before the history ab for name completion.
r=bienvenu.
1999-10-04 00:26:10 +00:00
mscott%netscape.com ec4ccbfbd5 Bug #000...trivial fix so no bug # filed. Fix a leak of nsIURI by using nsCOMPtr.
r=bienvenu.
1999-10-04 00:25:12 +00:00
beard%netscape.com bc890cf5bd First Checked In. 1999-10-03 23:28:33 +00:00
beard%netscape.com c45995f807 File Removed. 1999-10-03 23:26:57 +00:00
beard%netscape.com 103fa49fd7 breakage fixing, gc_stdout -> GC_stdout 1999-10-03 22:30:35 +00:00
sdagley%netscape.com 947ca2e4a6 changed from directly using "MSL ShLibRuntime.Lib" to using "NSLibraryStartup.o" to enable GC leak detector. r=beard 1999-10-03 22:04:08 +00:00
sdagley%netscape.com 8bd89c8b50 using __NSTerminate() rather than __terminate, for GC leak detector. r=beard 1999-10-03 22:04:07 +00:00
beard%netscape.com 2cdd7248cf removed pulling of mozilla/gc/boehm, no longer building NStdLibGC target. r=smfr 1999-10-03 21:51:39 +00:00
beard%netscape.com 1cf6f6d112 Added GC exports, so Stubs target will generate them. 1999-10-03 21:49:41 +00:00
beard%netscape.com eb6623b344 removed NSStdLibGC target, and .exp file. Moved exports to the one true NSStdLib.exp, so that Stubs target will see them. r=smfr 1999-10-03 21:48:57 +00:00
beard%netscape.com 879a457913 added more GC stub functions, so that NSStdLib can export them. r=smfr 1999-10-03 21:47:11 +00:00
beard%netscape.com 0444d71f36 fixed breakage, until mozilla/gc/boehm gets added to the default module. 1999-10-03 21:31:43 +00:00
beard%netscape.com 4d1ac7a47a calling __NSInitialize/__NSTerminate to enable GC leak detector. r=smfr 1999-10-03 20:53:11 +00:00
beard%netscape.com 26ba00f59b changed from directly using "MSL ShLibRuntime.Lib" to using "NSLibraryStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:47:12 +00:00
beard%netscape.com b547c2ffb0 changed from directly using "MSL DropInRuntime.Lib" to using "NSComponentStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:46:23 +00:00
beard%netscape.com 19bd4fc7d4 changed from directly using "MSL AppRuntime.Lib" to using "NSAppStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:43:01 +00:00
beard%netscape.com cc6a945ce4 changed from directly using "MSL ShLibRuntime.Lib" to using "NSLibraryStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:37:53 +00:00
beard%netscape.com 120647c4c2 changed from directly using "MSL ShLibRuntime.Lib" to using "NSLibraryStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:23:01 +00:00
beard%netscape.com f4db9ed86e changed from directly using "MSL DropInRuntime.Lib" to using "NSLibraryStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:13:50 +00:00
beard%netscape.com 4dbd674daa changed from directly using "MSL AppRuntime.Lib" to using "NSAppStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:11:44 +00:00
beard%netscape.com 5cb00c8518 changed from directly using "MSL ShLibRuntime.Lib" to using "NSLibraryStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:08:40 +00:00
beard%netscape.com e5e3abf3e5 added pulling of mozilla/gc/boehm, conditionally building gc.mcp if $GC_LEAK_DETECTOR is true, and building MemAllocator.mcp[MemAllocatorGC.o], NSStdLib.mcp[NSStdLibGC.shlb] if $GC_LEAK_DETECTOR is true. r=smfr 1999-10-03 20:06:10 +00:00