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.
Commit
b258a41cf87dcca830f5c1e77e10bfb313c16b14cf541e706154043075fb38fd
Parent
e70ceb1a9475873…
1 file changed
+13
-4
+13
-4
| --- src/builtin.c | ||
| +++ src/builtin.c | ||
| @@ -230,10 +230,12 @@ | ||
| 230 | 230 | int eDelivery; /* Delivery mechanism */ |
| 231 | 231 | } builtin; |
| 232 | 232 | |
| 233 | 233 | #if INTERFACE |
| 234 | 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. | |
| 235 | 237 | */ |
| 236 | 238 | #define JS_INLINE 0 /* inline, batched together at end of file */ |
| 237 | 239 | #define JS_SEPARATE 1 /* Separate HTTP request for each JS file */ |
| 238 | 240 | #define JS_BUNDLED 2 /* One HTTP request to load all JS files */ |
| 239 | 241 | /* concatenated together into a bundle */ |
| @@ -274,15 +276,22 @@ | ||
| 274 | 276 | ** Returns the name of the current JS delivery mode for reuse with the --jsmode |
| 275 | 277 | ** option, i.e. the other way around than builtin_set_js_delivery_mode(). |
| 276 | 278 | */ |
| 277 | 279 | const char *builtin_get_js_delivery_mode_name(void){ |
| 278 | 280 | 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 | + } | |
| 282 | 292 | } |
| 283 | - return ""; /* builtin_set_js_delivery_mode() handles invalid names. */ | |
| 284 | 293 | } |
| 285 | 294 | |
| 286 | 295 | /* |
| 287 | 296 | ** The caller wants the Javascript file named by zFilename to be |
| 288 | 297 | ** included in the generated page. Add the file to the queue of |
| 289 | 298 |
| --- 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 |