Skip to content

Commit a22e157

Browse files
valfirstdiemol
andauthored
[java] Introduce common interface for all web storage types (#10528)
Co-authored-by: Diego Molina <[email protected]> [skip ci]
1 parent 72226ee commit a22e157

3 files changed

Lines changed: 40 additions & 30 deletions

File tree

java/src/org/openqa/selenium/html5/LocalStorage.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,9 @@
1717

1818
package org.openqa.selenium.html5;
1919

20-
import java.util.Set;
21-
2220
/**
2321
* Represents the local storage for the site currently opened in the browser. Each site has its own
2422
* separate storage area.
2523
*/
26-
public interface LocalStorage {
27-
28-
String getItem(String key);
29-
30-
Set<String> keySet();
31-
32-
void setItem(String key, String value);
33-
34-
String removeItem(String key);
35-
36-
void clear();
37-
38-
int size();
24+
public interface LocalStorage extends Storage {
3925
}

java/src/org/openqa/selenium/html5/SessionStorage.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,11 @@
1717

1818
package org.openqa.selenium.html5;
1919

20-
import java.util.Set;
21-
2220
/**
2321
* Represents the session storage in the browser for the site currently opened in the browser. The
2422
* session storage areas is specific to the current top level browsing context. Each context has a
2523
* unique set of session storage, one for each origin. Sites can add data to the session storage and
2624
* it will be accessible to any page from the same site opened in that window.
2725
*/
28-
public interface SessionStorage {
29-
30-
String getItem(String key);
31-
32-
Set<String> keySet();
33-
34-
void setItem(String key, String value);
35-
36-
String removeItem(String key);
37-
38-
void clear();
39-
40-
int size();
26+
public interface SessionStorage extends Storage {
4127
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package org.openqa.selenium.html5;
19+
20+
import java.util.Set;
21+
22+
/**
23+
* Represents common operations available for all web storage types (session or local).
24+
*/
25+
public interface Storage {
26+
27+
String getItem(String key);
28+
29+
Set<String> keySet();
30+
31+
void setItem(String key, String value);
32+
33+
String removeItem(String key);
34+
35+
void clear();
36+
37+
int size();
38+
}

0 commit comments

Comments
 (0)