diff --git a/src/main/java/org/htmlunit/javascript/host/geo/GeolocationCoordinates.java b/src/main/java/org/htmlunit/javascript/host/geo/GeolocationCoordinates.java index cd85e24b1e..8e82ba9f12 100644 --- a/src/main/java/org/htmlunit/javascript/host/geo/GeolocationCoordinates.java +++ b/src/main/java/org/htmlunit/javascript/host/geo/GeolocationCoordinates.java @@ -52,7 +52,7 @@ public GeolocationCoordinates() { */ @JsxConstructor public void jsConstructor() { - throw JavaScriptEngine.reportRuntimeError("Illegal constructor."); + throw JavaScriptEngine.typeError("Illegal constructor."); } /** diff --git a/src/main/java/org/htmlunit/javascript/host/geo/GeolocationPosition.java b/src/main/java/org/htmlunit/javascript/host/geo/GeolocationPosition.java index 8b7fcf1f70..ea560ebfe9 100644 --- a/src/main/java/org/htmlunit/javascript/host/geo/GeolocationPosition.java +++ b/src/main/java/org/htmlunit/javascript/host/geo/GeolocationPosition.java @@ -48,7 +48,7 @@ public GeolocationPosition() { */ @JsxConstructor public void jsConstructor() { - throw JavaScriptEngine.reportRuntimeError("Illegal constructor."); + throw JavaScriptEngine.typeError("Illegal constructor."); } /** diff --git a/src/main/java/org/htmlunit/javascript/host/geo/GeolocationPositionError.java b/src/main/java/org/htmlunit/javascript/host/geo/GeolocationPositionError.java index 2b75305612..4f76061059 100644 --- a/src/main/java/org/htmlunit/javascript/host/geo/GeolocationPositionError.java +++ b/src/main/java/org/htmlunit/javascript/host/geo/GeolocationPositionError.java @@ -44,6 +44,6 @@ public class GeolocationPositionError extends HtmlUnitScriptable { */ @JsxConstructor public void jsConstructor() { - throw JavaScriptEngine.reportRuntimeError("Illegal constructor."); + throw JavaScriptEngine.typeError("Illegal constructor."); } } diff --git a/src/test/java/org/htmlunit/javascript/host/geo/GeolocationCoordinatesTest.java b/src/test/java/org/htmlunit/javascript/host/geo/GeolocationCoordinatesTest.java new file mode 100644 index 0000000000..84fc409b3a --- /dev/null +++ b/src/test/java/org/htmlunit/javascript/host/geo/GeolocationCoordinatesTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2025 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.htmlunit.javascript.host.geo; + +import org.htmlunit.WebDriverTestCase; +import org.htmlunit.junit.BrowserRunner; +import org.htmlunit.junit.annotation.Alerts; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Tests for {@link GeolocationCoordinates}. + * + * @author Ronald Brill + */ +@RunWith(BrowserRunner.class) +public class GeolocationCoordinatesTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("TypeError") + public void ctor() throws Exception { + final String html = + "\n" + + ""; + + loadPageVerifyTitle2(html); + } +} diff --git a/src/test/java/org/htmlunit/javascript/host/geo/GeolocationPositionErrorTest.java b/src/test/java/org/htmlunit/javascript/host/geo/GeolocationPositionErrorTest.java new file mode 100644 index 0000000000..5f6879b746 --- /dev/null +++ b/src/test/java/org/htmlunit/javascript/host/geo/GeolocationPositionErrorTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2025 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.htmlunit.javascript.host.geo; + +import org.htmlunit.WebDriverTestCase; +import org.htmlunit.junit.BrowserRunner; +import org.htmlunit.junit.annotation.Alerts; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Tests for {@link GeolocationPositionError}. + * + * @author Ronald Brill + */ +@RunWith(BrowserRunner.class) +public class GeolocationPositionErrorTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("TypeError") + public void ctor() throws Exception { + final String html = + "\n" + + ""; + + loadPageVerifyTitle2(html); + } +} diff --git a/src/test/java/org/htmlunit/javascript/host/geo/GeolocationPositionTest.java b/src/test/java/org/htmlunit/javascript/host/geo/GeolocationPositionTest.java new file mode 100644 index 0000000000..bdf176025e --- /dev/null +++ b/src/test/java/org/htmlunit/javascript/host/geo/GeolocationPositionTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2025 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.htmlunit.javascript.host.geo; + +import org.htmlunit.WebDriverTestCase; +import org.htmlunit.junit.BrowserRunner; +import org.htmlunit.junit.annotation.Alerts; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Tests for {@link GeolocationPosition}. + * + * @author Ronald Brill + */ +@RunWith(BrowserRunner.class) +public class GeolocationPositionTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("TypeError") + public void ctor() throws Exception { + final String html = + "\n" + + ""; + + loadPageVerifyTitle2(html); + } +}