netbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lkisha...@apache.org
Subject [incubator-netbeans] branch master updated: Merging FixingProxies onto master
Date Thu, 13 Dec 2018 20:11:01 GMT
This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 3714655  Merging FixingProxies onto master
3714655 is described below

commit 371465581f2011828b13ef59af6b89bcd4ada317
Author: Jaroslav Tulach <jaroslav.tulach@oracle.com>
AuthorDate: Thu Dec 13 11:14:04 2018 -0800

    Merging FixingProxies onto master
---
 nbbuild/cluster.properties                         |   1 -
 nbbuild/licenses/MPL-2.0                           | 373 --------------------
 platform/core.network/arch.xml                     |  12 +-
 platform/core.network/nbproject/project.xml        |   9 -
 .../core/network/proxy/ProxyAutoConfig.java        |   2 +
 .../proxy/pac/datetime/PacUtilsDateTime.java       |  13 +-
 .../proxy/pac/impl/ClassFilterPacHelpers.java      |  42 +++
 .../proxy/pac/impl/HelperScriptFactory.java        |  31 +-
 .../proxy/pac/impl/NbPacScriptEvaluator.java       | 324 +++++++++++-------
 .../test/unit/data/pacFiles/pac-test5.js           |  34 ++
 .../test/unit/data/pacFiles/wpad space.dat         |  22 ++
 .../network/proxy/ProxyAutoConfigDirectTest.java   |  71 ++++
 .../core/network/proxy/ProxyAutoConfigTest.java    |  15 +-
 .../core/network/proxy/pac/PacEngineTest.java      |  23 --
 platform/libs.rhino/build.xml                      |  24 --
 platform/libs.rhino/external/binaries-list         |  17 -
 .../libs.rhino/external/rhino-1.7.10-license.txt   | 380 ---------------------
 platform/libs.rhino/manifest.mf                    |   4 -
 platform/libs.rhino/nbproject/project.properties   |  21 --
 platform/libs.rhino/nbproject/project.xml          |  39 ---
 .../src/org/netbeans/libs/rhino/Bundle.properties  |  22 --
 .../src/org/netbeans/core/GuiRunLevel.java         |  18 +-
 .../src/org/netbeans/core/NbLifecycleManager.java  |  21 ++
 23 files changed, 433 insertions(+), 1085 deletions(-)

diff --git a/nbbuild/cluster.properties b/nbbuild/cluster.properties
index d5c8bf8..160e5fd 100644
--- a/nbbuild/cluster.properties
+++ b/nbbuild/cluster.properties
@@ -230,7 +230,6 @@ nb.cluster.platform=\
         libs.junit4,\
         libs.junit5,\
         libs.osgi,\
-        libs.rhino,\
         libs.testng,\
         masterfs,\
         masterfs.linux,\
diff --git a/nbbuild/licenses/MPL-2.0 b/nbbuild/licenses/MPL-2.0
deleted file mode 100644
index a612ad9..0000000
--- a/nbbuild/licenses/MPL-2.0
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
-    means each individual or legal entity that creates, contributes to
-    the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
-    means the combination of the Contributions of others (if any) used
-    by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
-    means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
-    means Source Code Form to which the initial Contributor has attached
-    the notice in Exhibit A, the Executable Form of such Source Code
-    Form, and Modifications of such Source Code Form, in each case
-    including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
-    means
-
-    (a) that the initial Contributor has attached the notice described
-        in Exhibit B to the Covered Software; or
-
-    (b) that the Covered Software was made available under the terms of
-        version 1.1 or earlier of the License, but not also under the
-        terms of a Secondary License.
-
-1.6. "Executable Form"
-    means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
-    means a work that combines Covered Software with other material, in
-    a separate file or files, that is not Covered Software.
-
-1.8. "License"
-    means this document.
-
-1.9. "Licensable"
-    means having the right to grant, to the maximum extent possible,
-    whether at the time of the initial grant or subsequently, any and
-    all of the rights conveyed by this License.
-
-1.10. "Modifications"
-    means any of the following:
-
-    (a) any file in Source Code Form that results from an addition to,
-        deletion from, or modification of the contents of Covered
-        Software; or
-
-    (b) any new file in Source Code Form that contains any Covered
-        Software.
-
-1.11. "Patent Claims" of a Contributor
-    means any patent claim(s), including without limitation, method,
-    process, and apparatus claims, in any patent Licensable by such
-    Contributor that would be infringed, but for the grant of the
-    License, by the making, using, selling, offering for sale, having
-    made, import, or transfer of either its Contributions or its
-    Contributor Version.
-
-1.12. "Secondary License"
-    means either the GNU General Public License, Version 2.0, the GNU
-    Lesser General Public License, Version 2.1, the GNU Affero General
-    Public License, Version 3.0, or any later versions of those
-    licenses.
-
-1.13. "Source Code Form"
-    means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
-    means an individual or a legal entity exercising rights under this
-    License. For legal entities, "You" includes any entity that
-    controls, is controlled by, or is under common control with You. For
-    purposes of this definition, "control" means (a) the power, direct
-    or indirect, to cause the direction or management of such entity,
-    whether by contract or otherwise, or (b) ownership of more than
-    fifty percent (50%) of the outstanding shares or beneficial
-    ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
-    Licensable by such Contributor to use, reproduce, make available,
-    modify, display, perform, distribute, and otherwise exploit its
-    Contributions, either on an unmodified basis, with Modifications, or
-    as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
-    for sale, have made, import, and otherwise transfer either its
-    Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
-    or
-
-(b) for infringements caused by: (i) Your and any other third party's
-    modifications of Covered Software, or (ii) the combination of its
-    Contributions with other software (except as part of its Contributor
-    Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
-    its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
-    Form, as described in Section 3.1, and You must inform recipients of
-    the Executable Form how they can obtain a copy of such Source Code
-    Form by reasonable means in a timely manner, at a charge no more
-    than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
-    License, or sublicense it under different terms, provided that the
-    license for the Executable Form does not attempt to limit or alter
-    the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-*                                                                      *
-*  6. Disclaimer of Warranty                                           *
-*  -------------------------                                           *
-*                                                                      *
-*  Covered Software is provided under this License on an "as is"       *
-*  basis, without warranty of any kind, either expressed, implied, or  *
-*  statutory, including, without limitation, warranties that the       *
-*  Covered Software is free of defects, merchantable, fit for a        *
-*  particular purpose or non-infringing. The entire risk as to the     *
-*  quality and performance of the Covered Software is with You.        *
-*  Should any Covered Software prove defective in any respect, You     *
-*  (not any Contributor) assume the cost of any necessary servicing,   *
-*  repair, or correction. This disclaimer of warranty constitutes an   *
-*  essential part of this License. No use of any Covered Software is   *
-*  authorized under this License except under this disclaimer.         *
-*                                                                      *
-************************************************************************
-
-************************************************************************
-*                                                                      *
-*  7. Limitation of Liability                                          *
-*  --------------------------                                          *
-*                                                                      *
-*  Under no circumstances and under no legal theory, whether tort      *
-*  (including negligence), contract, or otherwise, shall any           *
-*  Contributor, or anyone who distributes Covered Software as          *
-*  permitted above, be liable to You for any direct, indirect,         *
-*  special, incidental, or consequential damages of any character      *
-*  including, without limitation, damages for lost profits, loss of    *
-*  goodwill, work stoppage, computer failure or malfunction, or any    *
-*  and all other commercial damages or losses, even if such party      *
-*  shall have been informed of the possibility of such damages. This   *
-*  limitation of liability shall not apply to liability for death or   *
-*  personal injury resulting from such party's negligence to the       *
-*  extent applicable law prohibits such limitation. Some               *
-*  jurisdictions do not allow the exclusion or limitation of           *
-*  incidental or consequential damages, so this exclusion and          *
-*  limitation may not apply to You.                                    *
-*                                                                      *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
-  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/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
-  This Source Code Form is "Incompatible With Secondary Licenses", as
-  defined by the Mozilla Public License, v. 2.0.
diff --git a/platform/core.network/arch.xml b/platform/core.network/arch.xml
index 2f0d5c5..59da865 100644
--- a/platform/core.network/arch.xml
+++ b/platform/core.network/arch.xml
@@ -104,7 +104,9 @@
       which clients are supposed to download and execute in order to find 
       out which proxy to use. This is known as <a href="https://en.wikipedia.org/wiki/Proxy_auto-config">Proxy Auto-Config</a>
       (or PAC). This module provides a pluggable PAC evaluation environment
-      based on Rhino. Execution of the downloaded JavaScript code is sandboxed.
+      based on Nashorn. However, it will gracefully degrade to any other JavaScript
+      which may be installed in the JVM. Execution of the downloaded
+      JavaScript code is sandboxed. (only true for Nashorn)
   </p>
   <p>
       If you don't like the PAC evaluation environment provided
@@ -731,6 +733,14 @@
 -->
  <answer id="exec-reflection">
   <p>
+   Yes. It detects the presence of Nashorn (as opposed to say Rhino) by way 
+      of reflection. In particular it needs to know if the Java version is
+      Java 8u40 as Nashorn was greatly enhanced in that update and was more
+      or less useless (for our purpose) before this time. The use of reflection
+      means the code will gracefully 'degrade' to whatever script engine is
+      available if we are not on Java 8u40 or later.
+  </p>
+  <p>
    For testing only a dirty hack is used in our <code>FakeDns</code> class.
    This installs itself as a preferred name service in Java. This is done
    via reflection. It also uses proprietary <code>sun.*</code> package.
diff --git a/platform/core.network/nbproject/project.xml b/platform/core.network/nbproject/project.xml
index 57af864..0fe2742 100644
--- a/platform/core.network/nbproject/project.xml
+++ b/platform/core.network/nbproject/project.xml
@@ -62,15 +62,6 @@
                     </run-dependency>
                 </dependency>
                 <dependency>
-                    <code-name-base>org.netbeans.libs.rhino</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <release-version>1</release-version>
-                        <specification-version>1.7.10</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
                     <code-name-base>org.netbeans.modules.keyring</code-name-base>
                     <build-prerequisite/>
                     <compile-dependency/>
diff --git a/platform/core.network/src/org/netbeans/core/network/proxy/ProxyAutoConfig.java b/platform/core.network/src/org/netbeans/core/network/proxy/ProxyAutoConfig.java
index 629dd91..5825235 100644
--- a/platform/core.network/src/org/netbeans/core/network/proxy/ProxyAutoConfig.java
+++ b/platform/core.network/src/org/netbeans/core/network/proxy/ProxyAutoConfig.java
@@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import org.netbeans.core.NbLifecycleManager;
 import org.netbeans.core.network.proxy.pac.PacParsingException;
 import org.netbeans.core.network.proxy.pac.PacScriptEvaluator;
 import org.netbeans.core.network.proxy.pac.PacScriptEvaluatorFactory;
@@ -77,6 +78,7 @@ public class ProxyAutoConfig {
 
             @Override
             public void run() {
+                NbLifecycleManager.advancePolicy();
                 initEngine();
             }
         });
diff --git a/platform/core.network/src/org/netbeans/core/network/proxy/pac/datetime/PacUtilsDateTime.java b/platform/core.network/src/org/netbeans/core/network/proxy/pac/datetime/PacUtilsDateTime.java
index 4d224ad..e08d2ce 100644
--- a/platform/core.network/src/org/netbeans/core/network/proxy/pac/datetime/PacUtilsDateTime.java
+++ b/platform/core.network/src/org/netbeans/core/network/proxy/pac/datetime/PacUtilsDateTime.java
@@ -260,7 +260,7 @@ public class PacUtilsDateTime {
     
     
     private static int getInteger(Object obj) throws PacDateTimeInputException {
-        if (obj instanceof Number) {
+        if (obj instanceof Integer || obj instanceof Long) {
             return ((Number) obj).intValue();
         }
         if (obj instanceof String) {
@@ -320,9 +320,8 @@ public class PacUtilsDateTime {
      * {@link PacHelperMethodsNetscape#weekdayRange(java.lang.Object...) weekdayRange()}
      * 
      * <p>
-     * Note: In Rhino, JavaScript function arguments that are not used in the
-     * call will have a type of {@code java.lang.String} and the value will be
-     * 'undefined'.
+     * Note: In Nashorn, JavaScript function arguments that are not used in the
+     * call will have a type of {@code Undefined}.
      *
      * @param objs
      * @return 
@@ -338,8 +337,7 @@ public class PacUtilsDateTime {
             }
             // Only parameters of type CharSequence (String) and 
             // Number (Integer, Long, etc) are relevant.
-            // Rhino converts javascript undefined to the string "undefined"
-            if ((obj instanceof Number) || (obj instanceof CharSequence && (! "undefined".equals(obj)))) {
+            if ((obj instanceof Number) || (obj instanceof CharSequence)) {
                 params++;
             }
         }
@@ -353,9 +351,6 @@ public class PacUtilsDateTime {
      */
     public static boolean usesGMT(Object... args) {
         int params = getNoOfParams(args);
-        if(params == 0) {
-            return false;
-        }
         if (args[params - 1] instanceof CharSequence) {
             String p = args[params - 1].toString();
             if (p.equals("GMT")) {
diff --git a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/ClassFilterPacHelpers.java b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/ClassFilterPacHelpers.java
new file mode 100644
index 0000000..7c5a742
--- /dev/null
+++ b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/ClassFilterPacHelpers.java
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.core.network.proxy.pac.impl;
+
+import jdk.nashorn.api.scripting.ClassFilter;
+import org.netbeans.core.network.proxy.pac.PacHelperMethods;
+
+/**
+ * Nashorn class filter which helps us create a sandboxed JavaScript execution
+ * environment which only has access to the Helper methods, nothing more.
+ * 
+ * <p>Note that the ClassFilter feature is specific to Nashorn (Rhino had the
+ * {@code ClassShutter} class for this purpose), but the feature did not appear 
+ * until Java 8u40.
+ * 
+ * @author lbruun
+ */
+class ClassFilterPacHelpers implements ClassFilter {
+
+    @Override
+    public boolean exposeToScripts(String string) {
+        // The only Java class the PAC script is allowed to
+        // make use of is the PAC Helpers, nothing more. 
+        return string.equals(PacHelperMethods.class.getName());
+    }
+}
diff --git a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/HelperScriptFactory.java b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/HelperScriptFactory.java
index 6648093..e10bb04 100644
--- a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/HelperScriptFactory.java
+++ b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/HelperScriptFactory.java
@@ -63,31 +63,27 @@ class HelperScriptFactory {
     /**
      * Gets JavaScript source with PAC Helper function declarations.
      * 
-     * @param bridgeObjectName name of Java object which contains Java methods, 
-     *   named similarly to the JavaScript PAC helper functions and with 
-     *   similar arg list. This Java object acts as the bridge between the 
-     *   JavaScript world and the Java world and must be an instance 
-     *   of {@link org.netbeans.network.proxy.pac.PacHelperMethods PacHelperMethods}.
-     * 
-     * @return JavaScript source code
+     * @return JavaScript source code that returns a function that delegates
+     *   to its first argument
      */
-    public static String getPacHelperSource(String bridgeObjectName) {
+    public static String getPacHelperSource() {
         StringBuilder sb = new StringBuilder(2000);
-        addFunctionDecls(sb, JS_HELPER_FUNCTIONS_NS, bridgeObjectName);
-        addFunctionDecls(sb, JS_HELPER_FUNCTIONS_MS, bridgeObjectName);
-        addFunctionDecls(sb, JS_HELPER_FUNCTIONS_DEBUG, bridgeObjectName);
+        sb.append("(function(self) {\n");
+        addFunctionDecls(sb, JS_HELPER_FUNCTIONS_NS);
+        addFunctionDecls(sb, JS_HELPER_FUNCTIONS_MS);
+        addFunctionDecls(sb, JS_HELPER_FUNCTIONS_DEBUG);
+        sb.append("})\n");
         return sb.toString();
     }
     
     
-    private static void addFunctionDecls(StringBuilder sb, JsHelperFunction[] jsHelperFunctions, String bridgeObjectName) {
+    private static void addFunctionDecls(StringBuilder sb, JsHelperFunction[] jsHelperFunctions) {
         for (JsHelperFunction f : jsHelperFunctions) {
-            sb.append("function ");
+            sb.append("this['");
             sb.append(f.functionName);
-            sb.append('(');
+            sb.append("'] = function(");
             addArgList(sb, f.argList);
-            sb.append(") {");
-            sb.append('\n');
+            sb.append(") {\n");
             sb.append("    return ");
             boolean encloseReturnValue = false;
             if (Number.class.isAssignableFrom(f.getClass())) {
@@ -98,8 +94,7 @@ class HelperScriptFactory {
                 encloseReturnValue = true;
                 sb.append("String(");
             }
-            sb.append(bridgeObjectName);
-            sb.append('.');
+            sb.append("self.");
             sb.append(f.functionName);
             sb.append('(');
             addArgList(sb, f.argList);
diff --git a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java
index 334d982..8b7f384 100644
--- a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java
+++ b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java
@@ -21,6 +21,7 @@ package org.netbeans.core.network.proxy.pac.impl;
 import java.net.InetSocketAddress;
 import java.net.Proxy;
 import java.net.URI;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
@@ -29,19 +30,19 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import org.mozilla.javascript.ClassShutter;
-import org.mozilla.javascript.Context;
-import org.mozilla.javascript.ContextFactory;
-import org.mozilla.javascript.EvaluatorException;
-import org.mozilla.javascript.Function;
-import org.mozilla.javascript.RhinoException;
-import org.mozilla.javascript.Scriptable;
-import org.mozilla.javascript.ScriptableObject;
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import org.netbeans.core.network.utils.SimpleObjCache;
 import org.netbeans.core.network.proxy.pac.PacHelperMethods;
 import org.netbeans.core.network.proxy.pac.PacJsEntryFunction;
 import org.netbeans.core.network.proxy.pac.PacValidationException;
 import org.netbeans.core.network.proxy.pac.PacParsingException;
+import org.openide.util.Exceptions;
 import org.netbeans.core.network.proxy.pac.PacScriptEvaluator;
 import org.netbeans.core.network.proxy.pac.PacUtils;
 import org.openide.util.Lookup;
@@ -177,27 +178,12 @@ import org.openide.util.Lookup;
 public class NbPacScriptEvaluator implements PacScriptEvaluator {
 
     private static final Logger LOGGER = Logger.getLogger(NbPacScriptEvaluator.class.getName());
-    // The execution limits are in place as a last resort. In general it is
-    // expected, that a PAC comes from a trusted source
-    private static final SandboxedContextFactory SANDBOXED_CONTEXT_FACTORY = new SandboxedContextFactory(
-            100_000,
-            5 * 1000,
-            new ClassShutter() {
-                @Override
-                public boolean visibleToScripts(String string) {
-                    return "org.netbeans.core.network.proxy.pac.impl.NbPacHelperMethods".equals(string)
-                            || "java.lang.String".equals(string);
-                }
-            }
-    );
 
-    private static final String JS_HELPER_METHODS_INSTANCE_NAME = "jsPacHelpers";
-    
+
     private final boolean canUseURLCaching;
-    private final Scriptable scriptEngine;
+    private final PacScriptEngine scriptEngine;
     private final SimpleObjCache<URI,List<Proxy>> resultCache;
-    private final PacJsEntryFunction entryFunctionInfo;
-    private final Function entryFunction;
+    
     private static final String PAC_PROXY = "PROXY";
     private static final String PAC_DIRECT = "DIRECT";
     private static final String PAC_SOCKS = "SOCKS";
@@ -205,41 +191,20 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
     private static final String PAC_SOCKS5_FFEXT = "SOCKS5"; // Mozilla Firefox extension. Not part of original Netscape spec.
     private static final String PAC_HTTP_FFEXT = "HTTP"; // Mozilla Firefox extension. Not part of original Netscape spec.
     private static final String PAC_HTTPS_FFEXT = "HTTPS"; // Mozilla Firefox extension. Not part of original Netscape spec.
+    private final boolean nashornJava8u40Available;
     private final String pacScriptSource;
 
 
     public NbPacScriptEvaluator(String pacSourceCocde) throws PacParsingException {
         this.pacScriptSource = pacSourceCocde;
+        nashornJava8u40Available = getNashornJava8u40Available();
+        scriptEngine = getScriptEngine(pacSourceCocde);
         canUseURLCaching = !usesTimeDateFunctions(pacSourceCocde);
         if (canUseURLCaching) {
             resultCache = new SimpleObjCache<>(100);
         } else {
             resultCache = null;
         }
-        Context cx = SANDBOXED_CONTEXT_FACTORY.enterContext();
-        try {
-            String helperJSScript = getHelperJsScriptSource();
-            LOGGER.log(Level.FINER, "PAC Helper JavaScript :\n{0}", helperJSScript);
-
-            scriptEngine = cx.initSafeStandardObjects();
-
-            PacHelperMethods pacHelpers = Lookup.getDefault().lookup(PacHelperMethods.class);
-            if (pacHelpers == null) { // this should be redundant but we take no chances
-                pacHelpers = new NbPacHelperMethods();
-            }
-
-            ScriptableObject.putProperty(scriptEngine, JS_HELPER_METHODS_INSTANCE_NAME, pacHelpers);
-
-            cx.evaluateString(scriptEngine, pacSourceCocde, "PAC Source", 0, null);
-            cx.evaluateString(scriptEngine, helperJSScript, "JS Helper", 0, null);
-
-            entryFunctionInfo = testScriptEngine(scriptEngine, false);
-            entryFunction = (Function) ScriptableObject.getProperty(scriptEngine, entryFunctionInfo.getJsFunctionName());
-        } catch (RhinoException ex) {
-            throw new  PacParsingException(ex);
-        } finally {
-            Context.exit();
-        }
     }
 
     @Override
@@ -254,18 +219,20 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
                 return jsResultAnalyzed;
             }
         }
-
-        Context cx = SANDBOXED_CONTEXT_FACTORY.enterContext();
         try {
-
-            Object jsResult = entryFunction.call(cx, scriptEngine, null, new Object[] {PacUtils.toStrippedURLStr(uri), uri.getHost()});
+            Object jsResult = scriptEngine.findProxyForURL(PacUtils.toStrippedURLStr(uri), uri.getHost()); 
             jsResultAnalyzed = analyzeResult(uri, jsResult);
             if (canUseURLCaching && (resultCache != null)) {
                 resultCache.put(uri, jsResultAnalyzed);   // save the result in the cache
             }
             return jsResultAnalyzed;
-        } catch (RhinoException ex) {
-            LOGGER.log(Level.WARNING, "Error when executing PAC script function " + entryFunctionInfo.getJsFunctionName() + " : ", ex);
+        } catch (NoSuchMethodException ex) {
+            // If this exception occur at this time it is really, really unexpected. 
+            // We already gave the function a test spin in the constructor.
+            Exceptions.printStackTrace(ex);
+            return Collections.singletonList(Proxy.NO_PROXY);
+        } catch (ScriptException ex) {
+            LOGGER.log(Level.WARNING, "Error when executing PAC script function " + scriptEngine.getJsMainFunction().getJsFunctionName() + " : ", ex);
             return Collections.singletonList(Proxy.NO_PROXY);
         } catch (Exception ex) {  // for runtime exceptions
             if (ex.getCause() != null) {
@@ -276,10 +243,8 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
                 }
             }
             // other unforseen errors
-            LOGGER.log(Level.WARNING, "Error when executing PAC script function " + entryFunctionInfo.getJsFunctionName() + " : ", ex);
+            LOGGER.log(Level.WARNING, "Error when executing PAC script function " + scriptEngine.getJsMainFunction().getJsFunctionName() + " : ", ex);
             return Collections.singletonList(Proxy.NO_PROXY);
-        } finally {
-            Context.exit();
         }
     }
 
@@ -290,29 +255,125 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
 
     @Override
     public String getJsEntryFunction() {
-        return entryFunctionInfo.getJsFunctionName();
+        return scriptEngine.getJsMainFunction().getJsFunctionName();
     }
 
     @Override
     public String getEngineInfo() {
-        Context cx = Context.enter();
-        try {
-            return cx.getImplementationVersion();
-        } finally {
-            Context.exit();
-        }
+        ScriptEngineFactory factory = scriptEngine.getScriptEngine().getFactory();
+        return factory.getEngineName() + " version " + factory.getEngineVersion();
     }
 
     @Override
     public String getPacScriptSource() {
         return this.pacScriptSource;
     }
+    
+    
+
+    private PacScriptEngine getScriptEngine(String pacSource) throws PacParsingException {
+
+        try {
+            ScriptEngine engine;
+            if (nashornJava8u40Available) {
+                engine = getNashornJSScriptEngine();
+            } else {
+                engine = getGenericJSScriptEngine();
+            }
+            
+            LOGGER.log(Level.FINE, "PAC script evaluator using:  {0}", getEngineInfo(engine));
+            
+            
+            PacHelperMethods pacHelpers = Lookup.getDefault().lookup(PacHelperMethods.class);
+            if (pacHelpers == null) { // this should be redundant but we take no chances
+                pacHelpers = new NbPacHelperMethods();
+            }
+
+            String[] allowedGlobals =
+                    ("Object,Function,Array,String,Date,Number,BigInt,"
+                    + "Boolean,RegExp,Math,JSON,NaN,Infinity,undefined,"
+                    + "isNaN,isFinite,parseFloat,parseInt,encodeURI,"
+                    + "encodeURIComponent,decodeURI,decodeURIComponent,eval,"
+                    + "escape,unescape,"
+                    + "Error,EvalError,RangeError,ReferenceError,SyntaxError,"
+                    + "TypeError,URIError,ArrayBuffer,Int8Array,Uint8Array,"
+                    + "Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,"
+                    + "Uint32Array,Float32Array,Float64Array,BigInt64Array,"
+                    + "BigUint64Array,DataView,Map,Set,WeakMap,"
+                    + "WeakSet,Symbol,Reflect,Proxy,Promise,SharedArrayBuffer,"
+                    + "Atomics,console,performance,"
+                    + "arguments").split(",");
+
+            Object cleaner = engine.eval("(function(allowed) {\n"
+                    + "   var names = Object.getOwnPropertyNames(this);\n"
+                    + "   MAIN: for (var i = 0; i < names.length; i++) {\n"
+                    + "     for (var j = 0; j < allowed.length; j++) {\n"
+                    + "       if (names[i] === allowed[j]) {\n"
+                    + "         continue MAIN;\n"
+                    + "       }\n"
+                    + "     }\n"
+                    + "     delete this[names[i]];\n"
+                    + "   }\n"
+                    + "})");
+
+            try {
+                ((Invocable)engine).invokeMethod(cleaner, "call", null, allowedGlobals);
+            } catch (NoSuchMethodException ex) {
+                throw new ScriptException(ex);
+            }
+
+            
+            engine.eval(pacSource);
+
+            String helperJSScript = HelperScriptFactory.getPacHelperSource();
+            LOGGER.log(Level.FINER, "PAC Helper JavaScript :\n{0}", helperJSScript);
+            Object registerPacMethods = engine.eval(helperJSScript);
+            try {
+                ((Invocable) engine).invokeMethod(registerPacMethods, "call", null, pacHelpers);
+            } catch (NoSuchMethodException ex) {
+                throw new ScriptException(ex);
+            }
 
+            // Do some minimal testing of the validity of the PAC Script.
+            final PacJsEntryFunction jsMainFunction;
+            if (nashornJava8u40Available) {
+                jsMainFunction = testScriptEngine(engine, true);
+            } else {
+                jsMainFunction = testScriptEngine(engine, false);
+            }
+            
+            return new PacScriptEngine(engine, jsMainFunction);
+        } catch (ScriptException ex) {
+            throw new  PacParsingException(ex);
+        }
+    }
+    
+    private boolean getNashornJava8u40Available() {
+        try {
+            Class<?> klass = Class.forName("jdk.nashorn.api.scripting.NashornScriptEngineFactory");
+        } catch (ClassNotFoundException ex) {
+            return false;
+        }
+        return true;
+    }
+    
+    private ScriptEngine getNashornJSScriptEngine() {
+        NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        return factory.getScriptEngine(new ClassFilterPacHelpers());
+    }
+    
+    private ScriptEngine getGenericJSScriptEngine() {
+        // The result of the statements below may be Rhino, but more likely
+        // - since Java 8 - it will be a Nashorn engine.
+        ScriptEngineManager factory = new ScriptEngineManager();
+        return factory.getEngineByName("JavaScript");
+    }
+    
     /**
      * Test if the main entry point, function FindProxyForURL()/FindProxyForURLEx(), 
      * is available.
      */
-    private PacJsEntryFunction testScriptEngine(Scriptable eng, boolean doDeepTest) throws PacParsingException {
+    private PacJsEntryFunction testScriptEngine(ScriptEngine eng, boolean doDeepTest) throws PacParsingException {
         if (isJsFunctionAvailable(eng, PacJsEntryFunction.IPV6_AWARE.getJsFunctionName(), doDeepTest)) {
             return PacJsEntryFunction.IPV6_AWARE;
         }
@@ -322,17 +383,33 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
         throw new PacParsingException("Function " + PacJsEntryFunction.STANDARD.getJsFunctionName() + " or " + PacJsEntryFunction.IPV6_AWARE.getJsFunctionName() + " not found in PAC Script.");
     }
 
-    private boolean isJsFunctionAvailable(Scriptable eng, String functionName, boolean doDeepTest) {
-        Object o = ScriptableObject.getProperty(eng, functionName);
-        return o instanceof Function;
+    private boolean isJsFunctionAvailable(ScriptEngine eng, String functionName, boolean doDeepTest) {
+        // We want to test if the function is there, but without actually 
+        // invoking it.        
+        Object obj = eng.get(functionName);
+        
+        if (!doDeepTest && obj != null) {  
+            // Shallow test. We've established that there's
+            // "something" in the ENGINE_SCOPE with a name like
+            // functionName, and we *hope* it is a function, but we really don't
+            // know, therefore we call it a shallow test.
+            return true;
+        }
+        
+        // For Nashorn post JDK8u40 we can do even deeper validation
+        // using the ScriptObjectMirror class. This will not work for Rhino.
+        if (doDeepTest && obj != null) {
+            if (obj instanceof ScriptObjectMirror) {
+                    ScriptObjectMirror  som = (ScriptObjectMirror) obj;
+                    if (som.isFunction()) {
+                        return true;
+                    }
+            }
+        }        
+        return false;
     }
     
 
-    private String getHelperJsScriptSource() throws PacParsingException {
-        return HelperScriptFactory.getPacHelperSource(JS_HELPER_METHODS_INSTANCE_NAME);
-    }
-
-
     /**
      * Does the script source make reference to any of the date/time functions
      * (timeRange(), dateRange(), weekdayRange()) ?
@@ -349,6 +426,26 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
         return matcher.matches();
     }
 
+    private String getEngineInfo(ScriptEngine engine) {
+        StringBuilder sb = new StringBuilder();
+        ScriptEngineFactory f = engine.getFactory();
+        sb.append("LanguageName=");
+        sb.append("\"").append(f.getLanguageName()).append("\"");
+        sb.append(" ");
+        sb.append("LanguageVersion=");
+        sb.append("\"").append(f.getLanguageVersion()).append("\"");
+        sb.append(" ");
+        sb.append("EngineName=");
+        sb.append("\"").append(f.getEngineName()).append("\"");
+        sb.append(" ");
+        sb.append("EngineNameAliases=");
+        sb.append(Arrays.toString(f.getNames().toArray(new String[f.getNames().size()])));
+        sb.append(" ");
+        sb.append("EngineVersion=");
+        sb.append("\"").append(f.getEngineVersion()).append("\"");
+        return sb.toString();
+    }
+
     /**
      * Translates result from JavaScript into list of java proxy types.
      * 
@@ -428,61 +525,34 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
         
         return new Proxy(proxyType, new InetSocketAddress(host, portNo));
     }
-
-    /**
-     * SandboxedContextFactory provides an Rhino execution context, that can
-     * limit executed instructions, execution time and exposed java classes
-     */
-    private static final class SandboxedContextFactory extends ContextFactory {
-        private final long maxExecutionTimeMS;
-        private final long maxInstructionCount;
-        private final ClassShutter classShutter;
-
-        public SandboxedContextFactory(long maxInstructionCount, long maxExecutionTimeMS, ClassShutter classShutter) {
-            this.classShutter = classShutter;
-            this.maxInstructionCount = maxInstructionCount;
-            this.maxExecutionTimeMS = maxExecutionTimeMS;
+    
+    
+    private static class PacScriptEngine  {
+        private final ScriptEngine scriptEngine;
+        private final PacJsEntryFunction jsMainFunction;
+        private final Invocable invocable;
+
+        public PacScriptEngine(ScriptEngine scriptEngine, PacJsEntryFunction jsMainFunction) {
+            this.scriptEngine = scriptEngine;
+            this.jsMainFunction = jsMainFunction;
+            this.invocable = (Invocable) scriptEngine;
         }
 
-	@Override
-	protected Context makeContext() {
-	    return new SandboxedContext(this, classShutter, maxInstructionCount, maxExecutionTimeMS);
-	}
-
-    }
-
-    private static final class SandboxedContext extends Context {
-        private final long maxInstructionCount;
-        private final long maxExecutionTimeMS;
-	private final long executionStart = System.currentTimeMillis();
-	private long instructionCounter = 0;
-
-	public SandboxedContext(SandboxedContextFactory factory, ClassShutter classShutter, long maxInstructionCount, long maxExecutionTimeMS) {
-	    super(factory);
-            this.maxExecutionTimeMS = maxExecutionTimeMS;
-            this.maxInstructionCount = maxInstructionCount;
-	    setClassShutter(classShutter);
-	    setGenerateObserverCount(true);
-	    setInstructionObserverThreshold(1);
-	}
-
-	@Override
-	protected void observeInstructionCount(int instructionCount) {
-	    instructionCounter += instructionCount;
-	    long executionTime = System.currentTimeMillis() - executionStart;
-	    if(instructionCounter > maxInstructionCount || executionTime > maxExecutionTimeMS) {
-		throw new ExecutionLimitsExceeded(executionTime, maxExecutionTimeMS, instructionCounter, maxInstructionCount);
-	    }
-	}
-    }
-
-    private static class  ExecutionLimitsExceeded extends EvaluatorException {
+        public PacJsEntryFunction getJsMainFunction() {
+            return jsMainFunction;
+        }
 
-	public ExecutionLimitsExceeded(long executionTime, long maxExecutionTime, long intructionCount, long maxInstructionCount) {
-	    super(String.format("Exceeded execution limits (Execution Time (current/max): %dms / %dms, Instruction Count (current/max): %d / %d)",
-		    executionTime, maxExecutionTime,
-		    intructionCount, maxInstructionCount));
-	}
+        public ScriptEngine getScriptEngine() {
+            return scriptEngine;
+        }
 
+        public Invocable getInvocable() {
+            return invocable;
+        }
+        
+        public Object findProxyForURL(String url, String host) throws ScriptException, NoSuchMethodException {
+            return invocable.invokeFunction(jsMainFunction.getJsFunctionName(), url, host);
+        }
     }
+        
 }
diff --git a/platform/core.network/test/unit/data/pacFiles/pac-test5.js b/platform/core.network/test/unit/data/pacFiles/pac-test5.js
new file mode 100644
index 0000000..b35b337
--- /dev/null
+++ b/platform/core.network/test/unit/data/pacFiles/pac-test5.js
@@ -0,0 +1,34 @@
+/*
+ * Licensed 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+function FindProxyForURL(url, host)
+{
+    var reply = "";
+    if (typeof engine !== 'undefined') {
+        reply += (typeof engine) + ":";
+    }
+    if (typeof Java !== 'undefined') {
+        reply += (typeof Java) + ":";
+    }
+    if (typeof jsPacHelpers !== 'undefined') {
+        reply += "jsPacHelpers:" + jsPacHelpers;
+    }
+
+    // Make everything lower case.
+    url = url.toLowerCase();
+    host = host.toLowerCase();
+    if (isPlainHostName(host)) return reply + "DIRECT";
+    return reply + "PROXY www-proxy.us.oracle.com:80";
+}
diff --git a/platform/core.network/test/unit/data/pacFiles/wpad space.dat b/platform/core.network/test/unit/data/pacFiles/wpad space.dat
new file mode 100644
index 0000000..3310e6a
--- /dev/null
+++ b/platform/core.network/test/unit/data/pacFiles/wpad space.dat	
@@ -0,0 +1,22 @@
+/* 
+ * Licensed 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function FindProxyForURL(url, host)
+{
+    // Make everything lower case.
+    url = url.toLowerCase();
+    host = host.toLowerCase();
+    if (isPlainHostName(host)) return "DIRECT";
+    return "PROXY www-proxy.us.oracle.com:80";
+};
diff --git a/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/ProxyAutoConfigDirectTest.java b/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/ProxyAutoConfigDirectTest.java
new file mode 100644
index 0000000..a88a600
--- /dev/null
+++ b/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/ProxyAutoConfigDirectTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.core.network.proxy;
+
+import java.io.File;
+import java.net.Proxy;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Pattern;
+import org.netbeans.junit.NbTestCase;
+
+public class ProxyAutoConfigDirectTest extends NbTestCase {
+    public ProxyAutoConfigDirectTest(String name) {
+        super(name);
+    }
+
+    public void testGetProxyAutoConfigWithLocalPAC() throws URISyntaxException {
+        List<String> pacFileLocations = new LinkedList<String>();
+        for (File pacFile : new File(getDataDir(), "pacFiles").listFiles()) {
+            pacFileLocations.add(pacFile.getAbsolutePath());
+            pacFileLocations.add("file://" + pacFile.getAbsolutePath());
+            pacFileLocations.add(pacFile.toURI().toString());
+        }
+        for (String pacFileLoc : pacFileLocations) {
+            ProxyAutoConfig pac = ProxyAutoConfig.get(pacFileLoc);
+            assertNotNull(pac);
+            URI uri = pac.getPacURI();
+            assertNotNull(uri);
+            assertNull(uri.getHost());
+            List<Proxy> proxies = pac.findProxyForURL(new URI("http://apache.org"));
+            assertEquals(1, proxies.size());
+            Proxy proxy = proxies.get(0);
+            assertEquals(pacFileLoc, Proxy.Type.HTTP, proxy.type());
+
+            final Pattern pattern = Pattern.compile("www-proxy\\.us\\.oracle\\.com.*:80");
+
+            assertTrue(
+                "Configuration " + pacFileLoc + " contains the proxy, but was: " + proxy.address(),
+                pattern.matcher(proxy.address().toString()).matches()
+            );
+
+            proxies = pac.findProxyForURL(new URI("https://apache.org"));
+            assertEquals(1, proxies.size());
+            proxy = proxies.get(0);
+            assertEquals(pacFileLoc, Proxy.Type.HTTP, proxy.type());
+            assertTrue(
+                "Configuration " + pacFileLoc + " contains the proxy, but was: " + proxy.address(),
+                pattern.matcher(proxy.address().toString()).matches()
+            );
+        }
+    }
+
+}
diff --git a/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/ProxyAutoConfigTest.java b/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/ProxyAutoConfigTest.java
index 033245b..f88195f 100644
--- a/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/ProxyAutoConfigTest.java
+++ b/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/ProxyAutoConfigTest.java
@@ -24,6 +24,8 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import junit.framework.Test;
 import org.netbeans.junit.NbModuleSuite;
 import org.netbeans.junit.NbTestCase;
@@ -92,13 +94,22 @@ public class ProxyAutoConfigTest extends NbTestCase {
             assertEquals(1, proxies.size());
             Proxy proxy = proxies.get(0);
             assertEquals(pacFileLoc, Proxy.Type.HTTP, proxy.type());
-            assertEquals(pacFileLoc, "www-proxy.us.oracle.com:80", proxy.address().toString());
+
+            final Pattern pattern = Pattern.compile("www-proxy\\.us\\.oracle\\.com.*:80");
+
+            assertTrue(
+                "Configuration " + pacFileLoc + " contains the proxy, but was: " + proxy.address(),
+                pattern.matcher(proxy.address().toString()).matches()
+            );
             
             proxies = pac.findProxyForURL(new URI("https://apache.org"));
             assertEquals(1, proxies.size());
             proxy = proxies.get(0);
             assertEquals(pacFileLoc, Proxy.Type.HTTP, proxy.type());
-            assertEquals(pacFileLoc, "www-proxy.us.oracle.com:80", proxy.address().toString());
+            assertTrue(
+                "Configuration " + pacFileLoc + " contains the proxy, but was: " + proxy.address(),
+                pattern.matcher(proxy.address().toString()).matches()
+            );
         }
     }
     
diff --git a/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/pac/PacEngineTest.java b/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/pac/PacEngineTest.java
index cba6cc7..7d109a7 100644
--- a/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/pac/PacEngineTest.java
+++ b/platform/core.network/test/unit/src/org/netbeans/core/network/proxy/pac/PacEngineTest.java
@@ -15,7 +15,6 @@ package org.netbeans.core.network.proxy.pac;
 
 import java.io.File;
 import java.io.IOException;
-import java.net.InetSocketAddress;
 import java.net.Proxy;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -76,28 +75,6 @@ public class PacEngineTest extends NbTestCase {
         testPacFile2("pac-test4.js", factory);
     }
 
-    @Test
-    public void testEngine2() throws IOException, PacParsingException, URISyntaxException, PacValidationException {
-
-        File pacFilesDir = new File(getDataDir(), "pacFiles");
-        byte[] b = Files.readAllBytes((new File(pacFilesDir, "wpad.dat")).toPath());
-        String pacSource = new String(b, StandardCharsets.UTF_8);
-
-        PacScriptEvaluatorFactory factory = new NbPacScriptEvaluatorFactory();
-        PacScriptEvaluator evaluator = factory.createPacScriptEvaluator(pacSource);
-
-        List<Proxy> proxiesFQDN = evaluator.findProxyForURL(new URI("https://www.heise.de"));
-        assertNotNull(proxiesFQDN);
-        assertEquals(1, proxiesFQDN.size());
-        assertEquals(Proxy.Type.HTTP, proxiesFQDN.get(0).type());
-        assertEquals("www-proxy.us.oracle.com", ((InetSocketAddress) proxiesFQDN.get(0).address()).getHostString());
-        assertEquals(80, ((InetSocketAddress) proxiesFQDN.get(0).address()).getPort());
-        List<Proxy> simpleName = evaluator.findProxyForURL(new URI("https://localserver"));
-        assertNotNull(simpleName);
-        assertEquals(1, simpleName.size());
-        assertEquals(Proxy.Type.DIRECT, simpleName.get(0).type());
-    }
-
     private String getPacSource(String pacFileName) throws IOException {
         File pacFilesDir = new File(getDataDir(), "pacFiles2");
         byte[] b = Files.readAllBytes((new File(pacFilesDir, pacFileName)).toPath());
diff --git a/platform/libs.rhino/build.xml b/platform/libs.rhino/build.xml
deleted file mode 100644
index b224dec..0000000
--- a/platform/libs.rhino/build.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
--->
-<project name="platform/libs.rhino" default="build" basedir=".">
-    <import file="../../nbbuild/templates/projectized.xml"/>
-</project>
diff --git a/platform/libs.rhino/external/binaries-list b/platform/libs.rhino/external/binaries-list
deleted file mode 100644
index f707592..0000000
--- a/platform/libs.rhino/external/binaries-list
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-24650BD98B1041DF2EB1BE5CB64DD1AD5B2E7C55 org.mozilla:rhino:1.7.10
diff --git a/platform/libs.rhino/external/rhino-1.7.10-license.txt b/platform/libs.rhino/external/rhino-1.7.10-license.txt
deleted file mode 100644
index 4cee288..0000000
--- a/platform/libs.rhino/external/rhino-1.7.10-license.txt
+++ /dev/null
@@ -1,380 +0,0 @@
-Name: Rhino: JavaScript in Java
-Version: 1.7.10
-License: MPL-2.0
-Origin: https://developer.mozilla.org/de/docs/Rhino
-URL: https://github.com/mozilla/rhino
-Description: Rhino is an implementation of JavaScript in Java.
-
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
-    means each individual or legal entity that creates, contributes to
-    the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
-    means the combination of the Contributions of others (if any) used
-    by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
-    means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
-    means Source Code Form to which the initial Contributor has attached
-    the notice in Exhibit A, the Executable Form of such Source Code
-    Form, and Modifications of such Source Code Form, in each case
-    including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
-    means
-
-    (a) that the initial Contributor has attached the notice described
-        in Exhibit B to the Covered Software; or
-
-    (b) that the Covered Software was made available under the terms of
-        version 1.1 or earlier of the License, but not also under the
-        terms of a Secondary License.
-
-1.6. "Executable Form"
-    means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
-    means a work that combines Covered Software with other material, in
-    a separate file or files, that is not Covered Software.
-
-1.8. "License"
-    means this document.
-
-1.9. "Licensable"
-    means having the right to grant, to the maximum extent possible,
-    whether at the time of the initial grant or subsequently, any and
-    all of the rights conveyed by this License.
-
-1.10. "Modifications"
-    means any of the following:
-
-    (a) any file in Source Code Form that results from an addition to,
-        deletion from, or modification of the contents of Covered
-        Software; or
-
-    (b) any new file in Source Code Form that contains any Covered
-        Software.
-
-1.11. "Patent Claims" of a Contributor
-    means any patent claim(s), including without limitation, method,
-    process, and apparatus claims, in any patent Licensable by such
-    Contributor that would be infringed, but for the grant of the
-    License, by the making, using, selling, offering for sale, having
-    made, import, or transfer of either its Contributions or its
-    Contributor Version.
-
-1.12. "Secondary License"
-    means either the GNU General Public License, Version 2.0, the GNU
-    Lesser General Public License, Version 2.1, the GNU Affero General
-    Public License, Version 3.0, or any later versions of those
-    licenses.
-
-1.13. "Source Code Form"
-    means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
-    means an individual or a legal entity exercising rights under this
-    License. For legal entities, "You" includes any entity that
-    controls, is controlled by, or is under common control with You. For
-    purposes of this definition, "control" means (a) the power, direct
-    or indirect, to cause the direction or management of such entity,
-    whether by contract or otherwise, or (b) ownership of more than
-    fifty percent (50%) of the outstanding shares or beneficial
-    ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
-    Licensable by such Contributor to use, reproduce, make available,
-    modify, display, perform, distribute, and otherwise exploit its
-    Contributions, either on an unmodified basis, with Modifications, or
-    as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
-    for sale, have made, import, and otherwise transfer either its
-    Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
-    or
-
-(b) for infringements caused by: (i) Your and any other third party's
-    modifications of Covered Software, or (ii) the combination of its
-    Contributions with other software (except as part of its Contributor
-    Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
-    its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
-    Form, as described in Section 3.1, and You must inform recipients of
-    the Executable Form how they can obtain a copy of such Source Code
-    Form by reasonable means in a timely manner, at a charge no more
-    than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
-    License, or sublicense it under different terms, provided that the
-    license for the Executable Form does not attempt to limit or alter
-    the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-*                                                                      *
-*  6. Disclaimer of Warranty                                           *
-*  -------------------------                                           *
-*                                                                      *
-*  Covered Software is provided under this License on an "as is"       *
-*  basis, without warranty of any kind, either expressed, implied, or  *
-*  statutory, including, without limitation, warranties that the       *
-*  Covered Software is free of defects, merchantable, fit for a        *
-*  particular purpose or non-infringing. The entire risk as to the     *
-*  quality and performance of the Covered Software is with You.        *
-*  Should any Covered Software prove defective in any respect, You     *
-*  (not any Contributor) assume the cost of any necessary servicing,   *
-*  repair, or correction. This disclaimer of warranty constitutes an   *
-*  essential part of this License. No use of any Covered Software is   *
-*  authorized under this License except under this disclaimer.         *
-*                                                                      *
-************************************************************************
-
-************************************************************************
-*                                                                      *
-*  7. Limitation of Liability                                          *
-*  --------------------------                                          *
-*                                                                      *
-*  Under no circumstances and under no legal theory, whether tort      *
-*  (including negligence), contract, or otherwise, shall any           *
-*  Contributor, or anyone who distributes Covered Software as          *
-*  permitted above, be liable to You for any direct, indirect,         *
-*  special, incidental, or consequential damages of any character      *
-*  including, without limitation, damages for lost profits, loss of    *
-*  goodwill, work stoppage, computer failure or malfunction, or any    *
-*  and all other commercial damages or losses, even if such party      *
-*  shall have been informed of the possibility of such damages. This   *
-*  limitation of liability shall not apply to liability for death or   *
-*  personal injury resulting from such party's negligence to the       *
-*  extent applicable law prohibits such limitation. Some               *
-*  jurisdictions do not allow the exclusion or limitation of           *
-*  incidental or consequential damages, so this exclusion and          *
-*  limitation may not apply to You.                                    *
-*                                                                      *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
-  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/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
-  This Source Code Form is "Incompatible With Secondary Licenses", as
-  defined by the Mozilla Public License, v. 2.0.
diff --git a/platform/libs.rhino/manifest.mf b/platform/libs.rhino/manifest.mf
deleted file mode 100644
index 220f1b1..0000000
--- a/platform/libs.rhino/manifest.mf
+++ /dev/null
@@ -1,4 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: org.netbeans.libs.rhino/1
-OpenIDE-Module-Localizing-Bundle: org/netbeans/libs/rhino/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.7.10
diff --git a/platform/libs.rhino/nbproject/project.properties b/platform/libs.rhino/nbproject/project.properties
deleted file mode 100644
index bf9b950..0000000
--- a/platform/libs.rhino/nbproject/project.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-javac.compilerargs=-Xlint -Xlint:-serial
-javac.source=1.7
-
-release.external/rhino-1.7.10.jar=modules/ext/rhino-1.7.10.jar
diff --git a/platform/libs.rhino/nbproject/project.xml b/platform/libs.rhino/nbproject/project.xml
deleted file mode 100644
index 2f7eaf3..0000000
--- a/platform/libs.rhino/nbproject/project.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
--->
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>org.netbeans.libs.rhino</code-name-base>
-            <module-dependencies/>
-            <friend-packages>
-                <friend>org.netbeans.core.network</friend>
-                <package>org.mozilla.javascript</package>
-                <package>org.mozilla.javascript.debug</package>
-            </friend-packages>
-            <class-path-extension>
-                <runtime-relative-path>ext/rhino-1.7.10.jar</runtime-relative-path>
-                <binary-origin>external/rhino-1.7.10.jar</binary-origin>
-            </class-path-extension>
-        </data>
-    </configuration>
-</project>
diff --git a/platform/libs.rhino/src/org/netbeans/libs/rhino/Bundle.properties b/platform/libs.rhino/src/org/netbeans/libs/rhino/Bundle.properties
deleted file mode 100644
index a423d77..0000000
--- a/platform/libs.rhino/src/org/netbeans/libs/rhino/Bundle.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-OpenIDE-Module-Name=Rhino: JavaScript in Java
-OpenIDE-Module-Display-Category=Libraries
-OpenIDE-Module-Short-Description=Bundles Rhino (JavaScript Implementation)
-OpenIDE-Module-Long-Description=\
-    This module bundles Rhino (a JavaScript Implementation written in java).
diff --git a/platform/o.n.core/src/org/netbeans/core/GuiRunLevel.java b/platform/o.n.core/src/org/netbeans/core/GuiRunLevel.java
index c072a90..6cf9cf6 100644
--- a/platform/o.n.core/src/org/netbeans/core/GuiRunLevel.java
+++ b/platform/o.n.core/src/org/netbeans/core/GuiRunLevel.java
@@ -25,13 +25,11 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.swing.SwingUtilities;
 import javax.swing.Timer;
-import org.netbeans.TopSecurityManager;
 import org.netbeans.core.startup.CLIOptions;
 import org.netbeans.core.startup.MainLookup;
 import org.netbeans.core.startup.RunLevel;
 import org.netbeans.core.startup.Splash;
 import org.netbeans.core.startup.StartLog;
-import org.netbeans.swing.plaf.Startup;
 import org.openide.awt.StatusDisplayer;
 import org.openide.util.Exceptions;
 import org.openide.util.Lookup;
@@ -83,19 +81,9 @@ public class GuiRunLevel implements RunLevel {
             });
         }
 
-        // -----------------------------------------------------------------------------------------------------
-        // 8. Advance Policy
-
-        if (!Boolean.getBoolean("TopSecurityManager.disable")) {
-            // set security manager
-            TopSecurityManager.install();
-            if (CLIOptions.isGui()) {
-                TopSecurityManager.makeSwingUseSpecialClipboard(Lookup.getDefault().lookup(org.openide.util.datatransfer.ExClipboard.class));
-            }
-        }
-
+        NbLifecycleManager.advancePolicy();
         NbAuthenticator.install();
-        
+
         StartLog.logProgress ("Security managers installed"); // NOI18N
         Splash.getInstance().increment(1);
     }
@@ -141,7 +129,7 @@ public class GuiRunLevel implements RunLevel {
         SwingUtilities.invokeLater(new InitWinSys(windowSystem));
         StartLog.logEnd ("Main window initialization"); //NOI18N
     }
-  
+
     private static void waitForMainWindowPaint() {
         // Waits for notification about processed paint event for main window
         // require modified java.awt.EventQueue to run succesfully
diff --git a/platform/o.n.core/src/org/netbeans/core/NbLifecycleManager.java b/platform/o.n.core/src/org/netbeans/core/NbLifecycleManager.java
index b58fa75..c3b891d 100644
--- a/platform/o.n.core/src/org/netbeans/core/NbLifecycleManager.java
+++ b/platform/o.n.core/src/org/netbeans/core/NbLifecycleManager.java
@@ -28,6 +28,8 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import org.netbeans.TopSecurityManager;
+import org.netbeans.core.startup.CLIOptions;
 import org.netbeans.core.startup.ModuleSystem;
 import org.openide.DialogDisplayer;
 import org.openide.LifecycleManager;
@@ -35,8 +37,10 @@ import org.openide.NotifyDescriptor;
 import org.openide.awt.StatusDisplayer;
 import org.openide.cookies.SaveCookie;
 import org.openide.loaders.DataObject;
+import org.openide.util.Lookup;
 import org.openide.util.Mutex;
 import org.openide.util.NbBundle;
+import org.openide.util.datatransfer.ExClipboard;
 import org.openide.util.lookup.ServiceProvider;
 
 /**
@@ -52,6 +56,23 @@ public final class NbLifecycleManager extends LifecycleManager {
     
     /** @GuardedBy("NbLifecycleManager.class") */
     private static CountDownLatch onExit;
+    private static volatile boolean policyAdvanced;
+
+    public static void advancePolicy() {
+        if (policyAdvanced) {
+            return;
+        }
+        // -----------------------------------------------------------------------------------------------------
+        // 8. Advance Policy
+        if (!Boolean.getBoolean("TopSecurityManager.disable")) {
+            // set security manager
+            TopSecurityManager.install();
+            if (CLIOptions.isGui()) {
+                TopSecurityManager.makeSwingUseSpecialClipboard(Lookup.getDefault().lookup(ExClipboard.class));
+            }
+        }
+        policyAdvanced = true;
+    }
     private volatile SecondaryLoop sndLoop;
     private volatile boolean isExitOnEventQueue;
     


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Mime
View raw message