From 8979563d01b0c93f8ea05bcf14f8cd1e1a40e881 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Fri, 29 Dec 2023 15:46:49 -0500 Subject: [PATCH] [java] deprecate all html5 offline storage implementations See #10397 these are currently implemented by executing JavaScript --- java/src/org/openqa/selenium/chromium/ChromiumDriver.java | 2 ++ java/src/org/openqa/selenium/firefox/FirefoxDriver.java | 2 ++ java/src/org/openqa/selenium/html5/AppCacheStatus.java | 1 + java/src/org/openqa/selenium/html5/LocalStorage.java | 1 + java/src/org/openqa/selenium/html5/SessionStorage.java | 1 + java/src/org/openqa/selenium/html5/Storage.java | 1 + java/src/org/openqa/selenium/html5/WebStorage.java | 1 + .../openqa/selenium/remote/html5/RemoteLocalStorage.java | 8 +++++++- .../selenium/remote/html5/RemoteSessionStorage.java | 8 +++++++- 9 files changed, 23 insertions(+), 2 deletions(-) diff --git a/java/src/org/openqa/selenium/chromium/ChromiumDriver.java b/java/src/org/openqa/selenium/chromium/ChromiumDriver.java index 3043127bef164..c07d7f71b1d96 100644 --- a/java/src/org/openqa/selenium/chromium/ChromiumDriver.java +++ b/java/src/org/openqa/selenium/chromium/ChromiumDriver.java @@ -292,11 +292,13 @@ public void register(Predicate whenThisMatches, Supplier useTh } @Override + @Deprecated public LocalStorage getLocalStorage() { return webStorage.getLocalStorage(); } @Override + @Deprecated public SessionStorage getSessionStorage() { return webStorage.getSessionStorage(); } diff --git a/java/src/org/openqa/selenium/firefox/FirefoxDriver.java b/java/src/org/openqa/selenium/firefox/FirefoxDriver.java index 0927bc1bbecf2..5810c15111340 100644 --- a/java/src/org/openqa/selenium/firefox/FirefoxDriver.java +++ b/java/src/org/openqa/selenium/firefox/FirefoxDriver.java @@ -254,11 +254,13 @@ public void setFileDetector(FileDetector detector) { } @Override + @Deprecated public LocalStorage getLocalStorage() { return webStorage.getLocalStorage(); } @Override + @Deprecated public SessionStorage getSessionStorage() { return webStorage.getSessionStorage(); } diff --git a/java/src/org/openqa/selenium/html5/AppCacheStatus.java b/java/src/org/openqa/selenium/html5/AppCacheStatus.java index 48ef5e47c8bdb..a1fc9649f9568 100644 --- a/java/src/org/openqa/selenium/html5/AppCacheStatus.java +++ b/java/src/org/openqa/selenium/html5/AppCacheStatus.java @@ -18,6 +18,7 @@ package org.openqa.selenium.html5; /** Represents the application cache status. */ +@Deprecated public enum AppCacheStatus { UNCACHED(0), IDLE(1), diff --git a/java/src/org/openqa/selenium/html5/LocalStorage.java b/java/src/org/openqa/selenium/html5/LocalStorage.java index 41a8a88a5c638..f7f05c20fe7ff 100644 --- a/java/src/org/openqa/selenium/html5/LocalStorage.java +++ b/java/src/org/openqa/selenium/html5/LocalStorage.java @@ -21,4 +21,5 @@ * Represents the local storage for the site currently opened in the browser. Each site has its own * separate storage area. */ +@Deprecated public interface LocalStorage extends Storage {} diff --git a/java/src/org/openqa/selenium/html5/SessionStorage.java b/java/src/org/openqa/selenium/html5/SessionStorage.java index 3fff9804029e0..a470415af742b 100644 --- a/java/src/org/openqa/selenium/html5/SessionStorage.java +++ b/java/src/org/openqa/selenium/html5/SessionStorage.java @@ -23,4 +23,5 @@ * unique set of session storage, one for each origin. Sites can add data to the session storage and * it will be accessible to any page from the same site opened in that window. */ +@Deprecated public interface SessionStorage extends Storage {} diff --git a/java/src/org/openqa/selenium/html5/Storage.java b/java/src/org/openqa/selenium/html5/Storage.java index b5263ab44d5df..55745ac139500 100644 --- a/java/src/org/openqa/selenium/html5/Storage.java +++ b/java/src/org/openqa/selenium/html5/Storage.java @@ -20,6 +20,7 @@ import java.util.Set; /** Represents common operations available for all web storage types (session or local). */ +@Deprecated public interface Storage { String getItem(String key); diff --git a/java/src/org/openqa/selenium/html5/WebStorage.java b/java/src/org/openqa/selenium/html5/WebStorage.java index 9a9c7dd16c2d2..692cfd6c51a12 100644 --- a/java/src/org/openqa/selenium/html5/WebStorage.java +++ b/java/src/org/openqa/selenium/html5/WebStorage.java @@ -17,6 +17,7 @@ package org.openqa.selenium.html5; +@Deprecated public interface WebStorage { LocalStorage getLocalStorage(); diff --git a/java/src/org/openqa/selenium/remote/html5/RemoteLocalStorage.java b/java/src/org/openqa/selenium/remote/html5/RemoteLocalStorage.java index 09e9474c419c9..7fed669bd85d3 100644 --- a/java/src/org/openqa/selenium/remote/html5/RemoteLocalStorage.java +++ b/java/src/org/openqa/selenium/remote/html5/RemoteLocalStorage.java @@ -25,7 +25,13 @@ import org.openqa.selenium.remote.DriverCommand; import org.openqa.selenium.remote.ExecuteMethod; -/** Executes the commands to access HTML5 localStorage on the remote webdriver server. */ +/** + * Executes the commands to access HTML5 localStorage on the remote webdriver server. + * + * @deprecated LocalStorage can be managed by executing JavaScript. @see #executeScript(String, + * Object...) + */ +@Deprecated public class RemoteLocalStorage implements LocalStorage { private final ExecuteMethod executeMethod; diff --git a/java/src/org/openqa/selenium/remote/html5/RemoteSessionStorage.java b/java/src/org/openqa/selenium/remote/html5/RemoteSessionStorage.java index 4adc10f76c570..021af9045ebb8 100644 --- a/java/src/org/openqa/selenium/remote/html5/RemoteSessionStorage.java +++ b/java/src/org/openqa/selenium/remote/html5/RemoteSessionStorage.java @@ -25,7 +25,13 @@ import org.openqa.selenium.remote.DriverCommand; import org.openqa.selenium.remote.ExecuteMethod; -/** Executes the commands to access HTML5 sessionStorage on the remote webdriver server. */ +/** + * Executes the commands to access HTML5 sessionStorage on the remote webdriver server. + * + * @deprecated LocalStorage can be managed by executing JavaScript. @see #executeScript(String, + * Object...) + */ +@Deprecated public class RemoteSessionStorage implements SessionStorage { private final ExecuteMethod executeMethod;