Mercurial > hg > icedtea8-forest > nashorn
changeset 2378:2152c4a01445
8202936: Improve script engine support
Reviewed-by: sundar
author | rpatil |
---|---|
date | Tue, 19 Jun 2018 14:48:52 -0400 |
parents | efdf56343d27 |
children | 41ac91662b75 |
files | src/jdk/nashorn/internal/objects/Global.java |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk/nashorn/internal/objects/Global.java Thu Jun 14 12:37:20 2018 +0100 +++ b/src/jdk/nashorn/internal/objects/Global.java Tue Jun 19 14:48:52 2018 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1427,13 +1427,14 @@ } } - switch (nameStr) { - case "context": + if ("context".equals(nameStr)) { return sctxt; - case "engine": - return global.engine; - default: - break; + } else if ("engine".equals(nameStr)) { + // expose "engine" variable only when there is no security manager + // or when no class filter is set. + if (System.getSecurityManager() == null || global.getClassFilter() == null) { + return global.engine; + } } if (self == UNDEFINED) {