From 91456f62d0adfa8e6e1127eca7744cce272f68b5 Mon Sep 17 00:00:00 2001 From: zetashift Date: Fri, 27 Jan 2023 22:03:25 +0100 Subject: [PATCH 1/4] Fix up methods of Location --- api-reports/2_12.txt | 4 ++-- api-reports/2_13.txt | 4 ++-- dom/src/main/scala/org/scalajs/dom/Location.scala | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index 81d5249ec..cf95d3a84 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -15482,11 +15482,11 @@ Location[JT] var hash: String Location[JT] var host: String Location[JT] var hostname: String Location[JT] var href: String -Location[JT] def origin: js.UndefOr[String] +Location[JT] def origin: String Location[JT] var pathname: String Location[JT] var port: String Location[JT] var protocol: String -Location[JT] def reload(flag: Boolean?): Unit +Location[JT] def reload: Unit Location[JT] def replace(url: String): Unit Location[JT] var search: String MIMEType[JT] diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index 81d5249ec..cf95d3a84 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -15482,11 +15482,11 @@ Location[JT] var hash: String Location[JT] var host: String Location[JT] var hostname: String Location[JT] var href: String -Location[JT] def origin: js.UndefOr[String] +Location[JT] def origin: String Location[JT] var pathname: String Location[JT] var port: String Location[JT] var protocol: String -Location[JT] def reload(flag: Boolean?): Unit +Location[JT] def reload: Unit Location[JT] def replace(url: String): Unit Location[JT] var search: String MIMEType[JT] diff --git a/dom/src/main/scala/org/scalajs/dom/Location.scala b/dom/src/main/scala/org/scalajs/dom/Location.scala index 50a959a1d..751639097 100644 --- a/dom/src/main/scala/org/scalajs/dom/Location.scala +++ b/dom/src/main/scala/org/scalajs/dom/Location.scala @@ -46,13 +46,13 @@ trait Location extends js.Object { * * This property also does not exist consistently on IE, even as new as IE11, hence it must be UndefOr. */ - def origin: js.UndefOr[String] = js.native + def origin: String = js.native /** The Location.reload()method Reloads the resource from the current URL. Its optional unique parameter is a Boolean, * which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, * the browser may reload the page from its cache. */ - def reload(flag: Boolean = js.native): Unit = js.native + def reload: Unit = js.native /** The Location.replace()method replaces the current resource with the one at the provided URL. The difference from * the assign() method is that after using replace() the current page will not be saved in session History, meaning From fd5d61dfc3ae805748b27607dacc4105a2d6e417 Mon Sep 17 00:00:00 2001 From: zetashift Date: Sat, 28 Jan 2023 00:01:58 +0100 Subject: [PATCH 2/4] Update the scaladocs for the methods --- dom/src/main/scala/org/scalajs/dom/Location.scala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/Location.scala b/dom/src/main/scala/org/scalajs/dom/Location.scala index 751639097..e22254150 100644 --- a/dom/src/main/scala/org/scalajs/dom/Location.scala +++ b/dom/src/main/scala/org/scalajs/dom/Location.scala @@ -43,14 +43,12 @@ trait Location extends js.Object { * URL, that is, for http and https, the scheme followed by '://', followed by the domain, followed by ':', followed * by the port (the default port, 80 and 443 respectively, if explicitly specified). For URL using file: scheme, the * value is browser dependant. - * - * This property also does not exist consistently on IE, even as new as IE11, hence it must be UndefOr. */ def origin: String = js.native - /** The Location.reload()method Reloads the resource from the current URL. Its optional unique parameter is a Boolean, - * which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, - * the browser may reload the page from its cache. + /** Reloads the resource from the current URL, like the Refresh button. The reload may be blocked and a SECURITY_ERROR + * DOMException thrown. This happens if the origin of the script calling location.reload() differs from the origin of + * the page that owns the Location object. */ def reload: Unit = js.native From 7cd969cc22ab90c32cd2e3dff01a132a8add163d Mon Sep 17 00:00:00 2001 From: zetashift Date: Sat, 28 Jan 2023 00:06:01 +0100 Subject: [PATCH 3/4] reload is a method and needs () Co-authored-by: Arman Bilge --- dom/src/main/scala/org/scalajs/dom/Location.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/src/main/scala/org/scalajs/dom/Location.scala b/dom/src/main/scala/org/scalajs/dom/Location.scala index e22254150..b85a2cd22 100644 --- a/dom/src/main/scala/org/scalajs/dom/Location.scala +++ b/dom/src/main/scala/org/scalajs/dom/Location.scala @@ -50,7 +50,7 @@ trait Location extends js.Object { * DOMException thrown. This happens if the origin of the script calling location.reload() differs from the origin of * the page that owns the Location object. */ - def reload: Unit = js.native + def reload(): Unit = js.native /** The Location.replace()method replaces the current resource with the one at the provided URL. The difference from * the assign() method is that after using replace() the current page will not be saved in session History, meaning From f5baadf40c2ba0e407884a35988e37d27d451d85 Mon Sep 17 00:00:00 2001 From: zetashift Date: Sat, 28 Jan 2023 01:17:19 +0100 Subject: [PATCH 4/4] Add api-reports --- api-reports/2_12.txt | 2 +- api-reports/2_13.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index cf95d3a84..64d402b3a 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -15486,7 +15486,7 @@ Location[JT] def origin: String Location[JT] var pathname: String Location[JT] var port: String Location[JT] var protocol: String -Location[JT] def reload: Unit +Location[JT] def reload(): Unit Location[JT] def replace(url: String): Unit Location[JT] var search: String MIMEType[JT] diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index cf95d3a84..64d402b3a 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -15486,7 +15486,7 @@ Location[JT] def origin: String Location[JT] var pathname: String Location[JT] var port: String Location[JT] var protocol: String -Location[JT] def reload: Unit +Location[JT] def reload(): Unit Location[JT] def replace(url: String): Unit Location[JT] var search: String MIMEType[JT]