Fossil SCM

Tweak [1142db3091]: Make sure `builtin_get_js_delivery_mode_name()' never returns an empty string, for that would be silently swallowed by `blob_append_escaped_arg()' when assembling the command-line for a HTTP child process, resulting in a broken command-line with a missing --jsmode option argument. Also add a hint next to the definition of the `JS_*' modes about dependencies to be reviewed on updates.

florian 2022-06-14 10:36 trunk
Commit b258a41cf87dcca830f5c1e77e10bfb313c16b14cf541e706154043075fb38fd
1 file changed +13 -4
+13 -4
--- src/builtin.c
+++ src/builtin.c
@@ -230,10 +230,12 @@
230230
int eDelivery; /* Delivery mechanism */
231231
} builtin;
232232
233233
#if INTERFACE
234234
/* Various delivery mechanisms. The 0 option is the default.
235
+** MAINTENANCE NOTE: Review/update the builtin_set_js_delivery_mode() and
236
+** builtin_get_js_delivery_mode_name() functions if values are changed/added.
235237
*/
236238
#define JS_INLINE 0 /* inline, batched together at end of file */
237239
#define JS_SEPARATE 1 /* Separate HTTP request for each JS file */
238240
#define JS_BUNDLED 2 /* One HTTP request to load all JS files */
239241
/* concatenated together into a bundle */
@@ -274,15 +276,22 @@
274276
** Returns the name of the current JS delivery mode for reuse with the --jsmode
275277
** option, i.e. the other way around than builtin_set_js_delivery_mode().
276278
*/
277279
const char *builtin_get_js_delivery_mode_name(void){
278280
switch( builtin.eDelivery ){
279
- case JS_INLINE: return "inline";
280
- case JS_BUNDLED: return "bundled";
281
- case JS_SEPARATE: return "separate";
281
+ case JS_SEPARATE: {
282
+ return "separate";
283
+ }
284
+ case JS_BUNDLED: {
285
+ return "bundled";
286
+ }
287
+ case JS_INLINE:
288
+ /*FALLTHROUGH*/
289
+ default: {
290
+ return "inline";
291
+ }
282292
}
283
- return ""; /* builtin_set_js_delivery_mode() handles invalid names. */
284293
}
285294
286295
/*
287296
** The caller wants the Javascript file named by zFilename to be
288297
** included in the generated page. Add the file to the queue of
289298
--- src/builtin.c
+++ src/builtin.c
@@ -230,10 +230,12 @@
230 int eDelivery; /* Delivery mechanism */
231 } builtin;
232
233 #if INTERFACE
234 /* Various delivery mechanisms. The 0 option is the default.
 
 
235 */
236 #define JS_INLINE 0 /* inline, batched together at end of file */
237 #define JS_SEPARATE 1 /* Separate HTTP request for each JS file */
238 #define JS_BUNDLED 2 /* One HTTP request to load all JS files */
239 /* concatenated together into a bundle */
@@ -274,15 +276,22 @@
274 ** Returns the name of the current JS delivery mode for reuse with the --jsmode
275 ** option, i.e. the other way around than builtin_set_js_delivery_mode().
276 */
277 const char *builtin_get_js_delivery_mode_name(void){
278 switch( builtin.eDelivery ){
279 case JS_INLINE: return "inline";
280 case JS_BUNDLED: return "bundled";
281 case JS_SEPARATE: return "separate";
 
 
 
 
 
 
 
 
282 }
283 return ""; /* builtin_set_js_delivery_mode() handles invalid names. */
284 }
285
286 /*
287 ** The caller wants the Javascript file named by zFilename to be
288 ** included in the generated page. Add the file to the queue of
289
--- src/builtin.c
+++ src/builtin.c
@@ -230,10 +230,12 @@
230 int eDelivery; /* Delivery mechanism */
231 } builtin;
232
233 #if INTERFACE
234 /* Various delivery mechanisms. The 0 option is the default.
235 ** MAINTENANCE NOTE: Review/update the builtin_set_js_delivery_mode() and
236 ** builtin_get_js_delivery_mode_name() functions if values are changed/added.
237 */
238 #define JS_INLINE 0 /* inline, batched together at end of file */
239 #define JS_SEPARATE 1 /* Separate HTTP request for each JS file */
240 #define JS_BUNDLED 2 /* One HTTP request to load all JS files */
241 /* concatenated together into a bundle */
@@ -274,15 +276,22 @@
276 ** Returns the name of the current JS delivery mode for reuse with the --jsmode
277 ** option, i.e. the other way around than builtin_set_js_delivery_mode().
278 */
279 const char *builtin_get_js_delivery_mode_name(void){
280 switch( builtin.eDelivery ){
281 case JS_SEPARATE: {
282 return "separate";
283 }
284 case JS_BUNDLED: {
285 return "bundled";
286 }
287 case JS_INLINE:
288 /*FALLTHROUGH*/
289 default: {
290 return "inline";
291 }
292 }
 
293 }
294
295 /*
296 ** The caller wants the Javascript file named by zFilename to be
297 ** included in the generated page. Add the file to the queue of
298

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button