Skip to content

Commit

Permalink
spotlessApply
Browse files Browse the repository at this point in the history
  • Loading branch information
nabacg committed Dec 2, 2024
1 parent 466c6e8 commit 0ba1f30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.mozilla.javascript.tests.es6;

import static org.junit.Assert.assertEquals;

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() {
Expand All @@ -27,17 +27,14 @@ protected boolean hasFeature(Context cx, int featureIndex) {
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";
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);
var result = cx.evaluateString(scope, script, "myScript", 1, null);

assertEquals(2, result);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
package org.mozilla.javascript.tests.es6;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mozilla.javascript.tests.Utils.DEFAULT_OPT_LEVELS;

import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Method;
import org.junit.Test;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ContextFactory;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.tests.Utils;
import org.mozilla.javascript.tools.shell.Global;

public class PropertyTest {

Expand Down Expand Up @@ -125,9 +119,6 @@ public void redefineSetterProperty() throws Exception {

return null;
});



}

@Test
Expand Down Expand Up @@ -163,19 +154,15 @@ protected boolean hasFeature(Context cx, int featureIndex) {
// define custom getter method
final Method getter = MyHostObject.class.getMethod("getFoo");
final Method setter = MyHostObject.class.getMethod("setFoo", String.class);
myHostObject.defineProperty(
"foo", null, getter, setter, ScriptableObject.EMPTY);
myHostObject.defineProperty("foo", null, getter, setter, ScriptableObject.EMPTY);
scope.put("MyHostObject", scope, myHostObject);
} catch (Exception e) {
}

final String result =
(String) cx.evaluateString(scope, script, "myScript", 1, null);
final String result = (String) cx.evaluateString(scope, script, "myScript", 1, null);

assertEquals(expected, result);

}

}

public static class MyHostObject extends ScriptableObject {
Expand Down

0 comments on commit 0ba1f30

Please sign in to comment.