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

43161 Коммитов

Автор SHA1 Сообщение Дата
kipp%netscape.com b8fa545444 r=dp; tidy up exit logic to release more global junk (space team work) 1999-10-04 23:41:53 +00:00
kipp%netscape.com 2d86782610 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 9b78e0fd9d r=dp; implement some macros to help track memory leaks 1999-10-04 23:36:18 +00:00
kipp%netscape.com a5969c2c3f r=brendan; applied changes recommended by brendan 1999-10-04 23:35:51 +00:00
peterl%netscape.com 69c028cae8 fixed leak of undisplayed content map nodes (which leak style contexts)
r=kipp
1999-10-04 23:33:23 +00:00
valeski%netscape.com 12bba9e092 NOT part of the build. 1999-10-04 23:13:11 +00:00
valeski%netscape.com 7ffe53f79f NOT part of the build. 1999-10-04 23:12:02 +00:00
norris%netscape.com 4c4cc4d82a Fix up makefiles; previous patch was mis-applied. 1999-10-04 21:31:21 +00:00
morse%netscape.com da525ed2ee oops -- I carelessly left out a carriage return in my last checkin 1999-10-04 21:07:01 +00:00
morse%netscape.com bca9fba5b6 fix profile-manager bustage in todays build, checked in by request of leaf 1999-10-04 20:59:16 +00:00
kipp%netscape.com da92fd1a0c Fixed uninitialized members in the TreeNode struct 1999-10-04 20:25:53 +00:00
norris%netscape.com b1ecbb62ba 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 14751442af make file searches case insentive 1999-10-04 18:11:27 +00:00
tao%netscape.com a1e78e2205 First checkin of da-DK files (from Henrik) into l10n/lang. 1999-10-04 18:01:19 +00:00
valeski%netscape.com 3c9e0c4585 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 9a999cfdbe Added -R flag and logic for managing refcnt dumping better 1999-10-04 16:32:03 +00:00
neeti%netscape.com bbe0ad61fd cookie module conversion done 1999-10-04 14:34:54 +00:00
neeti%netscape.com a150a17c4e *** empty log message *** 1999-10-04 14:08:52 +00:00
rods%netscape.com d79137420a 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 a3b54e240a Don't link against xptinfo - its not needed. r=ramiro 1999-10-04 10:44:49 +00:00
colin%theblakes.com 089ffad035 Make mkdepend lines shorter (OpenVMS only). r=ramiro 1999-10-04 10:43:28 +00:00
duncan%be.com 62996c9b41 Hack into compileable shape. 1999-10-04 08:52:17 +00:00
karnaze%netscape.com 249f8499bb 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 91c4f34276 Fix for xlib build bustage. 1999-10-04 04:49:45 +00:00
karnaze%netscape.com 5dce94ef3e regression test changes 1999-10-04 04:48:13 +00:00
dp%netscape.com a8d8120128 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 34224169dd 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 1069c88868 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 d8006bc36f Bug #11837 --> rewrite the imap factory to use nsIModule.
r=bienvenu
1999-10-04 00:27:42 +00:00
mscott%netscape.com 6284835ee3 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 667277fd3a 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 559e0bfd72 First Checked In. 1999-10-03 23:28:33 +00:00
beard%netscape.com c748d9a8f9 File Removed. 1999-10-03 23:26:57 +00:00
beard%netscape.com 1daeb41128 breakage fixing, gc_stdout -> GC_stdout 1999-10-03 22:30:35 +00:00
sdagley%netscape.com 757d725215 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 0fb02f6631 using __NSTerminate() rather than __terminate, for GC leak detector. r=beard 1999-10-03 22:04:07 +00:00
beard%netscape.com a44d3ce6b9 removed pulling of mozilla/gc/boehm, no longer building NStdLibGC target. r=smfr 1999-10-03 21:51:39 +00:00
beard%netscape.com 3245e47e03 Added GC exports, so Stubs target will generate them. 1999-10-03 21:49:41 +00:00
beard%netscape.com 5bf92311aa 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 e69e4ae6db added more GC stub functions, so that NSStdLib can export them. r=smfr 1999-10-03 21:47:11 +00:00
beard%netscape.com 81c6993750 fixed breakage, until mozilla/gc/boehm gets added to the default module. 1999-10-03 21:31:43 +00:00
beard%netscape.com b83f70fb4d calling __NSInitialize/__NSTerminate to enable GC leak detector. r=smfr 1999-10-03 20:53:11 +00:00
beard%netscape.com 208d328010 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 9eae33066d 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 e684f9a224 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 01f6019676 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 0a7a3c72b6 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 fd169cb193 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 b86fa86c81 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 3a35f6481c 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