From 68388420276cffe78d5f052540a18b6ebd8f2d5e Mon Sep 17 00:00:00 2001 From: "nboyd%atg.com" Date: Sat, 10 Mar 2001 11:50:50 +0000 Subject: [PATCH] Add method to set security support after creation. --- js/rhino/org/mozilla/javascript/Context.java | 17 +++++++++++++++++ .../src/org/mozilla/javascript/Context.java | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/js/rhino/org/mozilla/javascript/Context.java b/js/rhino/org/mozilla/javascript/Context.java index 13e3534f332..b19f33560b0 100644 --- a/js/rhino/org/mozilla/javascript/Context.java +++ b/js/rhino/org/mozilla/javascript/Context.java @@ -1354,6 +1354,7 @@ public final class Context { /** * Remove a Context listener. + * @param listener the listener to remove. */ public static void removeContextListener(ContextListener listener) { if (contextListeners == null) @@ -1363,6 +1364,22 @@ public final class Context { contextListeners.removeElementAt(i); } } + + /** + * Set the security support for this context. + *

SecuritySupport may only be set if it is currently null. + * Otherwise a SecurityException is thrown. + * @param securitySupportObj a SecuritySupport object + * @throws SecurityException if there is already a SecuritySupport + * object for this Context + */ + public void setSecuritySupport(SecuritySupport securitySupportObj) { + if (securitySupport != null) { + throw new SecurityException("Cannot overwrite existing " + + "SecuritySupport object"); + } + securitySupport = securitySupportObj; + } /** * Return true if a security domain is required on calls to diff --git a/js/rhino/src/org/mozilla/javascript/Context.java b/js/rhino/src/org/mozilla/javascript/Context.java index 13e3534f332..b19f33560b0 100644 --- a/js/rhino/src/org/mozilla/javascript/Context.java +++ b/js/rhino/src/org/mozilla/javascript/Context.java @@ -1354,6 +1354,7 @@ public final class Context { /** * Remove a Context listener. + * @param listener the listener to remove. */ public static void removeContextListener(ContextListener listener) { if (contextListeners == null) @@ -1363,6 +1364,22 @@ public final class Context { contextListeners.removeElementAt(i); } } + + /** + * Set the security support for this context. + *

SecuritySupport may only be set if it is currently null. + * Otherwise a SecurityException is thrown. + * @param securitySupportObj a SecuritySupport object + * @throws SecurityException if there is already a SecuritySupport + * object for this Context + */ + public void setSecuritySupport(SecuritySupport securitySupportObj) { + if (securitySupport != null) { + throw new SecurityException("Cannot overwrite existing " + + "SecuritySupport object"); + } + securitySupport = securitySupportObj; + } /** * Return true if a security domain is required on calls to