зеркало из https://github.com/mozilla/pjs.git
Cosmetics: removal of junk white-space at line end
This commit is contained in:
Родитель
4bd37c2da0
Коммит
2fbe052b90
|
@ -18,7 +18,7 @@
|
|||
* Copyright (C) 1997-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
|
@ -38,7 +38,7 @@ import org.mozilla.javascript.*;
|
|||
* Example of controlling the JavaScript execution engine.
|
||||
*
|
||||
* We evaluate a script and then manipulate the result.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class Control {
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class Control {
|
|||
System.out.println(fn.call(cx, scope, obj, new Object[0]));
|
||||
} catch (JavaScriptException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
cx.exit();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Norris Boyd
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
|
@ -39,17 +39,17 @@ public class Counter extends ScriptableObject {
|
|||
// The zero-argument constructor used by Rhino runtime to create instances
|
||||
public Counter() { }
|
||||
|
||||
// Method jsConstructor defines the JavaScript constructor
|
||||
// Method jsConstructor defines the JavaScript constructor
|
||||
public void jsConstructor(int a) { count = a; }
|
||||
|
||||
// The class name is defined by the getClassName method
|
||||
public String getClassName() { return "Counter"; }
|
||||
|
||||
// The method jsGet_count defines the count property.
|
||||
// The method jsGet_count defines the count property.
|
||||
public int jsGet_count() { return count++; }
|
||||
|
||||
// Methods can be defined using the jsFunction_ prefix. Here we define
|
||||
// resetCount for JavaScript.
|
||||
// Methods can be defined using the jsFunction_ prefix. Here we define
|
||||
// resetCount for JavaScript.
|
||||
public void jsFunction_resetCount() { count = 0; }
|
||||
|
||||
private int count;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Copyright (C) 1997-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Norris Boyd
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
|
@ -44,9 +44,9 @@ public class DynamicScopes {
|
|||
* Main entry point.
|
||||
*
|
||||
* Set up the shared scope and then spawn new threads that execute
|
||||
* relative to that shared scope. Try compiling functions with and
|
||||
* relative to that shared scope. Try compiling functions with and
|
||||
* without dynamic scope to see the effect.
|
||||
*
|
||||
*
|
||||
* The expected output is
|
||||
* <pre>
|
||||
* sharedScope
|
||||
|
@ -59,7 +59,7 @@ public class DynamicScopes {
|
|||
* The final three lines may be permuted in any order depending on
|
||||
* thread scheduling.
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args)
|
||||
throws JavaScriptException
|
||||
{
|
||||
Context cx = Context.enter();
|
||||
|
@ -72,8 +72,8 @@ public class DynamicScopes {
|
|||
cx.exit();
|
||||
}
|
||||
}
|
||||
|
||||
static void runScripts(Context cx)
|
||||
|
||||
static void runScripts(Context cx)
|
||||
throws JavaScriptException
|
||||
{
|
||||
// Initialize the standard objects (Object, Function, etc.)
|
||||
|
@ -87,7 +87,7 @@ public class DynamicScopes {
|
|||
"function f() { return x; }";
|
||||
cx.evaluateString(scope, source, "MySource", 1, null);
|
||||
|
||||
// Now we spawn some threads that execute a script that calls the
|
||||
// Now we spawn some threads that execute a script that calls the
|
||||
// function 'f'. The scope chain looks like this:
|
||||
// <pre>
|
||||
// ------------------
|
||||
|
@ -105,7 +105,7 @@ public class DynamicScopes {
|
|||
// ------------------
|
||||
// </pre>
|
||||
// Both the shared scope and the per-thread scope have variables 'x'
|
||||
// defined in them. If 'f' is compiled with dynamic scope enabled,
|
||||
// defined in them. If 'f' is compiled with dynamic scope enabled,
|
||||
// the 'x' from the per-thread scope will be used. Otherwise, the 'x'
|
||||
// from the shared scope will be used. The 'x' defined in 'g' (which
|
||||
// calls 'f') should not be seen by 'f'.
|
||||
|
@ -114,12 +114,12 @@ public class DynamicScopes {
|
|||
for (int i=0; i < threadCount; i++) {
|
||||
String script = "function g() { var x = 'local'; return f(); }" +
|
||||
"java.lang.System.out.println(g());";
|
||||
t[i] = new Thread(new PerThread(scope, script,
|
||||
t[i] = new Thread(new PerThread(scope, script,
|
||||
"thread" + i));
|
||||
}
|
||||
for (int i=0; i < threadCount; i++)
|
||||
t[i].start();
|
||||
// Don't return in this thread until all the spawned threads have
|
||||
// Don't return in this thread until all the spawned threads have
|
||||
// completed.
|
||||
for (int i=0; i < threadCount; i++) {
|
||||
try {
|
||||
|
@ -128,15 +128,15 @@ public class DynamicScopes {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class PerThread implements Runnable {
|
||||
|
||||
|
||||
PerThread(Scriptable scope, String script, String x) {
|
||||
this.scope = scope;
|
||||
this.script = script;
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void run() {
|
||||
// We need a new Context for this thread.
|
||||
Context cx = Context.enter();
|
||||
|
@ -144,13 +144,13 @@ public class DynamicScopes {
|
|||
// We can share the scope.
|
||||
Scriptable threadScope = cx.newObject(scope);
|
||||
threadScope.setPrototype(scope);
|
||||
|
||||
// We want "threadScope" to be a new top-level
|
||||
// scope, so set its parent scope to null. This
|
||||
|
||||
// We want "threadScope" to be a new top-level
|
||||
// scope, so set its parent scope to null. This
|
||||
// means that any variables created by assignments
|
||||
// will be properties of "threadScope".
|
||||
threadScope.setParentScope(null);
|
||||
|
||||
|
||||
// Create a JavaScript property of the thread scope named
|
||||
// 'x' and save a value for it.
|
||||
threadScope.put("x", threadScope, x);
|
||||
|
|
|
@ -64,7 +64,7 @@ import java.util.Vector;
|
|||
* be wrapped as JavaScript exceptions when called from JavaScript,
|
||||
* and may be caught within JavaScript.
|
||||
*
|
||||
* @author Norris Boyd
|
||||
* @author Norris Boyd
|
||||
*/
|
||||
public class File extends ScriptableObject {
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class File extends ScriptableObject {
|
|||
* to the use.
|
||||
*/
|
||||
public static Scriptable jsConstructor(Context cx, Object[] args,
|
||||
Function ctorObj,
|
||||
Function ctorObj,
|
||||
boolean inNewExpr)
|
||||
{
|
||||
File result = new File();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Copyright (C) 1997-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Copyright (C) 1997-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
|
@ -259,7 +259,7 @@ public class Matrix implements Scriptable {
|
|||
public boolean hasInstance(Scriptable value) {
|
||||
Scriptable proto = value.getPrototype();
|
||||
while (proto != null) {
|
||||
if (proto.equals(this))
|
||||
if (proto.equals(this))
|
||||
return true;
|
||||
proto = proto.getPrototype();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Copyright (C) 1997-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Norris Boyd
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
|
@ -44,7 +44,7 @@ import org.mozilla.javascript.*;
|
|||
* converted to ECMA strings. Other types have the default behavior.
|
||||
* <p>
|
||||
* Note that calling "new java.lang.String('foo')" in JavaScript with this
|
||||
* wrap factory enabled will still produce a wrapped Java object since the
|
||||
* wrap factory enabled will still produce a wrapped Java object since the
|
||||
* WrapFactory.wrapNewObject method is not overridden.
|
||||
* <p>
|
||||
* The PrimitiveWrapFactory is enabled on a Context by calling setWrapFactory
|
||||
|
@ -52,8 +52,8 @@ import org.mozilla.javascript.*;
|
|||
*/
|
||||
public class PrimitiveWrapFactory extends WrapFactory {
|
||||
|
||||
public Object wrap(Context cx, Scriptable scope, Object obj,
|
||||
Class staticType)
|
||||
public Object wrap(Context cx, Scriptable scope, Object obj,
|
||||
Class staticType)
|
||||
{
|
||||
if (obj instanceof String || obj instanceof Number ||
|
||||
obj instanceof Boolean)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Copyright (C) 1997-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
|
|
|
@ -62,7 +62,7 @@ class DefaultErrorReporter implements ErrorReporter {
|
|||
buf.append(')');
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
public void error(String message, String sourceName, int line,
|
||||
String lineSource, int lineOffset)
|
||||
{
|
||||
|
|
|
@ -103,9 +103,9 @@ public class NativeFunction extends BaseFunction {
|
|||
protected String[] argNames;
|
||||
protected short argCount;
|
||||
protected short version;
|
||||
|
||||
/**
|
||||
* True if this represents function constructed via Function()
|
||||
|
||||
/**
|
||||
* True if this represents function constructed via Function()
|
||||
* constructor
|
||||
*/
|
||||
boolean fromFunctionConstructor;
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface DebuggableObject {
|
|||
/**
|
||||
* Returns an array of ids for the properties of the object.
|
||||
*
|
||||
* <p>All properties, even those with attribute {DontEnum}, are listed.
|
||||
* <p>All properties, even those with attribute {DontEnum}, are listed.
|
||||
* This allows the debugger to display all properties of the object.<p>
|
||||
*
|
||||
* @return an array of java.lang.Objects with an entry for every
|
||||
|
|
|
@ -141,7 +141,7 @@ public class VariableModel extends AbstractTreeTableModel
|
|||
String result;
|
||||
try {
|
||||
if (value instanceof BaseFunction) {
|
||||
result = ((BaseFunction)value).decompile(cx, 0,
|
||||
result = ((BaseFunction)value).decompile(cx, 0,
|
||||
false);
|
||||
} else {
|
||||
result = Context.toString(value);
|
||||
|
|
Загрузка…
Ссылка в новой задаче