ID:2959743
 
Resolved
The byondStorage options and BYOND object for JavaScript were lost when refreshing a browser page.
BYOND Version:516.1649
Operating System:Windows 11 Home
Web Browser:Definitely not Safari
Applies to:Dream Seeker
Status: Resolved (516.1650)

This issue has been resolved.
Descriptive Problem Summary:
After refreshing a browser window (if enabled via browser-options, using F5, or via devtools), the window.serverStorage, .domainStorage and .hubStorage disappear.

After reconnecting (via .reconnect, using the same DreamSeeker instance), and using a popup window that appears in /client/New(), the browser window will not have the ByondStorage trio accessible. Subsequent browsers opened by verbs will have them accessible.

Numbered Steps to Reproduce Problem:
1. Enable byondstorage via winset
2. Open a browser window
3. Attempt to use the accessible ByondStorage instances on the window element - this will succeed.
4. Refresh the open window.
4. Attempt to use ByondStorage again - this will fail.

1. Enable byondstorage via winset
2. Open a browser window in /client/New()
3. This will have the ByondStorage instances on the window element accessible
4. Use .reconnect
5. The browser window that opens during /client/New() will not have the ByondStorage instances accessible

Code Snippet (if applicable) to Reproduce Problem:
var/html = {"
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">

<script>
function updateDisplayers() {
document.getElementById("displayer-hubStorage").innerText = window.hubStorage && window.hubStorage.getItem ? "hubStorage Defined" : "hubStorage Undefined";
document.getElementById("displayer-serverStorage").innerText = window.serverStorage && window.serverStorage.getItem ? "serverStorage Defined" : "serverStorage Undefined";
document.getElementById("displayer-domainStorage").innerText = window.domainStorage && window.domainStorage.getItem ? "domainStorage Defined" : "domainStorage Undefined";
}

document.addEventListener("byondstorageupdated", function() {
updateDisplayers();
})
</script>
</head>

<body>
<div id="displayer-hubStorage">byondstorageupdated event not fired</div>
<div id="displayer-serverStorage">byondstorageupdated event not fired</div>
<div id="displayer-domainStorage">byondstorageupdated event not fired</div>

<button onclick="updateDisplayers()">check byondstorage</button>
</body>

</html>
"}


client/New()
. = ..()

src << "Reconnected"

winset(src, null, "browser-options=byondstorage,devtools,refresh")

src << browse(html, "window=test")

mob/verb/reconnect()
winset(src, null, "command=.reconnect")

mob/verb/popup_window()
src << browse(html, "window=othertest")


Expected Results:
I can use ByondStorage consistently

Actual Results:
I cannot

Does the problem occur:
Every time? Or how often? Yes
In other games? Yes
In other user accounts? Yes
On other computers?

When does the problem NOT occur?
No 516 versions

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Workarounds:
If the browser window is closed between reconnects, ByondStorage is accessible. However, if utilizing the same browser window and DreamSeeker instance (especially common if the browser is embedded in a skin), ByondStorage will not be accessible.

Lummox JR resolved issue with message:
The byondStorage options and BYOND object for JavaScript were lost when refreshing a browser page.

Login to reply.