File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 185185
186186 Blazor . start ( {
187187 loadBootResource : function ( type , name , defaultUri , integrity ) {
188- // The 'dotnetjs' module is imported as a script and must be
189- // returned as a URL string, not a Response — leave it to the
190- // default loader.
191188 if ( type === 'dotnetjs' ) {
192- return undefined ;
189+ // dotnetjs must be returned as a URL string (or Promise<string>),
190+ // not a Response. Pre-fetch with retry (and SRI when integrity is
191+ // supplied) so a transient failure gets multiple attempts; reject
192+ // explicitly on non-OK so bootstrap fails with a clear error rather
193+ // than silently returning the URL and letting the script import fail
194+ // generically later (issue #991).
195+ return retryFetchBootResource ( defaultUri , integrity ) . then ( function ( response ) {
196+ if ( ! response . ok ) {
197+ throw new TypeError ( 'dotnetjs load failed: HTTP ' + response . status ) ;
198+ }
199+ return defaultUri ;
200+ } ) ;
193201 }
194202 return retryFetchBootResource ( defaultUri , integrity ) ;
195203 }
Original file line number Diff line number Diff line change 8282 ui . insertBefore ( details , msgEl . nextSibling ) ;
8383 }
8484
85- // Button row.
85+ // For network-layer startup failures, add a reload hint before the
86+ // button row so users know what to try before filing a bug.
87+ var isNetworkError = (
88+ message === 'Load failed' ||
89+ message . indexOf ( 'Failed to fetch' ) !== - 1 ||
90+ message . indexOf ( 'NetworkError' ) !== - 1
91+ ) ;
92+ if ( isNetworkError ) {
93+ var hint = document . createElement ( 'p' ) ;
94+ hint . style . cssText = 'margin: 0.4rem 0 0; font-size: 0.8rem; color: #555;' ;
95+ hint . textContent = 'This is usually a temporary network problem or an app update in progress — reloading typically fixes it.' ;
96+ ui . insertBefore ( hint , ( stack ? details : msgEl ) . nextSibling ) ;
97+ }
98+
99+ // Button row — anchor after hint when present (var-hoisted as undefined otherwise).
86100 var row = document . createElement ( 'div' ) ;
87101 row . style . cssText = 'margin-top: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;' ;
88102
120134 row . appendChild ( copyBtn ) ;
121135 row . appendChild ( reportLink ) ;
122136
123- var insertAfter = stack ? details : msgEl ;
137+ var insertAfter = hint || ( stack ? details : msgEl ) ;
124138 ui . insertBefore ( row , insertAfter . nextSibling ) ;
125139 }
126140
You can’t perform that action at this time.
0 commit comments