Skip to content

Commit aa6f1d0

Browse files
committed
latest rhino
1 parent 5b4082b commit aa6f1d0

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

pom.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>org.htmlunit</groupId>
66
<artifactId>htmlunit-core-js</artifactId>
7-
<version>4.2.0</version>
7+
<version>4.3.0-SNAPSHOT</version>
88
<name>HtmlUnit JavaScript Engine</name>
99
<organization>
1010
<name>HtmlUnit</name>
@@ -124,13 +124,13 @@
124124
<outputDirectory>${basedir}/src/repackaged-rhino/java/org/htmlunit/corejs</outputDirectory>
125125
<resources>
126126
<resource>
127-
<directory>../htmlunit-rhino-fork/src/org/mozilla</directory>
127+
<directory>../htmlunit-rhino-fork/rhino-runtime/src/main/java/org/mozilla</directory>
128128
<includes>
129129
<include>**/*.java</include>
130130
</includes>
131131
</resource>
132132
<resource>
133-
<directory>../htmlunit-rhino-fork/toolsrc/org/mozilla</directory>
133+
<directory>../htmlunit-rhino-fork/rhino-tools/src/main/java/org/mozilla</directory>
134134
<includes>
135135
<include>javascript/tools/debugger/**/*.java</include>
136136
<include>javascript/tools/shell/**/*.java</include>
@@ -150,7 +150,7 @@
150150
<outputDirectory>${basedir}/src/repackaged-rhino/resources/org/htmlunit/corejs</outputDirectory>
151151
<resources>
152152
<resource>
153-
<directory>../htmlunit-rhino-fork/src/org/mozilla</directory>
153+
<directory>../htmlunit-rhino-fork/rhino-runtime/src/main/resources/org/mozilla</directory>
154154
<includes>
155155
<include>**/*.properties</include>
156156
</includes>
@@ -502,11 +502,11 @@
502502
</dependencies>
503503
<distributionManagement>
504504
<snapshotRepository>
505-
<id>sonatype-nexus-snapshots</id>
505+
<id>s01-sonatype-nexus-snapshots</id>
506506
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
507507
</snapshotRepository>
508508
<repository>
509-
<id>sonatype-nexus-staging</id>
509+
<id>s01-sonatype-nexus-staging</id>
510510
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
511511
</repository>
512512
</distributionManagement>

src/test/java/org/htmlunit/corejs/NativeObjectTest.java

+35
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Tests for NativeObject.
1212
*
1313
* @author Ahmed Ashour
14+
* @author Ronald Brill
1415
*/
1516
public class NativeObjectTest {
1617

@@ -66,4 +67,38 @@ public Object run(final Context cx) {
6667

6768
Utils.runWithAllOptimizationLevels(action);
6869
}
70+
71+
/**
72+
* @throws Exception if the test fails
73+
*/
74+
@Test
75+
public void definePropertyUsingConsString() throws Exception {
76+
final String script =
77+
" 'use strict';\n"
78+
+ " var log = '';\n"
79+
+ " var f = function () {};\n"
80+
+ " var a1='proto';\n"
81+
+ " var p = a1 + 'type';\n"
82+
+ " log = log + 'before: ' + f.prototype;\n"
83+
+ " Object.defineProperty(f, p, {});\n"
84+
+ " log = log + ' / after: ' + f.prototype;\n"
85+
+ " var p = new f();\n"
86+
+ " log = log + ' / ' + (p instanceof f);";
87+
88+
final ContextAction<Object> action = new ContextAction<Object>() {
89+
@Override
90+
public Object run(final Context cx) {
91+
try {
92+
Scriptable scope = cx.initSafeStandardObjects();
93+
final Object o = cx.evaluateString(scope, script, "test_script", 1, null);
94+
assertEquals("before: [object Object] / after: [object Object] / true", o);
95+
return o;
96+
} catch (final Exception e) {
97+
throw new RuntimeException(e);
98+
}
99+
}
100+
};
101+
102+
Utils.runWithAllOptimizationLevels(action);
103+
}
69104
}

0 commit comments

Comments
 (0)