download.lst                                                                   
                   |    4 
 external/rhino/ExternalPackage_rhino.mk                                        
                   |    2 
 external/rhino/ExternalProject_rhino.mk                                        
                   |   36 
 external/rhino/OfficeScriptInfo.java                                           
                   |  118 -
 external/rhino/UnpackedTarball_rhino.mk                                        
                   |   11 
 external/rhino/filelist.txt                                                    
                   |  330 +++
 external/rhino/rhino-classpath.patch.1                                         
                   |   13 
 external/rhino/rhino1_5R5-find_swing.patch                                     
                   |   16 
 external/rhino/rhino1_5R5-updateToolTip.patch                                  
                   |   23 
 external/rhino/rhino1_5R5.patch                                                
                   | 1067 ----------
 scripting/Jar_ScriptProviderForJavaScript.mk                                   
                   |    6 
 
scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java
   |  319 --
 
scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
 |   59 
 scripting/java/com/sun/star/script/framework/provider/javascript/template.js   
                   |   54 
 14 files changed, 363 insertions(+), 1695 deletions(-)

New commits:
commit ca58bbd4964c71792dd75a3fdec92dca71e2f14d
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Fri Mar 22 15:53:49 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Apr 11 07:32:19 2024 +0200

    Update to latest Rhino 1.7.14
    
    ...at the expense of losing, at least for now, the script editor for it 
(which
    had been hacked into the old upstream sources in a hard-to-maintain way).
    
    rhino-1.7.14.zip is taken from
    
<https://github.com/mozilla/rhino/releases/download/Rhino1_7_14_Release/rhino-1.7.14.zip>.
    Building it would now use Gradle, but instead just hack together an 
invocation
    of javac and jar in external/rhino/ExternalProject_rhino.mk that effectively
    generates the same jar as the upstream-built jar available at
    
<https://github.com/mozilla/rhino/releases/download/Rhino1_7_14_Release/rhino-1.7.14.jar>.
    
    All the various patches are no longer necessary:
    * external/rhino/rhino1_5R5.patch and external/rhino/OfficeScriptInfo.java 
were
      mostly for the hacked-in script editor, which has been abandoned at least 
for
      now (see above).
    * external/rhino/rhino1_5R5-find_swing.patch (originally from
      0a7f9346503a557f583bced269655fa1996550af "ause109: #i106296# make 
build.xml
      aware of TARFILE_LOCATION") appears to be obsolete.
    * external/rhino/rhino1_5R5-updateToolTip.patch is covered by
      
<https://github.com/mozilla/rhino/commit/ab20a73b16f68daf715c7ac4808c119bb15d698c>
      "Fix bug 414869: Rhino debugger fails to launch due to updates in mac os x
      leopard".
    * external/rhino/rhino-classpath.patch.1 from
      bb58293296f843654045d7b0eba6899d11533a4a "rhino: unbreak build on Fedora 
34"
      was only relevant when building with Ant.
    
    Change-Id: I5fca5915d785716f7aaf313ff2469a20f55f707a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165416
    Tested-by: allotropia jenkins <jenk...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/download.lst b/download.lst
index 21c6aa046ffb..b2af90eb35bc 100644
--- a/download.lst
+++ b/download.lst
@@ -501,8 +501,8 @@ REVENGE_TARBALL := 
librevenge-0.0.$(REVENGE_VERSION_MICRO).tar.bz2
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-RHINO_SHA256SUM := 
1fb458d6aab06932693cc8a9b6e4e70944ee1ff052fa63606e3131df34e21753
-RHINO_TARBALL := 798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip
+RHINO_SHA256SUM := 
bf4d2d0c5ff8889fd494486db09291cb7965f0bf2f93ef005d3b08070a5a4f5c
+RHINO_TARBALL := rhino-1.7.14.zip
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/rhino/ExternalPackage_rhino.mk 
b/external/rhino/ExternalPackage_rhino.mk
index 0ee1d60e309d..faac15c6978e 100644
--- a/external/rhino/ExternalPackage_rhino.mk
+++ b/external/rhino/ExternalPackage_rhino.mk
@@ -11,6 +11,6 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,rhino,rhino))
 
 $(eval $(call gb_ExternalPackage_use_external_project,rhino,rhino))
 
-$(eval $(call 
gb_ExternalPackage_add_file,rhino,$(LIBO_SHARE_JAVA_FOLDER)/js.jar,build/rhino1_5R5/js.jar))
+$(eval $(call 
gb_ExternalPackage_add_file,rhino,$(LIBO_SHARE_JAVA_FOLDER)/js.jar,build/js.jar))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/rhino/ExternalProject_rhino.mk 
b/external/rhino/ExternalProject_rhino.mk
index 6ef30ca34f24..3df0aaa4e2d9 100644
--- a/external/rhino/ExternalProject_rhino.mk
+++ b/external/rhino/ExternalProject_rhino.mk
@@ -16,16 +16,32 @@ $(eval $(call gb_ExternalProject_register_targets,rhino,\
 $(call gb_ExternalProject_get_state_target,rhino,build) :
        $(call gb_Trace_StartRange,rhino,EXTERNAL)
        $(call gb_ExternalProject_run,build,\
-               JAVA_HOME=$(JAVA_HOME_FOR_BUILD) \
-               $(ICECREAM_RUN) "$(ANT)" \
-                       $(if $(verbose),-v,-q) \
-                       -f build.xml \
-                       
-Dbuild.label="build-$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)"
 \
-                       -DTARFILE_LOCATION="$(if $(findstring 
-cygwin,$(BUILD_PLATFORM)),$(shell cygpath -m 
$(TARFILE_LOCATION)),$(TARFILE_LOCATION))" \
-                       -Dant.build.javac.source=$(JAVA_SOURCE_VER) \
-                       -Dant.build.javac.target=$(JAVA_TARGET_VER) \
-                       $(if $(debug),-Dbuild.debug="on") \
-                       jar \
+               mkdir $(call gb_UnpackedTarball_get_dir,rhino)/build \
+               && cd $(call gb_UnpackedTarball_get_dir,rhino) \
+               && $(call gb_JavaClassSet_JAVACCOMMAND,$(JAVA_TARGET_VER)) 
$(gb_JavaClassSet_JAVACDEBUG) \
+                       -d $(call 
gb_UnpackedTarball_get_dir,rhino)/build/content \
+                       @$(SRCDIR)/external/rhino/filelist.txt \
+               && mkdir $(call 
gb_UnpackedTarball_get_dir,rhino)/build/content/META-INF \
+               && cp $(call gb_UnpackedTarball_get_dir,rhino)/LICENSE.txt \
+                       $(call 
gb_UnpackedTarball_get_dir,rhino)/NOTICE-tools.txt \
+                       $(call gb_UnpackedTarball_get_dir,rhino)/NOTICE.txt \
+                       $(call 
gb_UnpackedTarball_get_dir,rhino)/build/content/META-INF/ \
+               && $(gb_Jar_JARCOMMAND) -cf $(call 
gb_UnpackedTarball_get_dir,rhino)/build/js.jar \
+                       -C $(call 
gb_UnpackedTarball_get_dir,rhino)/build/content . \
+                       -C $(call gb_UnpackedTarball_get_dir,rhino)/src \
+                       org/mozilla/javascript/commonjs/module/package.html \
+                       -C $(call gb_UnpackedTarball_get_dir,rhino)/src \
+                       
org/mozilla/javascript/commonjs/module/provider/package.html \
+                       -C $(call gb_UnpackedTarball_get_dir,rhino)/src \
+                       org/mozilla/javascript/resources/Messages.properties \
+                       -C $(call gb_UnpackedTarball_get_dir,rhino)/src \
+                       org/mozilla/javascript/resources/Messages_en.properties 
\
+                       -C $(call gb_UnpackedTarball_get_dir,rhino)/src \
+                       org/mozilla/javascript/resources/Messages_fr.properties 
\
+                       -C $(call gb_UnpackedTarball_get_dir,rhino)/src \
+                       org/mozilla/javascript/tools/debugger/test.js \
+                       -C $(call gb_UnpackedTarball_get_dir,rhino)/src \
+                       
org/mozilla/javascript/tools/resources/Messages.properties \
        )
        $(call gb_Trace_EndRange,rhino,EXTERNAL)
 
diff --git a/external/rhino/OfficeScriptInfo.java 
b/external/rhino/OfficeScriptInfo.java
deleted file mode 100644
index eb1d78641d23..000000000000
--- a/external/rhino/OfficeScriptInfo.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package org.mozilla.javascript.tools.debugger;
-import java.net.URL;
-import java.util.HashMap;
-import org.mozilla.javascript.Scriptable;
-
-public class OfficeScriptInfo
-{
-    private HashMap<String, SFScriptInfo> loadedSFScripts = new 
HashMap<String, SFScriptInfo>();
-
-    public void addScript( URL url, Scriptable scope, Runnable closeCallback )
-    {
-        addScript( url.toString(), url, scope, closeCallback );
-    }
-
-    public void addScript( String key, URL url, Scriptable scope, Runnable 
closeCallback )
-    {
-        SFScriptInfo si = loadedSFScripts.get( key );
-        if ( si == null )
-        {
-            si = new SFScriptInfo();
-            si.url = url;
-            si.scope = scope;
-            si.closeCallback = closeCallback;
-            loadedSFScripts.put( key, si );
-        }
-    }
-
-    public void deleteScript( String key )
-    {
-        SFScriptInfo info = loadedSFScripts.remove( key );
-        if ( info != null )
-        {
-            if ( info.closeCallback != null )
-            {
-                System.out.println("** In removeSFScriptInfo  have callback 
for " + key );
-                info.closeCallback.run(); // really need to do this in 
separate thread????
-            }
-        }
-    }
-
-    public Scriptable getScriptScope( String key )
-    {
-        Scriptable result = null;
-        SFScriptInfo info = loadedSFScripts.get( key );
-        if ( info != null )
-        {
-            result = info.scope;
-        }
-        return result;
-    }
-
-    public URL getScriptUrl( String key )
-    {
-        URL result = null;
-        SFScriptInfo info = loadedSFScripts.get( key );
-        if ( info != null )
-        {
-            result = info.url;
-        }
-        return result;
-    }
-    public boolean hasScript( String key )
-    {
-        boolean result = true;
-        SFScriptInfo info = loadedSFScripts.get( key );
-        if ( info == null )
-        {
-            result = false;
-        }
-        return result;
-    }
-
-    public void setScriptRunning( String key, boolean running )
-    {
-        SFScriptInfo info = loadedSFScripts.get( key );
-        if ( info != null )
-        {
-            info.isExecuting = running;
-        }
-    }
-
-    public boolean isScriptRunning( String key )
-    {
-        boolean result = false;
-        SFScriptInfo info = loadedSFScripts.get( key );
-        if ( info != null )
-        {
-            result = info.isExecuting;
-        }
-        return result;
-    }
-
-    class SFScriptInfo
-    {
-        Scriptable scope;
-        boolean isExecuting;
-        URL url;
-        Runnable closeCallback;
-    }
-}
diff --git a/external/rhino/UnpackedTarball_rhino.mk 
b/external/rhino/UnpackedTarball_rhino.mk
index 15a596eb1b0f..8cb9fd387384 100644
--- a/external/rhino/UnpackedTarball_rhino.mk
+++ b/external/rhino/UnpackedTarball_rhino.mk
@@ -11,15 +11,4 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,rhino))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,rhino,$(RHINO_TARBALL),,rhino))
 
-$(eval $(call gb_UnpackedTarball_set_patchlevel,rhino,2))
-
-$(eval $(call gb_UnpackedTarball_add_patches,rhino,\
-       external/rhino/rhino1_5R5.patch \
-       external/rhino/rhino1_5R5-find_swing.patch \
-       external/rhino/rhino1_5R5-updateToolTip.patch \
-       external/rhino/rhino-classpath.patch.1 \
-))
-
-$(eval $(call 
gb_UnpackedTarball_add_file,rhino,toolsrc/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java,external/rhino/OfficeScriptInfo.java))
-
 # vim: set noet sw=4 ts=4:
diff --git a/external/rhino/filelist.txt b/external/rhino/filelist.txt
new file mode 100644
index 000000000000..9ded7087e132
--- /dev/null
+++ b/external/rhino/filelist.txt
@@ -0,0 +1,330 @@
+src/org/mozilla/classfile/ByteCode.java
+src/org/mozilla/classfile/ClassFileField.java
+src/org/mozilla/classfile/ClassFileMethod.java
+src/org/mozilla/classfile/ClassFileWriter.java
+src/org/mozilla/classfile/ConstantEntry.java
+src/org/mozilla/classfile/ConstantPool.java
+src/org/mozilla/classfile/ExceptionTableEntry.java
+src/org/mozilla/classfile/FieldOrMethodRef.java
+src/org/mozilla/classfile/SuperBlock.java
+src/org/mozilla/classfile/TypeInfo.java
+src/org/mozilla/javascript/AbstractEcmaObjectOperations.java
+src/org/mozilla/javascript/AccessorSlot.java
+src/org/mozilla/javascript/Arguments.java
+src/org/mozilla/javascript/ArrowFunction.java
+src/org/mozilla/javascript/BaseFunction.java
+src/org/mozilla/javascript/BoundFunction.java
+src/org/mozilla/javascript/Callable.java
+src/org/mozilla/javascript/ClassCache.java
+src/org/mozilla/javascript/ClassShutter.java
+src/org/mozilla/javascript/CodeGenerator.java
+src/org/mozilla/javascript/CompilerEnvirons.java
+src/org/mozilla/javascript/ConsString.java
+src/org/mozilla/javascript/ConstProperties.java
+src/org/mozilla/javascript/Constructable.java
+src/org/mozilla/javascript/Context.java
+src/org/mozilla/javascript/ContextAction.java
+src/org/mozilla/javascript/ContextFactory.java
+src/org/mozilla/javascript/ContextListener.java
+src/org/mozilla/javascript/ContinuationPending.java
+src/org/mozilla/javascript/DToA.java
+src/org/mozilla/javascript/Decompiler.java
+src/org/mozilla/javascript/DefaultErrorReporter.java
+src/org/mozilla/javascript/DefiningClassLoader.java
+src/org/mozilla/javascript/Delegator.java
+src/org/mozilla/javascript/ES6Generator.java
+src/org/mozilla/javascript/ES6Iterator.java
+src/org/mozilla/javascript/EcmaError.java
+src/org/mozilla/javascript/EmbeddedSlotMap.java
+src/org/mozilla/javascript/EqualObjectGraphs.java
+src/org/mozilla/javascript/ErrorReporter.java
+src/org/mozilla/javascript/Evaluator.java
+src/org/mozilla/javascript/EvaluatorException.java
+src/org/mozilla/javascript/ExternalArrayData.java
+src/org/mozilla/javascript/Function.java
+src/org/mozilla/javascript/FunctionObject.java
+src/org/mozilla/javascript/GeneratedClassLoader.java
+src/org/mozilla/javascript/HashSlotMap.java
+src/org/mozilla/javascript/Hashtable.java
+src/org/mozilla/javascript/IRFactory.java
+src/org/mozilla/javascript/Icode.java
+src/org/mozilla/javascript/IdFunctionCall.java
+src/org/mozilla/javascript/IdFunctionObject.java
+src/org/mozilla/javascript/IdFunctionObjectES6.java
+src/org/mozilla/javascript/IdScriptableObject.java
+src/org/mozilla/javascript/ImplementationVersion.java
+src/org/mozilla/javascript/ImporterTopLevel.java
+src/org/mozilla/javascript/InterfaceAdapter.java
+src/org/mozilla/javascript/InterpretedFunction.java
+src/org/mozilla/javascript/Interpreter.java
+src/org/mozilla/javascript/InterpreterData.java
+src/org/mozilla/javascript/IteratorLikeIterable.java
+src/org/mozilla/javascript/JavaAdapter.java
+src/org/mozilla/javascript/JavaMembers.java
+src/org/mozilla/javascript/JavaMembers_jdk11.java
+src/org/mozilla/javascript/JavaScriptException.java
+src/org/mozilla/javascript/JavaToJSONConverters.java
+src/org/mozilla/javascript/Kit.java
+src/org/mozilla/javascript/LambdaConstructor.java
+src/org/mozilla/javascript/LambdaFunction.java
+src/org/mozilla/javascript/LambdaSlot.java
+src/org/mozilla/javascript/LazilyLoadedCtor.java
+src/org/mozilla/javascript/LazyLoadSlot.java
+src/org/mozilla/javascript/MemberBox.java
+src/org/mozilla/javascript/NativeArray.java
+src/org/mozilla/javascript/NativeArrayIterator.java
+src/org/mozilla/javascript/NativeBigInt.java
+src/org/mozilla/javascript/NativeBoolean.java
+src/org/mozilla/javascript/NativeCall.java
+src/org/mozilla/javascript/NativeCallSite.java
+src/org/mozilla/javascript/NativeCollectionIterator.java
+src/org/mozilla/javascript/NativeContinuation.java
+src/org/mozilla/javascript/NativeDate.java
+src/org/mozilla/javascript/NativeError.java
+src/org/mozilla/javascript/NativeFunction.java
+src/org/mozilla/javascript/NativeGenerator.java
+src/org/mozilla/javascript/NativeGlobal.java
+src/org/mozilla/javascript/NativeIterator.java
+src/org/mozilla/javascript/NativeJSON.java
+src/org/mozilla/javascript/NativeJavaArray.java
+src/org/mozilla/javascript/NativeJavaClass.java
+src/org/mozilla/javascript/NativeJavaConstructor.java
+src/org/mozilla/javascript/NativeJavaList.java
+src/org/mozilla/javascript/NativeJavaMap.java
+src/org/mozilla/javascript/NativeJavaMethod.java
+src/org/mozilla/javascript/NativeJavaObject.java
+src/org/mozilla/javascript/NativeJavaPackage.java
+src/org/mozilla/javascript/NativeJavaTopPackage.java
+src/org/mozilla/javascript/NativeMap.java
+src/org/mozilla/javascript/NativeMath.java
+src/org/mozilla/javascript/NativeNumber.java
+src/org/mozilla/javascript/NativeObject.java
+src/org/mozilla/javascript/NativePromise.java
+src/org/mozilla/javascript/NativeScript.java
+src/org/mozilla/javascript/NativeSet.java
+src/org/mozilla/javascript/NativeString.java
+src/org/mozilla/javascript/NativeStringIterator.java
+src/org/mozilla/javascript/NativeSymbol.java
+src/org/mozilla/javascript/NativeWeakMap.java
+src/org/mozilla/javascript/NativeWeakSet.java
+src/org/mozilla/javascript/NativeWith.java
+src/org/mozilla/javascript/Node.java
+src/org/mozilla/javascript/NodeTransformer.java
+src/org/mozilla/javascript/ObjArray.java
+src/org/mozilla/javascript/ObjToIntMap.java
+src/org/mozilla/javascript/Parser.java
+src/org/mozilla/javascript/PolicySecurityController.java
+src/org/mozilla/javascript/Ref.java
+src/org/mozilla/javascript/RefCallable.java
+src/org/mozilla/javascript/RegExpProxy.java
+src/org/mozilla/javascript/RhinoException.java
+src/org/mozilla/javascript/RhinoSecurityManager.java
+src/org/mozilla/javascript/Script.java
+src/org/mozilla/javascript/ScriptRuntime.java
+src/org/mozilla/javascript/ScriptRuntimeES6.java
+src/org/mozilla/javascript/ScriptStackElement.java
+src/org/mozilla/javascript/Scriptable.java
+src/org/mozilla/javascript/ScriptableObject.java
+src/org/mozilla/javascript/SecureCaller.java
+src/org/mozilla/javascript/SecurityController.java
+src/org/mozilla/javascript/SecurityUtilities.java
+src/org/mozilla/javascript/Slot.java
+src/org/mozilla/javascript/SlotMap.java
+src/org/mozilla/javascript/SlotMapContainer.java
+src/org/mozilla/javascript/Sorting.java
+src/org/mozilla/javascript/SpecialRef.java
+src/org/mozilla/javascript/StackStyle.java
+src/org/mozilla/javascript/Symbol.java
+src/org/mozilla/javascript/SymbolKey.java
+src/org/mozilla/javascript/SymbolScriptable.java
+src/org/mozilla/javascript/Synchronizer.java
+src/org/mozilla/javascript/ThreadSafeSlotMapContainer.java
+src/org/mozilla/javascript/Token.java
+src/org/mozilla/javascript/TokenStream.java
+src/org/mozilla/javascript/TopLevel.java
+src/org/mozilla/javascript/UintMap.java
+src/org/mozilla/javascript/Undefined.java
+src/org/mozilla/javascript/UnhandledRejectionTracker.java
+src/org/mozilla/javascript/UniqueTag.java
+src/org/mozilla/javascript/VMBridge.java
+src/org/mozilla/javascript/WrapFactory.java
+src/org/mozilla/javascript/WrappedException.java
+src/org/mozilla/javascript/Wrapper.java
+src/org/mozilla/javascript/annotations/JSConstructor.java
+src/org/mozilla/javascript/annotations/JSFunction.java
+src/org/mozilla/javascript/annotations/JSGetter.java
+src/org/mozilla/javascript/annotations/JSSetter.java
+src/org/mozilla/javascript/annotations/JSStaticFunction.java
+src/org/mozilla/javascript/ast/ArrayComprehension.java
+src/org/mozilla/javascript/ast/ArrayComprehensionLoop.java
+src/org/mozilla/javascript/ast/ArrayLiteral.java
+src/org/mozilla/javascript/ast/Assignment.java
+src/org/mozilla/javascript/ast/AstNode.java
+src/org/mozilla/javascript/ast/AstRoot.java
+src/org/mozilla/javascript/ast/BigIntLiteral.java
+src/org/mozilla/javascript/ast/Block.java
+src/org/mozilla/javascript/ast/BreakStatement.java
+src/org/mozilla/javascript/ast/CatchClause.java
+src/org/mozilla/javascript/ast/Comment.java
+src/org/mozilla/javascript/ast/ConditionalExpression.java
+src/org/mozilla/javascript/ast/ContinueStatement.java
+src/org/mozilla/javascript/ast/DestructuringForm.java
+src/org/mozilla/javascript/ast/DoLoop.java
+src/org/mozilla/javascript/ast/ElementGet.java
+src/org/mozilla/javascript/ast/EmptyExpression.java
+src/org/mozilla/javascript/ast/EmptyStatement.java
+src/org/mozilla/javascript/ast/ErrorCollector.java
+src/org/mozilla/javascript/ast/ErrorNode.java
+src/org/mozilla/javascript/ast/ExpressionStatement.java
+src/org/mozilla/javascript/ast/ForInLoop.java
+src/org/mozilla/javascript/ast/ForLoop.java
+src/org/mozilla/javascript/ast/FunctionCall.java
+src/org/mozilla/javascript/ast/FunctionNode.java
+src/org/mozilla/javascript/ast/GeneratorExpression.java
+src/org/mozilla/javascript/ast/GeneratorExpressionLoop.java
+src/org/mozilla/javascript/ast/IdeErrorReporter.java
+src/org/mozilla/javascript/ast/IfStatement.java
+src/org/mozilla/javascript/ast/InfixExpression.java
+src/org/mozilla/javascript/ast/Jump.java
+src/org/mozilla/javascript/ast/KeywordLiteral.java
+src/org/mozilla/javascript/ast/Label.java
+src/org/mozilla/javascript/ast/LabeledStatement.java
+src/org/mozilla/javascript/ast/LetNode.java
+src/org/mozilla/javascript/ast/Loop.java
+src/org/mozilla/javascript/ast/Name.java
+src/org/mozilla/javascript/ast/NewExpression.java
+src/org/mozilla/javascript/ast/NodeVisitor.java
+src/org/mozilla/javascript/ast/NumberLiteral.java
+src/org/mozilla/javascript/ast/ObjectLiteral.java
+src/org/mozilla/javascript/ast/ObjectProperty.java
+src/org/mozilla/javascript/ast/ParenthesizedExpression.java
+src/org/mozilla/javascript/ast/ParseProblem.java
+src/org/mozilla/javascript/ast/PropertyGet.java
+src/org/mozilla/javascript/ast/RegExpLiteral.java
+src/org/mozilla/javascript/ast/ReturnStatement.java
+src/org/mozilla/javascript/ast/Scope.java
+src/org/mozilla/javascript/ast/ScriptNode.java
+src/org/mozilla/javascript/ast/StringLiteral.java
+src/org/mozilla/javascript/ast/SwitchCase.java
+src/org/mozilla/javascript/ast/SwitchStatement.java
+src/org/mozilla/javascript/ast/Symbol.java
+src/org/mozilla/javascript/ast/TaggedTemplateLiteral.java
+src/org/mozilla/javascript/ast/TemplateCharacters.java
+src/org/mozilla/javascript/ast/TemplateLiteral.java
+src/org/mozilla/javascript/ast/ThrowStatement.java
+src/org/mozilla/javascript/ast/TryStatement.java
+src/org/mozilla/javascript/ast/UnaryExpression.java
+src/org/mozilla/javascript/ast/UpdateExpression.java
+src/org/mozilla/javascript/ast/VariableDeclaration.java
+src/org/mozilla/javascript/ast/VariableInitializer.java
+src/org/mozilla/javascript/ast/WhileLoop.java
+src/org/mozilla/javascript/ast/WithStatement.java
+src/org/mozilla/javascript/ast/XmlDotQuery.java
+src/org/mozilla/javascript/ast/XmlElemRef.java
+src/org/mozilla/javascript/ast/XmlExpression.java
+src/org/mozilla/javascript/ast/XmlFragment.java
+src/org/mozilla/javascript/ast/XmlLiteral.java
+src/org/mozilla/javascript/ast/XmlMemberGet.java
+src/org/mozilla/javascript/ast/XmlPropRef.java
+src/org/mozilla/javascript/ast/XmlRef.java
+src/org/mozilla/javascript/ast/XmlString.java
+src/org/mozilla/javascript/ast/Yield.java
+src/org/mozilla/javascript/commonjs/module/ModuleScope.java
+src/org/mozilla/javascript/commonjs/module/ModuleScript.java
+src/org/mozilla/javascript/commonjs/module/ModuleScriptProvider.java
+src/org/mozilla/javascript/commonjs/module/Require.java
+src/org/mozilla/javascript/commonjs/module/RequireBuilder.java
+src/org/mozilla/javascript/commonjs/module/provider/CachingModuleScriptProviderBase.java
+src/org/mozilla/javascript/commonjs/module/provider/DefaultUrlConnectionExpiryCalculator.java
+src/org/mozilla/javascript/commonjs/module/provider/ModuleSource.java
+src/org/mozilla/javascript/commonjs/module/provider/ModuleSourceProvider.java
+src/org/mozilla/javascript/commonjs/module/provider/ModuleSourceProviderBase.java
+src/org/mozilla/javascript/commonjs/module/provider/MultiModuleScriptProvider.java
+src/org/mozilla/javascript/commonjs/module/provider/ParsedContentType.java
+src/org/mozilla/javascript/commonjs/module/provider/SoftCachingModuleScriptProvider.java
+src/org/mozilla/javascript/commonjs/module/provider/StrongCachingModuleScriptProvider.java
+src/org/mozilla/javascript/commonjs/module/provider/UrlConnectionExpiryCalculator.java
+src/org/mozilla/javascript/commonjs/module/provider/UrlConnectionSecurityDomainProvider.java
+src/org/mozilla/javascript/commonjs/module/provider/UrlModuleSourceProvider.java
+src/org/mozilla/javascript/debug/DebugFrame.java
+src/org/mozilla/javascript/debug/DebuggableObject.java
+src/org/mozilla/javascript/debug/DebuggableScript.java
+src/org/mozilla/javascript/debug/Debugger.java
+src/org/mozilla/javascript/jdk18/VMBridge_jdk18.java
+src/org/mozilla/javascript/json/JsonParser.java
+src/org/mozilla/javascript/optimizer/Block.java
+src/org/mozilla/javascript/optimizer/BodyCodegen.java
+src/org/mozilla/javascript/optimizer/ClassCompiler.java
+src/org/mozilla/javascript/optimizer/Codegen.java
+src/org/mozilla/javascript/optimizer/OptFunctionNode.java
+src/org/mozilla/javascript/optimizer/OptRuntime.java
+src/org/mozilla/javascript/optimizer/OptTransformer.java
+src/org/mozilla/javascript/optimizer/Optimizer.java
+src/org/mozilla/javascript/regexp/NativeRegExp.java
+src/org/mozilla/javascript/regexp/NativeRegExpCallable.java
+src/org/mozilla/javascript/regexp/NativeRegExpCtor.java
+src/org/mozilla/javascript/regexp/NativeRegExpInstantiator.java
+src/org/mozilla/javascript/regexp/RegExpImpl.java
+src/org/mozilla/javascript/regexp/SubString.java
+src/org/mozilla/javascript/serialize/ScriptableInputStream.java
+src/org/mozilla/javascript/serialize/ScriptableOutputStream.java
+src/org/mozilla/javascript/tools/SourceReader.java
+src/org/mozilla/javascript/tools/ToolErrorReporter.java
+src/org/mozilla/javascript/tools/debugger/Dim.java
+src/org/mozilla/javascript/tools/debugger/GuiCallback.java
+src/org/mozilla/javascript/tools/debugger/Main.java
+src/org/mozilla/javascript/tools/debugger/ScopeProvider.java
+src/org/mozilla/javascript/tools/debugger/SourceProvider.java
+src/org/mozilla/javascript/tools/debugger/SwingGui.java
+src/org/mozilla/javascript/tools/debugger/treetable/AbstractCellEditor.java
+src/org/mozilla/javascript/tools/debugger/treetable/JTreeTable.java
+src/org/mozilla/javascript/tools/debugger/treetable/TreeTableModel.java
+src/org/mozilla/javascript/tools/debugger/treetable/TreeTableModelAdapter.java
+src/org/mozilla/javascript/tools/jsc/Main.java
+src/org/mozilla/javascript/tools/shell/ConsoleTextArea.java
+src/org/mozilla/javascript/tools/shell/Environment.java
+src/org/mozilla/javascript/tools/shell/Global.java
+src/org/mozilla/javascript/tools/shell/JSConsole.java
+src/org/mozilla/javascript/tools/shell/JavaPolicySecurity.java
+src/org/mozilla/javascript/tools/shell/Main.java
+src/org/mozilla/javascript/tools/shell/QuitAction.java
+src/org/mozilla/javascript/tools/shell/SecurityProxy.java
+src/org/mozilla/javascript/tools/shell/ShellConsole.java
+src/org/mozilla/javascript/tools/shell/ShellContextFactory.java
+src/org/mozilla/javascript/tools/shell/ShellLine.java
+src/org/mozilla/javascript/tools/shell/Timers.java
+src/org/mozilla/javascript/typedarrays/ByteIo.java
+src/org/mozilla/javascript/typedarrays/Conversions.java
+src/org/mozilla/javascript/typedarrays/NativeArrayBuffer.java
+src/org/mozilla/javascript/typedarrays/NativeArrayBufferView.java
+src/org/mozilla/javascript/typedarrays/NativeDataView.java
+src/org/mozilla/javascript/typedarrays/NativeFloat32Array.java
+src/org/mozilla/javascript/typedarrays/NativeFloat64Array.java
+src/org/mozilla/javascript/typedarrays/NativeInt16Array.java
+src/org/mozilla/javascript/typedarrays/NativeInt32Array.java
+src/org/mozilla/javascript/typedarrays/NativeInt8Array.java
+src/org/mozilla/javascript/typedarrays/NativeTypedArrayIterator.java
+src/org/mozilla/javascript/typedarrays/NativeTypedArrayView.java
+src/org/mozilla/javascript/typedarrays/NativeUint16Array.java
+src/org/mozilla/javascript/typedarrays/NativeUint32Array.java
+src/org/mozilla/javascript/typedarrays/NativeUint8Array.java
+src/org/mozilla/javascript/typedarrays/NativeUint8ClampedArray.java
+src/org/mozilla/javascript/v8dtoa/CachedPowers.java
+src/org/mozilla/javascript/v8dtoa/DiyFp.java
+src/org/mozilla/javascript/v8dtoa/DoubleConversion.java
+src/org/mozilla/javascript/v8dtoa/DoubleHelper.java
+src/org/mozilla/javascript/v8dtoa/FastDtoa.java
+src/org/mozilla/javascript/v8dtoa/FastDtoaBuilder.java
+src/org/mozilla/javascript/xml/XMLLib.java
+src/org/mozilla/javascript/xml/XMLObject.java
+src/org/mozilla/javascript/xmlimpl/Namespace.java
+src/org/mozilla/javascript/xmlimpl/QName.java
+src/org/mozilla/javascript/xmlimpl/XML.java
+src/org/mozilla/javascript/xmlimpl/XMLCtor.java
+src/org/mozilla/javascript/xmlimpl/XMLLibImpl.java
+src/org/mozilla/javascript/xmlimpl/XMLList.java
+src/org/mozilla/javascript/xmlimpl/XMLName.java
+src/org/mozilla/javascript/xmlimpl/XMLObjectImpl.java
+src/org/mozilla/javascript/xmlimpl/XMLWithScope.java
+src/org/mozilla/javascript/xmlimpl/XmlNode.java
+src/org/mozilla/javascript/xmlimpl/XmlProcessor.java
diff --git a/external/rhino/rhino-classpath.patch.1 
b/external/rhino/rhino-classpath.patch.1
deleted file mode 100644
index c751b95b5d9b..000000000000
--- a/external/rhino/rhino-classpath.patch.1
+++ /dev/null
@@ -1,13 +0,0 @@
-/usr/bin/ant will put dozens of jars on the classpath, including a
-rhino.jar that breaks the build
-
---- rhino/build.xml.orig       2021-11-11 17:25:07.284267174 +0100
-+++ rhino/build.xml    2021-11-11 17:25:38.689242510 +0100
-@@ -33,6 +33,7 @@
-     <property file="apiClasses.properties"/>
-     <property name="docsrc.dir" value="docs"/>
-     <property name="dist.docsrc.dir" value="src/docs"/>
-+    <property name="build.sysclasspath" value="ignore"/>
-   </target>
- 
-   <target name="init" depends="properties">
diff --git a/external/rhino/rhino1_5R5-find_swing.patch 
b/external/rhino/rhino1_5R5-find_swing.patch
deleted file mode 100644
index 905336eb1b0d..000000000000
--- a/external/rhino/rhino1_5R5-find_swing.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- misc/rhino1_5R5/toolsrc/build.xml  2009-10-29 18:29:46.605524507 +0100
-+++ misc/build/rhino1_5R5/toolsrc/build.xml    2009-10-29 18:29:26.536908810 
+0100
-@@ -38,11 +38,12 @@
-                property="swing-ex-available"/>
-   </target>
- 
-+  <property name="swing_zip" 
value="${TARFILE_LOCATION}/35c94d2df8893241173de1d16b6034c0-swingExSrc.zip"/>
-   <target name="get-swing-ex" unless="swing-ex-available">
-     <!-- Download source from Sun's site, unzip it, remove
-          the files we don't need, and change the package
-     -->
--    <unzip src="../../../../../download/swingExSrc.zip" 
dest="${src.debugger}"/>
-+    <unzip src="${swing_zip}" dest="${src.debugger}"/>
-     <delete file="${src.debugger}/FileSystemModel2.java" />
-     <delete file="${src.debugger}/MergeSort.java" />
-     <delete file="${src.debugger}/TreeTableExample2.java" />
diff --git a/external/rhino/rhino1_5R5-updateToolTip.patch 
b/external/rhino/rhino1_5R5-updateToolTip.patch
deleted file mode 100644
index be0700daf6c5..000000000000
--- a/external/rhino/rhino1_5R5-updateToolTip.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- misc/rhino1_5R5/toolsrc/org/mozilla/javascript/tools/debugger/Main.java    
Wed Feb 23 10:25:09 2011
-+++ 
misc/build/rhino1_5R5/toolsrc/org/mozilla/javascript/tools/debugger/Main.java   
   Wed Feb 23 10:25:01 2011
-@@ -1045,9 +1045,18 @@
-             } );
-     }
- 
-+    // Fix taken from 
<ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2.zip>
-+    // toolsrc/org/mozilla/javascript/tools/debugger/SwingGui.java:
-     private void updateToolTip() {
--        // in case fileName is very long, try to set tool tip on frame
--        Component c = getComponent(1);
-+        // Try to set tool tip on frame. On macOS 10.5,
-+        // the number of components is different, so try to be safe.
-+        int n = getComponentCount() - 1;
-+        if (n > 1) {
-+            n = 1;
-+        } else if (n < 0) {
-+            return;
-+        }
-+        Component c = getComponent(n);
-         // this will work at least for Metal L&F
-         if (c != null && c instanceof JComponent) {
-             ((JComponent)c).setToolTipText(getUrl());
diff --git a/external/rhino/rhino1_5R5.patch b/external/rhino/rhino1_5R5.patch
deleted file mode 100644
index 40fc6cc9427b..000000000000
--- a/external/rhino/rhino1_5R5.patch
+++ /dev/null
@@ -1,1067 +0,0 @@
---- misc/rhino1_5R5/src/org/mozilla/javascript/DefiningClassLoader.java        
Thu Mar 25 21:54:34 2004
-+++ misc/build/rhino1_5R5/src/org/mozilla/javascript/DefiningClassLoader.java  
Fri Mar 28 17:24:23 2008
-@@ -38,6 +38,7 @@
- package org.mozilla.javascript;
- 
- import java.lang.reflect.Method;
-+import java.lang.reflect.InvocationTargetException;
- 
- /**
-  * Load generated classes.
-@@ -48,11 +49,34 @@
-     implements GeneratedClassLoader
- {
-     public DefiningClassLoader() {
--        this.parentLoader = getClass().getClassLoader();
-+        init(getClass().getClassLoader());
-     }
- 
-     public DefiningClassLoader(ClassLoader parentLoader) {
-+
-+        init(parentLoader);
-+    }
-+
-+    private void init(ClassLoader parentLoader) {
-+
-         this.parentLoader = parentLoader;
-+
-+        this.contextLoader = null;
-+        if (method_getContextClassLoader != null) {
-+            try {
-+                this.contextLoader = (ClassLoader)
-+                    method_getContextClassLoader.invoke(
-+                        Thread.currentThread(),
-+                        ScriptRuntime.emptyArgs);
-+            } catch (IllegalAccessException ex) {
-+            } catch (InvocationTargetException ex) {
-+            } catch (SecurityException ex) {
-+            }
-+            if (this.contextLoader == this.parentLoader) {
-+                this.contextLoader = null;
-+            }
-+        }
-+
-     }
- 
-     public Class defineClass(String name, byte[] data) {
-@@ -68,10 +92,20 @@
-     {
-         Class cl = findLoadedClass(name);
-         if (cl == null) {
--            if (parentLoader != null) {
--                cl = parentLoader.loadClass(name);
-+            // First try parent class loader and if that does not work, try
-+            // contextLoader, but that will be null if
-+            // Thread.getContextClassLoader() == parentLoader
-+            // or on JDK 1.1 due to lack Thread.getContextClassLoader().
-+            // To avoid catching and rethrowing ClassNotFoundException
-+            // in this cases, use try/catch check only if contextLoader != 
null.
-+            if (contextLoader == null) {
-+                cl = loadFromParent(name);
-             } else {
--                cl = findSystemClass(name);
-+                try {
-+                    cl = loadFromParent(name);
-+                } catch (ClassNotFoundException ex) {
-+                    cl = contextLoader.loadClass(name);
-+                }
-             }
-         }
-         if (resolve) {
-@@ -80,5 +114,37 @@
-         return cl;
-     }
- 
-+    private Class loadFromParent(String name)
-+        throws ClassNotFoundException
-+    {
-+        if (parentLoader != null) {
-+            return parentLoader.loadClass(name);
-+        } else {
-+            return findSystemClass(name);
-+        }
-+
-+    }
-+
-     private ClassLoader parentLoader;
-+
-+    private ClassLoader contextLoader;
-+
-+    // We'd like to use "Thread.getContextClassLoader", but
-+    // that's only available on Java2.
-+    private static Method method_getContextClassLoader;
-+
-+    static {
-+        try {
-+            // Don't use "Thread.class": that performs the lookup
-+            // in the class initializer, which doesn't allow us to
-+            // catch possible security exceptions.
-+            Class threadClass = Class.forName("java.lang.Thread");
-+            method_getContextClassLoader =
-+                threadClass.getDeclaredMethod("getContextClassLoader",
-+                                               new Class[0]);
-+        } catch (ClassNotFoundException e) {
-+        } catch (NoSuchMethodException e) {
-+        } catch (SecurityException e) {
-+        }
-+    }
- }
---- misc/rhino1_5R5/toolsrc/build.xml  2004-03-25 21:54:34.000000000 +0100
-+++ misc/build/rhino1_5R5/toolsrc/build.xml    2009-01-17 20:46:44.000000000 
+0100
-@@ -6,6 +6,28 @@
- -->
- <project name="toolsrc" default="compile" basedir=".">
- 
-+  <condition property="boot_refID" value="macPath" else="nonMacPath">
-+    <and>
-+      <os family="mac"/>
-+      <os family="unix"/>
-+      <or>
-+        <equals arg1="${ant.java.version}" arg2="1.5"/>
-+        <equals arg1="${ant.java.version}" arg2="1.6"/>
-+      </or>
-+    </and>
-+  </condition>
-+  <path id="macPath" location="${java.home}/../Classes/classes.jar"/>
-+  <!-- rhino.jar from OpenJDK breaks build -->
-+  <path id="nonMacPath">
-+    <fileset dir="${java.home}/">
-+       <include name="jre/lib/*.jar"/>
-+       <include name="lib/*.jar"/>
-+       <exclude name="jre/lib/rhino.jar"/>
-+       <exclude name="lib/rhino.jar"/>
-+     </fileset>
-+  </path>
-+  <path id="my.bootstrap.classpath" refID="${boot_refID}"/>
-+
-   <target name="properties">
-     <property name="nest" value=".."/>
-     <property name="build.dir" value="./build"/>
-@@ -20,46 +42,10 @@
-     <!-- Download source from Sun's site, unzip it, remove
-          the files we don't need, and change the package
-     -->
--    <get 
src="http://java.sun.com/products/jfc/tsc/articles/treetable2/downloads/src.zip";
 dest="${nest}/${build.dir}/swingExSrc.zip"/>
--    <unzip src="${nest}/${build.dir}/swingExSrc.zip" dest="${src.debugger}"/>
-+    <unzip src="../../../../../download/swingExSrc.zip" 
dest="${src.debugger}"/>
-     <delete file="${src.debugger}/FileSystemModel2.java" />
-     <delete file="${src.debugger}/MergeSort.java" />
-     <delete file="${src.debugger}/TreeTableExample2.java" />
--    <replace file="${src.debugger}/AbstractCellEditor.java">
--       <replacetoken>import java.awt.Component;</replacetoken>
--       <replacevalue>
--         package org.mozilla.javascript.tools.debugger;
--         import java.awt.Component;
--       </replacevalue>
--    </replace>
--    <replace file="${src.debugger}/AbstractTreeTableModel.java">
--       <replacetoken>import javax.swing.tree.*;</replacetoken>
--       <replacevalue>
--         package org.mozilla.javascript.tools.debugger;
--         import javax.swing.tree.*;
--       </replacevalue>
--    </replace>
--    <replace file="${src.debugger}/JTreeTable.java">
--       <replacetoken>import javax.swing.*;</replacetoken>
--       <replacevalue>
--         package org.mozilla.javascript.tools.debugger;
--         import javax.swing.*;
--       </replacevalue>
--    </replace>
--    <replace file="${src.debugger}/TreeTableModel.java">
--       <replacetoken>import javax.swing.tree.TreeModel;</replacetoken>
--       <replacevalue>
--         package org.mozilla.javascript.tools.debugger;
--         import javax.swing.tree.TreeModel;
--       </replacevalue>
--    </replace>
--    <replace file="${src.debugger}/TreeTableModelAdapter.java">
--       <replacetoken>import javax.swing.JTree;</replacetoken>
--       <replacevalue>
--         package org.mozilla.javascript.tools.debugger;
--         import javax.swing.JTree;
--       </replacevalue>
--    </replace>
-   </target>
- 
-   <target name="compile" depends="properties,get-swing-ex">
---- misc/rhino1_5R5/toolsrc/org/mozilla/javascript/tools/debugger/Main.java    
2004-03-25 21:54:34.000000000 +0100
-+++ 
misc/build/rhino1_5R5/toolsrc/org/mozilla/javascript/tools/debugger/Main.java   
   2009-01-17 20:44:22.000000000 +0100
-@@ -470,15 +470,21 @@
-         case KeyEvent.VK_BACK_SPACE:
-         case KeyEvent.VK_ENTER:
-         case KeyEvent.VK_DELETE:
-+            if (w.isEditable() == false) {
-             e.consume();
-+            }
-             break;
-         }
-     }
-     public void keyTyped(KeyEvent e) {
-+        if (w.isEditable() == false) {
-         e.consume();
-+        }
-     }
-     public void keyReleased(KeyEvent e) {
-+        if (w.isEditable() == false) {
-         e.consume();
-+        }
-     }
- }
- 
-@@ -879,7 +885,7 @@
-     }
- };
- 
--class FileWindow extends JInternalFrame implements ActionListener {
-+class FileWindow extends JInternalFrame implements ActionListener, 
DocumentListener {
- 
-     Main db;
-     SourceInfo sourceInfo;
-@@ -888,15 +894,16 @@
-     JScrollPane p;
-     int currentPos;
-     JLabel statusBar;
-+    boolean isModified = false;
- 
-     public void actionPerformed(ActionEvent e) {
-         String cmd = e.getActionCommand();
-         if (cmd.equals("Cut")) {
--            // textArea.cut();
-+            textArea.cut();
-         } else if (cmd.equals("Copy")) {
-             textArea.copy();
-         } else if (cmd.equals("Paste")) {
--            // textArea.paste();
-+            textArea.paste();
-         }
-     }
- 
-@@ -910,17 +917,73 @@
-     }
- 
-     void load() {
--        Scriptable scope = db.getScope();
-+        //Scriptable scope = db.getScope();
-+        Scriptable scope = db.officeScripts.getScriptScope( getUrl() );
-+        if ( scope == null )
-+        {
-+            scope = db.getScope();
-+        }
-         if (scope == null) {
-             MessageDialogWrapper.showMessageDialog(db, "Can't load scripts: 
no scope available", "Run", JOptionPane.ERROR_MESSAGE);
-         } else {
-             String url = getUrl();
-             if (url != null) {
--                new Thread(new LoadFile(db,scope,url)).start();
-+                new Thread(new LoadFile(db,scope, url, new 
StringReader(textArea.getText()))).start();
-             }
-         }
-     }
- 
-+    void save() {
-+        if (getUrl() != null) {
-+            OutputStream os = null;
-+            try {
-+                if ( getUrl().startsWith("vnd.sun.star")  )
-+                {
-+                    URL scriptUrl = db.officeScripts.getScriptUrl( getUrl() );
-+                    if ( scriptUrl == null )
-+                    {
-+                        throw new IOException("Can't optain stream for " + 
getUrl() );
-+                    }
-+                    os = scriptUrl.openConnection().getOutputStream();
-+                }
-+                else
-+                {
-+                   os = new FileOutputStream( getUrl() );
-+                }
-+                String s = textArea.getText();
-+                os.write(s.getBytes(), 0, s.length());
-+
-+                this.isModified = false;
-+            }
-+            catch (IOException ioe) {
-+                JOptionPane.showMessageDialog(this,
-+                    "Error saving file: " + ioe.getMessage(),
-+                    "Error", JOptionPane.ERROR_MESSAGE);
-+            }
-+            finally
-+            {
-+                if ( os != null )
-+                {
-+                    try
-+                    {
-+                        os.close();
-+                        os = null;
-+                    }
-+                    catch( IOException ioe )
-+                    {
-+                        System.err.println("Error closing stream: " + 
ioe.getMessage() );
-+                        ioe.printStackTrace();
-+                    }
-+                }
-+            }
-+        }
-+   }
-+
-+   public boolean isEditable() {
-+       return db.isSourceEditingEnabled();
-+   }
-+
-+
-    public int getPosition(int line) {
-         int result = -1;
-         try {
-@@ -953,7 +1016,7 @@
-             fileHeader.repaint();
-         }
-     }
--
-+    public Main getDB() { return db; }
-     FileWindow(Main db, SourceInfo sourceInfo) {
-         super(SourceInfo.getShortName(sourceInfo.getUrl()),
-               true, true, true, true);
-@@ -972,6 +1035,14 @@
-         pack();
-         updateText();
-         textArea.select(0);
-+        addInternalFrameListener( new InternalFrameAdapter() {
-+            public void internalFrameClosed(InternalFrameEvent e) {
-+                    // clean up scriptItems and sourceNames hashes
-+                    getDB().removeScript( getUrl() );
-+                    // remove scripts for officeScripts
-+                    getDB().officeScripts.deleteScript( getUrl() );
-+                }
-+            } );
-     }
- 
-     private void updateToolTip() {
-@@ -990,7 +1061,10 @@
-     void updateText() {
-         String newText = sourceInfo.getSource();
-         if (!textArea.getText().equals(newText)) {
-+            textArea.getDocument().removeDocumentListener(this);
-             textArea.setText(newText);
-+            this.isModified = false;
-+            textArea.getDocument().addDocumentListener(this);
-             int pos = 0;
-             if (currentPos != -1) {
-                 pos = currentPos;
-@@ -1001,6 +1075,31 @@
-         fileHeader.repaint();
-     }
- 
-+    /* Implementation of DocumentListener interface */
-+    public void insertUpdate(DocumentEvent e) {
-+        doChanged(e);
-+    }
-+
-+    public void removeUpdate(DocumentEvent e) {
-+        doChanged(e);
-+    }
-+
-+    public void changedUpdate(DocumentEvent e) {
-+        doChanged(e);
-+    }
-+
-+    public void doChanged(DocumentEvent e) {
-+        this.isModified = true;
-+    }
-+
-+    public boolean isModified() {
-+        return this.isModified;
-+    }
-+
-+    public String getText() {
-+        return textArea.getText();
-+    }
-+
-     void setPosition(int pos) {
-         textArea.select(pos);
-         currentPos = pos;
-@@ -1618,7 +1717,7 @@
-         if (line != -1) {
-             db.currentWindow = w;
-         }
--        db.menubar.addFile(url);
-+        // db.menubar.addFile(url);
-         w.setVisible(true);
-         if (activate) {
-             try {
-@@ -1752,8 +1851,10 @@
-     Menubar(Main db) {
-         super();
-         this.db = db;
--        String[] fileItems  = {"Open...", "Run...", "", "Exit"};
--        String[] fileCmds  = {"Open", "Load", "", "Exit"};
-+        // String[] fileItems  = {"Open...", "Run...", "", "Exit"};
-+        // String[] fileCmds  = {"Open", "Load", "", "Exit"};
-+        String[] fileItems  = {"Run", "Save", "", "Exit"};
-+        String[] fileCmds  = {"Run", "Save", "", "Exit"};
-         char[] fileShortCuts = {'0', 'N', '
-         int[] fileAccelerators = {KeyEvent.VK_O,
-                                   KeyEvent.VK_N,
-@@ -1795,6 +1896,9 @@
-                     KeyStroke k = KeyStroke.getKeyStroke(fileAccelerators[i], 
Event.CTRL_MASK);
-                     item.setAccelerator(k);
-                 }
-+                if (fileItems[i].equals("Save")) {
-+                    saveItem = item;
-+                }
-             }
-         }
-         for (int i = 0; i < editItems.length; ++i) {
-@@ -1849,9 +1953,9 @@
-         item.addActionListener(this);
-         windowMenu.add(item = new JMenuItem("Tile", 'T'));
-         item.addActionListener(this);
--        windowMenu.addSeparator();
--        windowMenu.add(item = new JMenuItem("Console", 'C'));
--        item.addActionListener(this);
-+//        windowMenu.addSeparator();
-+//        windowMenu.add(item = new JMenuItem("Console", 'C'));
-+//        item.addActionListener(this);
-         add(windowMenu);
- 
-     }
-@@ -1925,11 +2029,16 @@
-         item.addActionListener(this);
-     }
- 
-+    public void setSaveEnabled(boolean state) {
-+        saveItem.setEnabled(state);
-+    }
-+
-     Main db;
-     JMenu windowMenu;
-     JCheckBoxMenuItem breakOnExceptions;
-     JCheckBoxMenuItem breakOnEnter;
-     JCheckBoxMenuItem breakOnReturn;
-+    JMenuItem saveItem;
- };
- 
- class EnterInterrupt implements Runnable {
-@@ -1942,6 +2051,13 @@
-     public void run() {
-         JMenu menu = db.getJMenuBar().getMenu(0);
-         //menu.getItem(0).setEnabled(false); // File->Load
-+
-+        // disable Edit menu Cut, Copy, Paste items
-+        menu = db.getJMenuBar().getMenu(1);
-+        for (int i = 0; i < 3; i++) {
-+            menu.getItem(i).setEnabled(false);
-+        }
-+
-         menu = db.getJMenuBar().getMenu(2);
-         menu.getItem(0).setEnabled(false); // Debug->Break
-         int count = menu.getItemCount();
-@@ -1954,6 +2070,10 @@
-             b = true;
-         }
-         db.toolBar.setEnabled(true);
-+
-+        // set flag to disable source editing
-+        db.setSourceEditingEnabled(false);
-+
-         // raise the debugger window
-         db.toFront();
-     }
-@@ -1967,6 +2087,13 @@
-     public void run() {
-         JMenu menu = db.getJMenuBar().getMenu(0);
-         menu.getItem(0).setEnabled(true); // File->Load
-+
-+        // enable Edit menu items
-+        menu = db.getJMenuBar().getMenu(1);
-+        for (int i = 0; i < 3; i++) {
-+            menu.getItem(i).setEnabled(true);
-+        }
-+
-         menu = db.getJMenuBar().getMenu(2);
-         menu.getItem(0).setEnabled(true); // Debug->Break
-         int count = menu.getItemCount() - 1;
-@@ -1980,6 +2107,10 @@
-             db.toolBar.getComponent(ci).setEnabled(b);
-             b = false;
-         }
-+
-+        // set flag to enable source editing
-+        db.setSourceEditingEnabled(true);
-+
-         //db.console.consoleTextArea.requestFocus();
-     }
- };
-@@ -1988,17 +2119,24 @@
- {
-     String fileName;
-     Main db;
-+    Reader reader = null;
-     OpenFile(Main db, String fileName)
-     {
-         this.fileName = fileName;
-         this.db = db;
-     }
-+    OpenFile(Main db, String fileName, Reader reader) {
-+        this(db, fileName);
-+        this.reader = reader;
-+    }
-     public void run() {
-         Context cx = Context.enter();
-         ContextData contextData = ContextData.get(cx);
-         contextData.breakNextLine = true;
-         try {
--            cx.compileReader(new FileReader(fileName), fileName, 1, null);
-+            cx.compileReader(
-+                reader == null ? new FileReader(fileName) : reader,
-+                               fileName, 1, null);
-         } catch (Exception exc) {
-             String msg = exc.getMessage();
-             if (exc instanceof EcmaError) {
-@@ -2019,29 +2157,79 @@
-     Scriptable scope;
-     String fileName;
-     Main db;
-+    Reader reader = null;
-+    Object result = null;
-+    Exception exception = null;
-+    int lineNum = -1;
-+    boolean sfExecute = false;
-+
-     LoadFile(Main db, Scriptable scope, String fileName) {
-         this.scope = scope;
-         this.fileName = fileName;
-         this.db = db;
-     }
-+
-+    LoadFile(Main db, Scriptable scope, String fileName, Reader reader) {
-+        this(db, scope, fileName);
-+        this.reader = reader;
-+    }
-+    LoadFile(Main db, Scriptable scope, String fileName, Reader reader, 
boolean sfExecute ) {
-+        this(db, scope, fileName);
-+        this.reader = reader;
-+        this.sfExecute = sfExecute;
-+    }
-+
-     public void run() {
-+        if ( db.officeScripts.isScriptRunning( fileName ) )
-+        { 
-+            exception = new Exception("The script is already executing");
-+            if ( !sfExecute ) {
-+                MessageDialogWrapper.showMessageDialog(db,
-+                                                   "Script already executing",
-+                                                   "Run",
-+                                                   JOptionPane.ERROR_MESSAGE);
-+            }
-+            return;
-+        } 
-+        db.officeScripts.setScriptRunning( fileName, true );
-         Context cx = Context.enter();
-         ContextData contextData = ContextData.get(cx);
-+        if ( sfExecute )
-+        {
-+            contextData.breakNextLine = false;
-+        }
-+        else
-+        {
-         contextData.breakNextLine = true;
-+        }
-+        /*
-+        FileWindow w = (FileWindow)db.getSelectedFrame();
-+        if ( sfExecute )        
-+        {
-+            db.swingInvoke(new SetFilePosition(db, w, -1 ) );                
-+        }*/
-         try {
--            cx.evaluateReader(scope, new FileReader(fileName),
-+            result = cx.evaluateReader(scope,
-+                reader == null ? new FileReader(fileName) : reader,
-                               fileName, 1, null);
-         } catch (Exception exc) {
-+            exception = exc;
-             String msg = exc.getMessage();
-             if (exc instanceof EcmaError) {
-                 EcmaError err = (EcmaError)exc;
-                 msg = err.getSourceName() + ", line " + err.getLineNumber() + 
": " + msg;
--            }
-+    
-+                int lineNum =  err.getLineNumber() ;
-+                //db.swingInvoke(new SetFilePosition(db, w, lineNum ) );
-+                if ( !sfExecute ) {
-             MessageDialogWrapper.showMessageDialog(db,
-                                                    msg,
-                                                    "Run",
-                                                    JOptionPane.ERROR_MESSAGE);
-+                }
-+            }
-         } finally {
-+            db.officeScripts.setScriptRunning( fileName, false );
-             cx.exit();
-         }
-     }
-@@ -2416,13 +2604,13 @@
-         super.setVisible(b);
-         if (b) {
-             // this needs to be done after the window is visible
--            console.consoleTextArea.requestFocus();
-+            // console.consoleTextArea.requestFocus();
-             context.split.setDividerLocation(0.5);
-             try {
--                console.setMaximum(true);
--                console.setSelected(true);
--                console.show();
--                console.consoleTextArea.requestFocus();
-+                // console.setMaximum(true);
-+                // console.setSelected(true);
-+                // console.show();
-+                // console.consoleTextArea.requestFocus();
-             } catch (Exception exc) {
-             }
-         }
-@@ -2449,35 +2637,6 @@
- 
-     Hashtable functionNames = new Hashtable();
- 
--    ScriptItem getScriptItem(DebuggableScript fnOrScript) {
--        ScriptItem item = (ScriptItem)scriptItems.get(fnOrScript);
--        if (item == null) {
--            String url = getNormilizedUrl(fnOrScript);
--            SourceInfo si = (SourceInfo)sourceNames.get(url);
--            if (si == null) {
--                if (!fnOrScript.isGeneratedScript()) {
--                    // Not eval or Function, try to load it from URL
--                    String source = null;
--                    try {
--                        InputStream is = openSource(url);
--                        try { source = readSource(is); }
--                        finally { is.close(); }
--                    } catch (IOException ex) {
--                        System.err.println
--                            ("Failed to load source from "+url+": "+ ex);
--                    }
--                    if (source != null) {
--                        si = registerSource(url, source);
--                    }
--                }
--            }
--            if (si != null) {
--                item = registerScript(si, fnOrScript);
--            }
--        }
--        return item;
--    }
--
-     /* Debugger Interface */
- 
-     public void handleCompilationDone(Context cx, DebuggableScript fnOrScript,
-@@ -2490,7 +2649,7 @@
- 
-     String getNormilizedUrl(DebuggableScript fnOrScript) {
-         String url = fnOrScript.getSourceName();
--        if (url == null) { url = "<stdin>"; }
-+        if (url == null) { url = "document"; }
-         else {
-             // Not to produce window for eval from different lines,
-             // strip line numbers, i.e. replace all #[0-9]+\(eval\) by (eval)
-@@ -2601,7 +2760,7 @@
-             if (si == null) {
-                 si = new SourceInfo(sourceUrl, source);
-                 sourceNames.put(sourceUrl, si);
--            } else {
-+            } else if (!source.equals(si.getSource())) {
-                 si.setSource(source);
-             }
-         }
-@@ -2762,7 +2921,7 @@
-         desk = new JDesktopPane();
-         desk.setPreferredSize(new Dimension(600, 300));
-         desk.setMinimumSize(new Dimension(150, 50));
--        desk.add(console = new JSInternalConsole("JavaScript Console"));
-+        // desk.add(console = new JSInternalConsole("JavaScript Console"));
-         context = new ContextWindow(this);
-         context.setPreferredSize(new Dimension(600, 120));
-         context.setMinimumSize(new Dimension(50, 50));
-@@ -2871,7 +3030,7 @@
-             FrameHelper frame = contextData.getFrame(frameIndex);
-             String sourceName = frame.getUrl();
-             if (sourceName == null || sourceName.equals("<stdin>")) {
--                console.show();
-+                // console.show();
-                 helper.reset();
-                 return;
-             }
-@@ -2895,6 +3054,19 @@
-     int dispatcherIsWaiting = 0;
-     Context currentContext = null;
- 
-+    // Flag used to establish whether source code editing is allowed in
-+    // the debugger, switched on and off depending on whether a debug session
-+    // is active
-+    boolean sourceEditingEnabled = true;
-+
-+    public boolean isSourceEditingEnabled() {
-+        return sourceEditingEnabled;
-+    }
-+
-+    void setSourceEditingEnabled(boolean b) {
-+        sourceEditingEnabled = b;
-+    }
-+
-     Context getCurrentContext() {
-         return currentContext;
-     }
-@@ -3028,14 +3200,14 @@
-                     swingInvoke(CreateFileWindow.action(this, si, line));
-                 }
-             } else {
--                if (console.isVisible()) {
-+                /* if (console.isVisible()) {
-                     final JSInternalConsole finalConsole = console;
-                     swingInvoke(new Runnable() {
-                             public void run() {
-                                 finalConsole.show();
-                             }
-                         });
--                }
-+                } */
-             }
-             swingInvoke(new EnterInterrupt(this, cx));
-             swingInvoke(new UpdateContext(this, cx));
-@@ -3217,6 +3389,14 @@
-                                             fileName)).start();
-                 }
-             }
-+        } else if (cmd.equals("Run")) {
-+            FileWindow w = (FileWindow)getSelectedFrame();
-+            if (w != null)
-+                w.load();
-+        } else if (cmd.equals("Save")) {
-+            FileWindow w = (FileWindow)getSelectedFrame();
-+            if (w != null)
-+                w.save();
-         } else if (cmd.equals("More Windows...")) {
-             MoreWindows dlg = new MoreWindows(this, fileWindows,
-                                               "Window", "Files");
-@@ -3509,6 +3689,60 @@
-         }
-     }
- 
-+    JInternalFrame getFrameForUrl( URL url )
-+    { 
-+        JInternalFrame[] frames = desk.getAllFrames();
-+        for (int i = 0; i < frames.length; i++) {
-+           FileWindow w = (FileWindow)frames[i];
-+           if ( url.toString().equals( w.getUrl() ) ) {
-+               return w;
-+               }
-+           }
-+        return null; 
-+    } 
-+    public void highlighLineInSelectedWindow(URL url, int lineNum ){
-+        //FileWindow w = (FileWindow)getFrameForUrl( url );
-+        FileWindow w = (FileWindow)getSelectedFrame();
-+        if (w != null)
-+        {
-+            if ( lineNum > -1 )
-+                swingInvoke(new SetFilePosition(this, w, lineNum ) );
-+        }
-+    }
-+    public Object  runSelectedWindow( URL scriptUrl ) throws Exception
-+    {
-+        Object result = null;
-+        FileWindow w = (FileWindow)getSelectedFrame();
-+        //FileWindow w = (FileWindow)getFrameForUrl( scriptUrl );
-+        w.toFront();
-+        if (w != null)
-+        {
-+            Scriptable scope = w.db.getScope();
-+            if (scope == null) 
-+            {
-+                MessageDialogWrapper.showMessageDialog(w.db, "Can't load 
scripts: no scope available", "Run", JOptionPane.ERROR_MESSAGE);
-+                result =  null;
-+            } 
-+            else 
-+            {
-+                String url = w.getUrl();
-+                Thread executorThread = null;
-+                if (url != null) 
-+                {
-+                    LoadFile executor = new  LoadFile(w.db,scope, url, new 
StringReader(w.textArea.getText()), true );
-+                    executor.run(); 
-+                    result = executor.result;  
-+                    if ( executor.exception != null )
-+                    {
-+                        throw executor.exception;
-+                    }
-+                }
-+            }
-+        }
-+        return result;
-+
-+    }
-+
-     //
-     // public interface
-     //
-@@ -3604,6 +3838,69 @@
-         return console.getErr();
-     }
- 
-+    public void openFile(URL scriptUrl, Scriptable scope, Runnable 
closeCallback ) {
-+        if (scope == null) {
-+            MessageDialogWrapper.showMessageDialog(this,
-+                "Can't compile scripts: no scope available",
-+                "Open", JOptionPane.ERROR_MESSAGE);
-+        } else {
-+            if (scriptUrl != null) {
-+                try
-+                {
-+                    InputStreamReader reader = new 
InputStreamReader(scriptUrl.openStream()); 
-+                    String fileName = null;
-+                    if ( scriptUrl.getProtocol().startsWith("vnd.sun.star.") )
-+                    {
-+                        fileName = scriptUrl.toString();
-+                    }
-+                    else
-+                    {
-+                        fileName = scriptUrl.getPath();
-+                    }
-+                    officeScripts.addScript( fileName, scriptUrl, scope, 
closeCallback  );
-+                    //new Thread(new OpenFile(this, scope, fileName, reader 
)).start();
-+                    swingInvoke( new OpenFile(this, fileName, reader ));
-+                }
-+                catch ( IOException e )
-+                {
-+                    MessageDialogWrapper.showMessageDialog(this,
-+                        "Can't open stream for script: " + e.toString(),
-+                        "Open", JOptionPane.ERROR_MESSAGE);
-+                }
-+            }
-+        }
-+        split1.setDividerLocation(1.0);
-+    }
-+
-+    public void openFile(String fileName) {
-+        Scriptable scope = getScope();
-+        if (scope == null) {
-+            MessageDialogWrapper.showMessageDialog(this,
-+                "Can't compile scripts: no scope available",
-+                "Open", JOptionPane.ERROR_MESSAGE);
-+        } else {
-+            if (fileName != null) {
-+                new Thread(new OpenFile(this, fileName)).start();
-+            }
-+        }
-+        split1.setDividerLocation(1.0);
-+    }
-+
-+    public void openStream(InputStream in) {
-+        Scriptable scope = getScope();
-+        if (scope == null) {
-+            MessageDialogWrapper.showMessageDialog(this,
-+                "Can't compile scripts: no scope available",
-+                "Open", JOptionPane.ERROR_MESSAGE);
-+        } else {
-+            if (in != null) {
-+                new Thread(new OpenFile(this, null, new 
InputStreamReader(in))).start();
-+            }
-+        }
-+        split1.setDividerLocation(1.0);
-+        menubar.setSaveEnabled(false);
-+    }
-+
-     public static void main(String[] args) {
-         try {
-             mainThread = Thread.currentThread();
-@@ -3635,5 +3932,162 @@
-         }
-     }
- 
-+    // patched Office specific interface
-+ 
-+    OfficeScriptInfo officeScripts = new OfficeScriptInfo();
-+
-+    void removeScript( String url )
-+    {
-+        // Remove the FileWindow from list of open sources
-+        fileWindows.remove( url );
-+
-+        // Remove sourceInfo from sourceNames, ensures that
-+        // breakpoints etc are deleted
-+        synchronized (sourceNames) {
-+            sourceNames.remove( url );
-+        }
-+        // Removes scriptItems for the script, ensures that a new open ( from 
openFile )
-+        // will succeed, openFile should open file but fails due to fact that 
-+        synchronized ( scriptItems ) 
-+        {   
-+            Iterator iter = scriptItems.entrySet().iterator();
-+            while ( iter.hasNext() )
-+            {
-+                Map.Entry me = ( Map.Entry )iter.next();
-+                ScriptItem item = (ScriptItem)me.getValue();
-+                SourceInfo si =   item.getSourceInfo();
-+                if ( si.getUrl().equals( url ) )
-+                {
-+                    //match
-+                    scriptItems.remove( me.getKey() );
-+                    break;
-+                }
-+            }
-+        }
-+        officeScripts.deleteScript( url );
-+    }
-+
-+
-+    ScriptItem getScriptItem(DebuggableScript fnOrScript) {
-+        ScriptItem item = (ScriptItem)scriptItems.get(fnOrScript);
-+        if (item == null) {
-+            String url = getNormilizedUrl(fnOrScript);
-+            SourceInfo si = (SourceInfo)sourceNames.get(url);
-+            if (si == null) {
-+                if (!fnOrScript.isGeneratedScript()) {
-+                    // Not eval or Function, try to load it from URL
-+                    String source = null;
-+                    try {
-+                        InputStream is = openSource(url);
-+                        try { source = readSource(is); }
-+                        finally { is.close(); }
-+                    } catch (IOException ex) {
-+                        System.err.println
-+                            ("Failed to load source from "+url+": "+ ex);
-+                    }
-+                    if (source != null) {
-+                        si = registerSource(url, source);
-+                    }
-+                }
-+            }
-+            if (si != null) {
-+                item = registerScript(si, fnOrScript);
-+            }
-+        }
-+        
-+        return item;
-+    }
-+
-+    public void showScriptWindow(URL url ){
-+        String key = url.getPath();
-+        if ( url.getProtocol().startsWith("vnd.sun.star") )
-+        {
-+            key = url.toString();
-+        }
-+        FileWindow w = (FileWindow)getFileWindow( key );
-+        if ( w != null )
-+        {
-+            //w.maximize();
-+            desk.getDesktopManager().deiconifyFrame(w);
-+            desk.getDesktopManager().activateFrame(w);
-+            w.show();
-+            w.toFront();
-+        }
-+    }
-+
-+    public void highlighLineInScriptWindow(URL url, int lineNum ){
-+        String key = url.getPath();
-+        if ( url.getProtocol().startsWith("vnd.sun.star") )
-+        {
-+            key = url.getPath();
-+        }
-+        FileWindow w = (FileWindow)getFileWindow( key );
-+        if (w != null)
-+        {
-+            if ( lineNum > -1 )
-+                swingInvoke(new SetFilePosition(this, w, lineNum ) );
-+        }
-+    }
-+    public Object runScriptWindow( URL scriptUrl ) throws Exception
-+    {
-+        String key = scriptUrl.getPath();
-+        if ( scriptUrl.getProtocol().startsWith("vnd.sun.star") )
-+        {
-+            key = scriptUrl.toString();
-+        }
-+        FileWindow w = (FileWindow)getFileWindow( key );
-+        Object result = null;
-+        w.toFront();
-+        if (w != null)
-+        {
-+            //Scriptable scope = w.db.getScope();
-+            Scriptable scope = w.db.officeScripts.getScriptScope( key );
-+            if (scope == null) 
-+            {
-+                MessageDialogWrapper.showMessageDialog(w.db, "Can't load 
scripts: no scope available", "Run", JOptionPane.ERROR_MESSAGE);
-+                result =  null;
-+            } 
-+            else 
-+            {
-+                String url = w.getUrl();
-+                Thread executorThread = null;
-+                if (url != null) 
-+                {
-+                    LoadFile executor = new  LoadFile(w.db,scope, url, new 
StringReader(w.textArea.getText()), true );
-+                    executor.run(); 
-+                    result = executor.result;  
-+                    if ( executor.exception != null )
-+                    {
-+                        throw executor.exception;
-+                    }
-+                }
-+            }
-+        }
-+        return result;
-+
-+    }
-+
-+    public boolean isModified( URL url ) 
-+    {
-+        String key = url.getPath();
-+        if ( url.getProtocol().startsWith("vnd.sun.star") )
-+        {
-+            key = url.toString();
-+        }
-+        FileWindow w = (FileWindow)getFileWindow( key );
-+        return w.isModified();
-+    }
-+
-+    public String getText( URL url )
-+    {
-+        String key = url.toString();
-+        if ( url.getProtocol().startsWith("vnd.sun.star") )
-+        {
-+            key = url.toString();
-+        }
-+        FileWindow w = (FileWindow)getFileWindow( key );
-+        return w.getText();
-+    }
-+
- }
- 
---- 
misc/rhino1_5R5/toolsrc/org/mozilla/javascript/tools/shell/JavaPolicySecurity.java
 Thu Mar 25 21:54:34 2004
-+++ 
misc/build/rhino1_5R5/toolsrc/org/mozilla/javascript/tools/shell/JavaPolicySecurity.java
   Fri Mar 28 17:24:23 2008
-@@ -36,6 +36,7 @@
- package org.mozilla.javascript.tools.shell;
- 
- import java.security.*;
-+import java.security.cert.Certificate;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.Hashtable;
-@@ -124,7 +125,7 @@
- 
-     public JavaPolicySecurity() {
-         // To trigger error on jdk-1.1 with lazy load
--        new CodeSource(null, null);
-+        new CodeSource(null, (Certificate [])null);
-     }
- 
-     protected void callProcessFileSecure(final Context cx,
-@@ -167,7 +168,7 @@
-     }
- 
-     private ProtectionDomain getUrlDomain(URL url) {
--        CodeSource cs = new CodeSource(url, null);
-+        CodeSource cs = new CodeSource(url, (Certificate [])null);
-         PermissionCollection pc = Policy.getPolicy().getPermissions(cs);
-         return new ProtectionDomain(cs, pc);
-     }
diff --git a/scripting/Jar_ScriptProviderForJavaScript.mk 
b/scripting/Jar_ScriptProviderForJavaScript.mk
index 0366016bb7a5..fe05ef28e7f8 100644
--- a/scripting/Jar_ScriptProviderForJavaScript.mk
+++ b/scripting/Jar_ScriptProviderForJavaScript.mk
@@ -25,13 +25,7 @@ $(eval $(call 
gb_Jar_set_componentfile,ScriptProviderForJavaScript,scripting/jav
 $(eval $(call gb_Jar_set_packageroot,ScriptProviderForJavaScript,com))
 
 $(eval $(call gb_Jar_add_sourcefiles,ScriptProviderForJavaScript,\
-       
scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript
 \
        
scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript
 \
 ))
 
-$(eval $(call gb_Jar_add_packagefile,ScriptProviderForJavaScript,\
-       com/sun/star/script/framework/provider/javascript/template.js,\
-               
$(SRCDIR)/scripting/java/com/sun/star/script/framework/provider/javascript/template.js
 \
-))
-
 # vim: set noet sw=4 ts=4:
diff --git 
a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java
 
b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java
deleted file mode 100644
index 1f0e8fd72a16..000000000000
--- 
a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.script.framework.provider.javascript;
-
-import com.sun.star.script.framework.container.ScriptMetaData;
-import com.sun.star.script.framework.log.LogUtils;
-import com.sun.star.script.framework.provider.ScriptEditorBase;
-import com.sun.star.script.framework.provider.SwingInvocation;
-import com.sun.star.script.provider.XScriptContext;
-
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.mozilla.javascript.Context;
-import org.mozilla.javascript.ImporterTopLevel;
-import org.mozilla.javascript.Scriptable;
-import org.mozilla.javascript.tools.debugger.Main;
-import org.mozilla.javascript.tools.debugger.ScopeProvider;
-
-public class ScriptEditorForJavaScript extends ScriptEditorBase {
-
-    // global ScriptEditorForJavaScript instance
-    private static ScriptEditorForJavaScript theScriptEditorForJavaScript;
-
-    // template for JavaScript scripts
-    private static String JSTEMPLATE;
-
-    private static Main rhinoWindow;
-    private URL scriptURL;
-    // global list of ScriptEditors, key is [external form of URL] of file 
being edited
-    private static Map<String, ScriptEditorForJavaScript> BEING_EDITED = new
-    HashMap<String, ScriptEditorForJavaScript>();
-
-    static {
-        JSTEMPLATE = "// JavaScript script";
-        try {
-            URL url = 
ScriptEditorForJavaScript.class.getResource("template.js");
-            if (url != null) {
-                InputStream in = url.openStream();
-                StringBuilder buf = new StringBuilder();
-                byte[] b = new byte[1024];
-                int len;
-
-                while ((len = in.read(b)) != -1) {
-                    buf.append(new String(b, 0, len));
-                }
-
-                in.close();
-
-                JSTEMPLATE = buf.toString();
-            }
-        } catch (IOException ioe) {
-        } catch (Exception e) {
-        }
-    }
-
-    /**
-     *  Returns the global ScriptEditorForJavaScript instance.
-     */
-
-    public static synchronized ScriptEditorForJavaScript getEditor() {
-        if (theScriptEditorForJavaScript == null) {
-            theScriptEditorForJavaScript = new ScriptEditorForJavaScript();
-        }
-
-        return theScriptEditorForJavaScript;
-    }
-
-    /**
-     *  Get the ScriptEditorForJavaScript instance for this URL
-     *
-     * @param  url         The URL of the script source file
-     *
-     * @return             The ScriptEditorForJavaScript associated with
-     *                     the given URL if one exists, otherwise null.
-     */
-    public static ScriptEditorForJavaScript getEditor(URL url) {
-        synchronized (BEING_EDITED) {
-            return BEING_EDITED.get(url.toExternalForm());
-        }
-    }
-
-    /**
-     *  Returns whether or not the script source being edited in this
-     *  ScriptEditorForJavaScript has been modified
-     */
-    public boolean isModified() {
-        return rhinoWindow.isModified(scriptURL);
-    }
-
-    /**
-     *  Returns the text being displayed in this ScriptEditorForJavaScript
-     *
-     *  @return            The text displayed in this ScriptEditorForJavaScript
-     */
-    public String getText() {
-        return rhinoWindow.getText(scriptURL);
-    }
-
-    /**
-     *  Returns the Rhino Debugger url of this ScriptEditorForJavaScript
-     *
-     *  @return            The url of this ScriptEditorForJavaScript
-     */
-    public String getURL() {
-        return scriptURL.toString();
-    }
-
-    /**
-     *  Returns the template text for JavaScript scripts
-     *
-     *  @return            The template text for JavaScript scripts
-     */
-    public String getTemplate() {
-        return JSTEMPLATE;
-    }
-
-    /**
-     *  Returns the default extension for JavaScript scripts
-     *
-     *  @return            The default extension for JavaScript scripts
-     */
-    public String getExtension() {
-        return "js";
-    }
-
-    /**
-     *  Opens an editor window for the specified ScriptMetaData.
-     *  If an editor window is already open for that data it will be
-     *  moved to the front.
-     *
-     * @param  context     The context in which to execute the script
-     * @param  entry       The metadata describing the script
-     */
-    public void edit(final XScriptContext context, ScriptMetaData entry) {
-        try {
-            String sUrl = entry.getParcelLocation();
-
-            if (!sUrl.endsWith("/")) {
-                sUrl += "/";
-            }
-
-            sUrl +=  entry.getLanguageName();
-            final URL url = entry.getSourceURL();
-            SwingInvocation.invoke(
-            new Runnable() {
-                public void run() {
-                    synchronized (BEING_EDITED) {
-                        ScriptEditorForJavaScript editor = 
BEING_EDITED.get(url.toExternalForm());
-
-                        if (editor == null) {
-                            editor = new ScriptEditorForJavaScript(context, 
url);
-                            BEING_EDITED.put(url.toExternalForm(), editor);
-                        }
-                    }
-
-                    assert rhinoWindow != null;
-                    rhinoWindow.showScriptWindow(url);
-                    rhinoWindow.toFront();
-                }
-            });
-        } catch (IOException e) {
-            LogUtils.DEBUG("Caught exception: " + e);
-            LogUtils.DEBUG(LogUtils.getTrace(e));
-        }
-    }
-
-    // Ensures that new instances of this class can only be created using
-    // the factory methods
-    private ScriptEditorForJavaScript() {
-    }
-
-    private ScriptEditorForJavaScript(XScriptContext context, URL url) {
-        setContext(context);
-        // Need to check that before showing the window. Checking in execute() 
has no effect.
-        if (!isMacroExecutionEnabled()) {
-            showErrorMessage("Macro Execution has been disabled.");
-            return ;
-        }
-        initUI();
-        Scriptable scope = getScope(context);
-        rhinoWindow.openFile(url, scope, new CloseHandler(url));
-        this.scriptURL = url;
-    }
-
-    /**
-     *  Executes the script edited by the editor
-     *
-     */
-
-    public Object execute() throws Exception {
-        rhinoWindow.toFront();
-
-        return rhinoWindow.runScriptWindow(scriptURL);
-    }
-
-    /**
-     *  Indicates the line where error occurred
-     *
-     */
-    public void indicateErrorLine(int lineNum) {
-        rhinoWindow.toFront();
-        rhinoWindow.highlighLineInScriptWindow(scriptURL, lineNum);
-    }
-    // This code is based on the main method of the Rhino Debugger Main class
-    // We pass in the XScriptContext in the global scope for script execution
-    private void initUI() {
-        try {
-            synchronized (ScriptEditorForJavaScript.class) {
-                if (rhinoWindow != null) {
-                    return;
-                }
-
-                final Main sdb = new Main("Rhino JavaScript Debugger");
-                sdb.pack();
-                sdb.setSize(640, 640);
-                sdb.setVisible(true);
-                sdb.setExitAction(new Runnable() {
-                    public void run() {
-                        sdb.clearAllBreakpoints();
-                        sdb.dispose();
-                        shutdown();
-                    }
-                });
-                Context.addContextListener(sdb);
-                sdb.setScopeProvider(new ScopeProvider() {
-                    @Override
-                    public Scriptable getScope() {
-                        return 
org.mozilla.javascript.tools.shell.Main.getScope();
-                    }
-                });
-                sdb.addWindowListener(new WindowAdapter() {
-                    @Override
-                    public void windowClosing(WindowEvent e) {
-                        shutdown();
-                    }
-                });
-                rhinoWindow = sdb;
-            }
-        } catch (Exception exc) {
-            LogUtils.DEBUG(LogUtils.getTrace(exc));
-        }
-    }
-
-    private void shutdown() {
-        // dereference Rhino Debugger window
-        rhinoWindow = null;
-        this.scriptURL = null;
-
-        // remove all scripts from BEING_EDITED
-        synchronized (BEING_EDITED) {
-            java.util.Iterator<String> iter = BEING_EDITED.keySet().iterator();
-            java.util.ArrayList<String> keysToRemove = new 
java.util.ArrayList<String>();
-
-            while (iter.hasNext()) {
-                String key = iter.next();
-                keysToRemove.add(key);
-            }
-
-            for (int i = 0; i < keysToRemove.size(); i++) {
-                BEING_EDITED.remove(keysToRemove.get(i));
-            }
-
-            keysToRemove = null;
-        }
-
-    }
-    private Scriptable getScope(XScriptContext xsctxt) {
-        Context ctxt = Context.enter();
-        ImporterTopLevel scope = new ImporterTopLevel(ctxt);
-
-        Scriptable jsCtxt = Context.toObject(xsctxt, scope);
-        scope.put("XSCRIPTCONTEXT", scope, jsCtxt);
-
-        Scriptable jsArgs = Context.toObject(new Object[0], scope);
-        scope.put("ARGUMENTS", scope, jsArgs);
-
-        Context.exit();
-        return scope;
-    }
-
-    private static class CloseHandler implements Runnable {
-
-        private final URL url;
-
-        private CloseHandler(URL url) {
-            this.url = url;
-        }
-
-        public void run() {
-            synchronized (BEING_EDITED) {
-                BEING_EDITED.remove(this.url.toExternalForm());
-            }
-        }
-    }
-}
diff --git 
a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
 
b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
index 9465a646f64d..2572ce0ee55e 100644
--- 
a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
+++ 
b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
@@ -44,8 +44,6 @@ import com.sun.star.script.provider.XScript;
 
 import com.sun.star.uno.XComponentContext;
 
-import java.net.URL;
-
 import org.mozilla.javascript.Context;
 import org.mozilla.javascript.ImporterTopLevel;
 import org.mozilla.javascript.JavaScriptException;
@@ -78,12 +76,12 @@ public class ScriptProviderForJavaScript {
 
         @Override
         public boolean hasScriptEditor() {
-            return true;
+            return false;
         }
 
         @Override
         public ScriptEditor getScriptEditor() {
-            return ScriptEditorForJavaScript.getEditor();
+            return null;
         }
     }
 
@@ -198,31 +196,10 @@ class ScriptImpl implements XScript {
         try {
             Object result = null;
 
-            ScriptEditorForJavaScript editor =
-                ScriptEditorForJavaScript.getEditor(metaData.getSourceURL());
-
-            if (editor != null) {
-                result = editor.execute();
-
-                if (result != null  &&
-                    
result.getClass().getName().equals("org.mozilla.javascript.Undefined")) {
-                    // Always return a string
-                    // TODO revisit
-                    return Context.toString(result);
-                }
-
-            }
-
             String source;
 
-            if (editor != null && editor.isModified()) {
-                LogUtils.DEBUG("GOT A MODIFIED SOURCE");
-                source = editor.getText();
-            } else {
-                metaData.loadSource();
-                source =  metaData.getSource();
-
-            }
+            metaData.loadSource();
+            source =  metaData.getSource();
 
             if (source == null || source.length() == 0) {
                 throw new ScriptFrameworkErrorException(
@@ -285,7 +262,6 @@ class ScriptImpl implements XScript {
             LogUtils.DEBUG("    lineNum  " + se.lineNum);
             LogUtils.DEBUG("    language  " + se.language);
             LogUtils.DEBUG("    scriptName  " + se.scriptName);
-            raiseEditor(se.lineNum);
             throw new InvocationTargetException(
                 "JavaScript uncaught exception" + metaData.getLanguageName(), 
null, se);
         } catch (Exception ex) {
@@ -300,31 +276,4 @@ class ScriptImpl implements XScript {
             }
         }
     }
-
-    private void raiseEditor(int lineNum) {
-        try {
-            URL sourceUrl = metaData.getSourceURL();
-
-            ScriptEditorForJavaScript editor =
-                ScriptEditorForJavaScript.getEditor(sourceUrl);
-
-            if (editor == null) {
-                editor = ScriptEditorForJavaScript.getEditor();
-
-                editor.edit(
-                    ScriptContext.createContext(m_xModel, m_xInvocContext,
-                                                m_xContext, 
m_xMultiComponentFactory),
-                    metaData);
-
-                editor = ScriptEditorForJavaScript.getEditor(sourceUrl);
-            }
-
-            if (editor != null) {
-                System.out.println("** Have raised IDE for JavaScript, calling 
indicateErrorLine for line "
-                                   + lineNum);
-                editor.indicateErrorLine(lineNum);
-            }
-        } catch (java.net.MalformedURLException ignore) {
-        }
-    }
 }
diff --git 
a/scripting/java/com/sun/star/script/framework/provider/javascript/template.js 
b/scripting/java/com/sun/star/script/framework/provider/javascript/template.js
deleted file mode 100644
index 939ba339cd7c..000000000000
--- 
a/scripting/java/com/sun/star/script/framework/provider/javascript/template.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-// Hello World in JavaScript
-// Import standard OpenOffice.org API classes. For more information on
-// these classes and the OpenOffice.org API, see the OpenOffice.org
-// Developers Guide at:
-// https://api.libreoffice.org/
-
-importClass(Packages.com.sun.star.uno.UnoRuntime);
-importClass(Packages.com.sun.star.text.XTextDocument);
-importClass(Packages.com.sun.star.text.XText);
-importClass(Packages.com.sun.star.text.XTextRange);
-importClass(Packages.com.sun.star.frame.XModel);
-
-// Import XScriptContext class. An instance of this class is available
-// to all JavaScript scripts in the global variable "XSCRIPTCONTEXT". This
-// variable can be used to access the document for which this script
-// was invoked.
-
-// Methods available are:
-
-//   XSCRIPTCONTEXT.getDocument() returns XModel
-//   XSCRIPTCONTEXT.getInvocationContext() returns XScriptInvocationContext or 
NULL
-//   XSCRIPTCONTEXT.getDesktop() returns XDesktop
-//   XSCRIPTCONTEXT.getComponentContext() returns XComponentContext
-
-// For more information on using this class see the scripting
-// developer guides at:
-
-//   
https://api.libreoffice.org/docs/DevelopersGuide/ScriptingFramework/ScriptingFramework.xhtml
-
-
-oDoc = UnoRuntime.queryInterface(XModel,XSCRIPTCONTEXT.getInvocationContext());
-if ( !oDoc )
-  oDoc = XSCRIPTCONTEXT.getDocument();
-xTextDoc = UnoRuntime.queryInterface(XTextDocument,oDoc);
-xText = xTextDoc.getText();
-xTextRange = xText.getEnd();
-xTextRange.setString( "Hello World (in JavaScript)" );

Reply via email to