Skip to content

Allow overriding Super Dev Mode server URL via prompt#10344

Open
schteff wants to merge 2 commits into
gwtproject:mainfrom
Tempus-Information-Systems:feature/allow-alt-sdm-url
Open

Allow overriding Super Dev Mode server URL via prompt#10344
schteff wants to merge 2 commits into
gwtproject:mainfrom
Tempus-Information-Systems:feature/allow-alt-sdm-url

Conversation

@schteff

@schteff schteff commented Jun 15, 2026

Copy link
Copy Markdown

If the SDM server is unreachable, a prompt now allows users to specify a new server URL. This URL is persisted in sessionStorage so it can be used during the subsequent page reload.

This makes it possible to use https://github.com/localtunnel/localtunnel or other similar services (that tunnel specific ports) to share the local dev environment with other people without having to build and deploy the app on some other server.

If the SDM server is unreachable, a prompt now allows users to specify a new server URL. This URL is persisted in sessionStorage so it can be used during the subsequent page reload.

@niloc132 niloc132 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea, and at a quick glance the implementation seems okay - but doesn't the bookmarklet setup solve this too? That is, if you first start mysdm:9876 and visit that URL, the bookmarklets let you enable SDM in session storage?

My current usage is atypical, so I may well be misremembering.

try {
serverUrl = $wnd.sessionStorage.getItem(serverUrlKey) || defaultServerUrl;
} catch (e) {
// sessionStorage may be unavailable; fall back to the default url.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the risk/likelihood that session storage is unavailable? dev_mode_on.js relies on it and won't function without it, so I think maybe we can assume it is there?

try {
$wnd.sessionStorage.setItem(serverUrlKey, newServerUrl);
} catch (e) {
// Without storage the reload falls back to the default url.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(assuming still relevant) Should probably notify that the prompt had no effect?

Maybe test for storage usage before attempting to use prompt to begin with?

@schteff

schteff commented Jun 16, 2026

Copy link
Copy Markdown
Author

I like the idea, and at a quick glance the implementation seems okay - but doesn't the bookmarklet setup solve this too? That is, if you first start mysdm:9876 and visit that URL, the bookmarklets let you enable SDM in session storage?

My current usage is atypical, so I may well be misremembering.

I haven't used the bookmarklets in so long, I thought they were abandoned with the old dev mode and replaced by SDM.

I'll remove the check for sessionstorage availability, I was not aware of it being used for other GWT functionality. 👍

Remove try-catch blocks around sessionStorage interactions when retrieving or persisting the Super Dev Mode server URL since we know sessionStorage is already available and used in dev_mode_on.js.
@niloc132

Copy link
Copy Markdown
Member

They aren't necessary, but they are allowed to be used, and can give you control like what you're describing - arguably better to be able to enable/disable and control urls directly through the click of a button than prompts and manual typing (when it might just be that your server is stopped and you forgot when you hit refresh).

@schteff

schteff commented Jun 24, 2026

Copy link
Copy Markdown
Author

Just to clarify, the original URL is pre-filled in the prompt. Just clicking OK on the prompt will yield the exact same result as clicking OK on the original alert. Manual typing would only be needed if you would want to change the default URL. And since it's persisted it's only needed once (if typed correctly).

I haven't tried the bookmarklet variant yet, but an alternative solution for this PR might be to simply change the message in the original alert to give the user the tip of using the bookmarklet if they want to manually change the URL?

@jnehlmeier

Copy link
Copy Markdown
Member

@schteff If you try the bookmarklets then you might need to adjust the gwt property devModeUrlWhitelistRegexp defined in CrossSiteIframeLinker.gwt.xml. By default GWT checks for 127.0.0.1 / localhost.

@zbynek

zbynek commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Another approach would be to put the right URL of the code server into the JS similar to this proposal:
https://gwt-review.googlesource.com/c/gwt/+/17180

(except instead of the binding address, a new setting would be used to allow use of local tunnel)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants