-
Notifications
You must be signed in to change notification settings - Fork 859
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
tests/src/test/java/org/mozilla/javascript/tests/es6/DeadlockReproTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.mozilla.javascript.tests.es6; | ||
|
||
import org.junit.Test; | ||
import org.mozilla.javascript.Context; | ||
import org.mozilla.javascript.ContextFactory; | ||
import org.mozilla.javascript.NativeObject; | ||
import org.mozilla.javascript.ScriptableObject; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class DeadlockReproTest { | ||
@Test | ||
public void redefinePropertyWithThreadSafeSlotMap() { | ||
final ContextFactory factory = | ||
new ContextFactory() { | ||
@Override | ||
protected boolean hasFeature(Context cx, int featureIndex) { | ||
if (featureIndex == Context.FEATURE_THREAD_SAFE_OBJECTS) { | ||
return true; | ||
} | ||
return super.hasFeature(cx, featureIndex); | ||
} | ||
}; | ||
|
||
try (Context cx = factory.enterContext()) { | ||
cx.setLanguageVersion(Context.VERSION_ES6); | ||
ScriptableObject scope = cx.initStandardObjects(); | ||
|
||
scope.put("o", scope, new NativeObject()); | ||
final String script = "Object.defineProperty(o, 'test', {value: '1', configurable: !0});" + | ||
"Object.defineProperty(o, 'test', {value: 2});" + | ||
"o.test"; | ||
|
||
|
||
|
||
var result = | ||
cx.evaluateString(scope, script, "myScript", 1, null); | ||
|
||
assertEquals(2, result); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters