From fa941b086c145e34e1cdd34b74dfc25fa54179b6 Mon Sep 17 00:00:00 2001 From: Stefan Sigvardsson Date: Mon, 15 Jun 2026 07:48:59 +0200 Subject: [PATCH 1/2] Allow overriding Super Dev Mode server URL via prompt 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. --- .../google/gwt/dev/codeserver/stub.nocache.js | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js b/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js index 5476f04da94..7c8ed01ad7a 100755 --- a/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js +++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js @@ -20,8 +20,19 @@ (function($wnd, $doc){ // Compute some codeserver urls so as the user does not need bookmarklets var hostName = $wnd.location.hostname; - var serverUrl = 'http://' + hostName + ':__SUPERDEV_PORT__'; var module = '__MODULE_NAME__'; + + // The default Super Dev Mode server url. The user may override it (and retry) + // through the prompt shown by the error handler below; the override is kept + // for the session so the reload picks up the new server. + var serverUrlKey = '__gwt_sdm__server_url'; + var defaultServerUrl = 'http://' + hostName + ':__SUPERDEV_PORT__'; + var serverUrl = defaultServerUrl; + try { + serverUrl = $wnd.sessionStorage.getItem(serverUrlKey) || defaultServerUrl; + } catch (e) { + // sessionStorage may be unavailable; fall back to the default url. + } var nocacheUrl = serverUrl + '/recompile-requester/' + module; // Insert the superdevmode nocache script in the first position of the head @@ -32,15 +43,22 @@ // This means that we do not detect a non running SDM with IE8. if (devModeScript.addEventListener) { var callback = function() { - // Don't show the confirmation dialogue twice (multimodule) + // Don't show the prompt twice (multimodule) if (!$wnd.__gwt__sdm__confirmed && (!$wnd.__gwt_sdm__recompiler || !$wnd.__gwt_sdm__recompiler.loaded)) { $wnd.__gwt__sdm__confirmed = true; - if ($wnd.confirm( + var newServerUrl = $wnd.prompt( "Couldn't load " + module + " from Super Dev Mode\n" + "server at " + serverUrl + ".\n" + "Please make sure this server is ready.\n" + - "Do you want to try again?")) { + "Press OK to try again:", + serverUrl); + if (newServerUrl) { + try { + $wnd.sessionStorage.setItem(serverUrlKey, newServerUrl); + } catch (e) { + // Without storage the reload falls back to the default url. + } $wnd.location.reload(); } } From 0f5941b9d9485626913b792e0689766b6d10155f Mon Sep 17 00:00:00 2001 From: Stefan Sigvardsson Date: Tue, 16 Jun 2026 14:22:33 +0200 Subject: [PATCH 2/2] Remove sessionStorage availability check in Super Dev Mode stub 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. --- .../com/google/gwt/dev/codeserver/stub.nocache.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js b/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js index 7c8ed01ad7a..f09858e8542 100755 --- a/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js +++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js @@ -27,12 +27,7 @@ // for the session so the reload picks up the new server. var serverUrlKey = '__gwt_sdm__server_url'; var defaultServerUrl = 'http://' + hostName + ':__SUPERDEV_PORT__'; - var serverUrl = defaultServerUrl; - try { - serverUrl = $wnd.sessionStorage.getItem(serverUrlKey) || defaultServerUrl; - } catch (e) { - // sessionStorage may be unavailable; fall back to the default url. - } + var serverUrl = $wnd.sessionStorage.getItem(serverUrlKey) || defaultServerUrl; var nocacheUrl = serverUrl + '/recompile-requester/' + module; // Insert the superdevmode nocache script in the first position of the head @@ -54,11 +49,7 @@ "Press OK to try again:", serverUrl); if (newServerUrl) { - try { - $wnd.sessionStorage.setItem(serverUrlKey, newServerUrl); - } catch (e) { - // Without storage the reload falls back to the default url. - } + $wnd.sessionStorage.setItem(serverUrlKey, newServerUrl); $wnd.location.reload(); } }