# HG changeset patch # User kcr # Date 1461275348 25200 # Thu Apr 21 14:49:08 2016 -0700 # Node ID 76e61826d864fa46aa2d8ae92bc16e042738ee84 # Parent 7d731437da4a1e3e6262953827bd16caaced37b8 8139317: [Mac] SecurityException when constructing WebView from JFXPanel application Reviewed-by: diff --git a/modules/web/src/main/java/com/sun/webkit/Disposer.java b/modules/web/src/main/java/com/sun/webkit/Disposer.java --- a/modules/web/src/main/java/com/sun/webkit/Disposer.java +++ b/modules/web/src/main/java/com/sun/webkit/Disposer.java @@ -32,6 +32,7 @@ import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; +import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -58,10 +59,23 @@ new HashSet(); static { - Thread t = new Thread(disposerInstance, "Disposer"); - t.setDaemon(true); - t.setPriority(Thread.MAX_PRIORITY); - t.start(); + java.security.AccessController.doPrivileged((PrivilegedAction) () -> { + /* + * The thread must be a member of a thread group + * which will not get GCed before VM exit. + * Make its parent the top-level thread group. + */ + ThreadGroup tg = Thread.currentThread().getThreadGroup(); + for (ThreadGroup tgn = tg; + tgn != null; + tg = tgn, tgn = tg.getParent()); + + Thread t = new Thread(tg, disposerInstance, "Disposer"); + t.setDaemon(true); + t.setPriority(Thread.MAX_PRIORITY); + t.start(); + return null; + }); } /** diff --git a/tests/system/src/test/java/test/sandbox/SandboxAppTest.java b/tests/system/src/test/java/test/sandbox/SandboxAppTest.java --- a/tests/system/src/test/java/test/sandbox/SandboxAppTest.java +++ b/tests/system/src/test/java/test/sandbox/SandboxAppTest.java @@ -111,8 +111,6 @@ @Test (timeout=15000) public void testJFXPanelApp() throws Exception { - // TODO: re-enable this when 8139317 is fixed - assumeTrue(!PlatformUtil.isMac()); runSandboxedApp("JFXPanelApp"); }