Fossil SCM
Assorted minor improvements to the javascript.md doc.
Commit
dc1bc21388dbe2d8bcb45b2aecdf300a20166d91a2faa13b5ec73379738e04f0
Parent
5648dcfc3d8452e…
1 file changed
+54
-46
+54
-46
| --- www/javascript.md | ||
| +++ www/javascript.md | ||
| @@ -120,22 +120,19 @@ | ||
| 120 | 120 | Fossil attempts to set two cookies on all web clients: a login session |
| 121 | 121 | cookie and a display preferences cookie. These cookies are restricted to |
| 122 | 122 | the Fossil instance, so even this limited data cannot leak between |
| 123 | 123 | Fossil instances or into other web sites. |
| 124 | 124 | |
| 125 | - There is some server-side event logging, but that is done entirely | |
| 126 | - without JavaScript, so it’s off-topic here. | |
| 127 | - | |
| 128 | 125 | 5. “**JavaScript is fundamentally insecure.**” |
| 129 | 126 | |
| 130 | - JavaScript is historically associated with some nefarious uses, but | |
| 131 | - if we wish to have more features in Fossil, the alternative is to | |
| 132 | - add more C code to the Fossil binary, a language with *far more* | |
| 133 | - historical security problems associated with it. | |
| 127 | + JavaScript is certainly sometimes used for nefarious ends, but if we | |
| 128 | + wish to have more features in Fossil, the alternative is to add more | |
| 129 | + code to the Fossil binary, [most likely in C][fslpl], a language | |
| 130 | + implicated in [over 4× more security vulnerabilities][whmsl]. | |
| 134 | 131 | |
| 135 | - Does it not make sense to place as much trust in Fossil’s JavaScript | |
| 136 | - code as in its C code? | |
| 132 | + Therefore, does it not make sense to place approximately four times | |
| 133 | + as much trust in Fossil’s JavaScript code as in its C code? | |
| 137 | 134 | |
| 138 | 135 | The question is not whether JavaScript is itself evil, it is whether |
| 139 | 136 | its *authors* are evil. *Every byte* of JavaScript code used within |
| 140 | 137 | the Fossil UI is: |
| 141 | 138 | |
| @@ -207,11 +204,11 @@ | ||
| 207 | 204 | between these two forces, the number of no-JS purists among Fossil’s |
| 208 | 205 | user base is still a tiny minority. |
| 209 | 206 | |
| 210 | 207 | 9. <a id="block"></a>“**I block JavaScript entirely in my browser. That breaks Fossil.**” |
| 211 | 208 | |
| 212 | - First, see our philosophy statement above. Briefly, we intend that | |
| 209 | + First, see our philosophy statements above. Briefly, we intend that | |
| 213 | 210 | there always be some other way to get any given result without using |
| 214 | 211 | JavaScript, developer interest willing. |
| 215 | 212 | |
| 216 | 213 | But second, it doesn’t have to be all-or-nothing. We recommend that |
| 217 | 214 | those interested in blocking problematic uses of JavaScript use |
| @@ -224,20 +221,20 @@ | ||
| 224 | 221 | exclude other tools. |
| 225 | 222 | |
| 226 | 223 | The primary difference between these two for our purposes is that |
| 227 | 224 | NoScript lets you select scripts to run on a page on a case-by-case |
| 228 | 225 | basis, whereas uBlock Origin delegates those choices to a group of |
| 229 | - motivated volunteers who maintain whitelists and blacklists to control | |
| 230 | - all of this; you can then override UBO’s stock rules as needed. | |
| 226 | + motivated volunteers who maintain allow/block lists to control all | |
| 227 | + of this; you can then override UBO’s stock rules as needed. | |
| 231 | 228 | |
| 232 | 229 | |
| 233 | 230 | 10. “**My browser doesn’t even *have* a JavaScript interpreter.**” |
| 234 | 231 | |
| 235 | 232 | The Fossil open source project has no full-time developers, and only |
| 236 | 233 | a few of these part-timers are responsible for the bulk of the code |
| 237 | 234 | in Fossil. If you want Fossil to support such niche use cases, then |
| 238 | - you will have to [get involved with its development][cg]; it’s | |
| 235 | + you will have to [get involved with its development][cg]: it’s | |
| 239 | 236 | *your* uncommon itch. |
| 240 | 237 | |
| 241 | 238 | 11. <a id="compat"></a>“**Fossil’s JavaScript code isn’t compatible with my browser.**” |
| 242 | 239 | |
| 243 | 240 | The Fossil project’s developers aim to remain compatible with |
| @@ -250,32 +247,39 @@ | ||
| 250 | 247 | |
| 251 | 248 | We set this threshold based on the amount of time it typically takes for |
| 252 | 249 | new standards to propagate through the installed base. |
| 253 | 250 | |
| 254 | 251 | As of this writing, this means we are only using features defined in |
| 255 | - [ECMAScript 2015][es2015], colloquially called “JavaScript 6.” That is a | |
| 256 | - sufficiently rich standard that it more than suffices for our purposes. | |
| 252 | + [ECMAScript 2015][es2015], colloquially called “JavaScript 6.” That | |
| 253 | + is a sufficiently rich standard that it more than suffices for our | |
| 254 | + purposes, and it is [widely deployed][es6dep]. The biggest single | |
| 255 | + outlier remaining is MSIE 11, and [even Microsoft is moving their | |
| 256 | + own products off of it][ie11x]. | |
| 257 | 257 | |
| 258 | 258 | [2cbsd]: https://fossil-scm.org/home/doc/trunk/COPYRIGHT-BSD2.txt |
| 259 | 259 | [ciu]: https://caniuse.com/ |
| 260 | 260 | [cskin]: ./customskin.md |
| 261 | 261 | [dcsp]: ./defcsp.md |
| 262 | 262 | [es2015]: https://ecma-international.org/ecma-262/6.0/ |
| 263 | +[es6dep]: https://caniuse.com/#feat=es6 | |
| 263 | 264 | [fcgi]: /help?cmd=cgi |
| 264 | 265 | [ffor]: https://fossil-scm.org/forum/ |
| 265 | 266 | [flic]: /doc/trunk/COPYRIGHT-BSD2.txt |
| 266 | 267 | [fshome]: /doc/trunk/www/server/ |
| 268 | +[fslpl]: /doc/trunk/www/fossil-v-git.wiki#portable | |
| 267 | 269 | [fsrc]: https://fossil-scm.org/home/file/src |
| 268 | 270 | [fsrv]: /help?cmd=server |
| 269 | 271 | [hljs]: https://fossil-scm.org/forum/forumpost/9150bc22ca |
| 272 | +[ie11x]: https://techcommunity.microsoft.com/t5/microsoft-365-blog/microsoft-365-apps-say-farewell-to-internet-explorer-11-and/ba-p/1591666 | |
| 270 | 273 | [ns]: https://noscript.net/ |
| 271 | 274 | [pjs]: https://fossil-scm.org/forum/forumpost/1198651c6d |
| 272 | 275 | [s1]: https://blockmetry.com/blog/javascript-disabled |
| 273 | 276 | [s2]: https://gds.blog.gov.uk/2013/10/21/how-many-people-are-missing-out-on-javascript-enhancement/ |
| 274 | 277 | [s3]: https://w3techs.com/technologies/overview/client_side_language/all |
| 275 | 278 | [ubo]: https://github.com/gorhill/uBlock/ |
| 276 | 279 | [v8]: https://en.wikipedia.org/wiki/V8_(JavaScript_engine) |
| 280 | +[whmsl]: https://www.whitesourcesoftware.com/most-secure-programming-languages/ | |
| 277 | 281 | |
| 278 | 282 | |
| 279 | 283 | ---- |
| 280 | 284 | |
| 281 | 285 | ## <a id="uses"></a>Places Where Fossil’s Web UI Uses JavaScript |
| @@ -313,12 +317,12 @@ | ||
| 313 | 317 | [wt]: https://fossil-scm.org/fossil/timeline |
| 314 | 318 | |
| 315 | 319 | |
| 316 | 320 | ### <a id="wedit"></a>The New Wiki Editor |
| 317 | 321 | |
| 318 | -As of Fossil 2.12, the [Fossil wiki][fwt] document editor requires | |
| 319 | -JavaScript for a few unavoidable reasons. | |
| 322 | +The [new wiki editor][fwt] added in Fossil 2.12 has many new features, a | |
| 323 | +few of which are impossible to get without use of JavaScript. | |
| 320 | 324 | |
| 321 | 325 | First, it allows in-browser previews without losing client-side editor |
| 322 | 326 | state, such as where your cursor is. With the old editor, you had to |
| 323 | 327 | re-locate the place you were last editing on each preview, which would |
| 324 | 328 | reduce the incentive to use the preview function. In the new wiki |
| @@ -337,14 +341,10 @@ | ||
| 337 | 341 | that there is a way for the app to restore its prior state from |
| 338 | 342 | persistent media when it’s restarted, giving the illusion that it was |
| 339 | 343 | never shut down in the first place. This feature of Fossil’s new wiki |
| 340 | 344 | editor provides that. |
| 341 | 345 | |
| 342 | -There are many other new features in the enhanced Fossil 2.12 wiki | |
| 343 | -editor, but those are the ones that absolutely require JavaScript to | |
| 344 | -work. | |
| 345 | - | |
| 346 | 346 | With this change, we lost the old WYSIWYG wiki editor, available since |
| 347 | 347 | Fossil version 1.24. It hadn’t been maintained for years, it was |
| 348 | 348 | disabled by default, and no one stepped up to defend its existence when |
| 349 | 349 | this new editor was created, replacing it. If someone rescues that |
| 350 | 350 | feature, merging it in with the new editor, it will doubtless require |
| @@ -358,11 +358,11 @@ | ||
| 358 | 358 | desire, only because the person who wrote the new wiki editor didn’t |
| 359 | 359 | want to maintain three different editors. (New Ajaxy editor, old |
| 360 | 360 | script-free HTML form based editor, and the old WYSIWYG JavaScript-based |
| 361 | 361 | editor.) If someone wants to implement a `<noscript>` alternative to the |
| 362 | 362 | new wiki editor, we will likely accept that [contribution][cg] as long |
| 363 | -as it doensn’t interfere with the new editor. (The same goes for adding | |
| 363 | +as it doesn’t interfere with the new editor. (The same goes for adding | |
| 364 | 364 | a WYSIWYG mode to the new Ajaxy wiki editor.) |
| 365 | 365 | |
| 366 | 366 | _Workaround:_ You don’t have to use the browser-based wiki editor to |
| 367 | 367 | maintain your repository’s wiki at all. Fossil’s [`wiki` command][fwc] |
| 368 | 368 | lets you manipulate wiki documents from the command line. For example, |
| @@ -425,23 +425,26 @@ | ||
| 425 | 425 | |
| 426 | 426 | When viewing source files, Fossil offers to show line numbers in some |
| 427 | 427 | cases. ([Example][mainc].) Toggling them on and off is currently handled |
| 428 | 428 | in JavaScript, rather than forcing a page-reload via a button click. |
| 429 | 429 | |
| 430 | -_Workaround:_ Edit the URL to give the “`ln`” query parameter per [the | |
| 431 | -`/file` docs](/help?cmd=/file). Alternately, someone sufficiently | |
| 432 | -interested could [provide a patch][cg] to add a `<noscript>` wrapped | |
| 433 | -HTML button that would reload the page with this parameter | |
| 434 | -included/excluded to implement the toggle via a server round-trip. | |
| 430 | +_Workaround:_ Manually edit the URL to give the “`ln`” query parameter | |
| 431 | +per [the `/file` docs](/help?cmd=/file). | |
| 432 | + | |
| 433 | +_Potential Better Workaround:_ Someone sufficiently interested could | |
| 434 | +[provide a patch][cg] to add a `<noscript>` wrapped HTML button that | |
| 435 | +would reload the page with this parameter included/excluded to implement | |
| 436 | +the toggle via a server round-trip. | |
| 435 | 437 | |
| 436 | 438 | As of Fossil 2.12, there is also a JavaScript-based interactive method |
| 437 | 439 | for selecting a range of lines by clicking the line numbers when they’re |
| 438 | 440 | visible, then copying the resulting URL to share your selection with |
| 439 | 441 | others. |
| 440 | 442 | |
| 441 | -_Workaround:_ These interactive features absolutely require JavaScript. | |
| 442 | -The alternative is to manually edit the URL, per above. | |
| 443 | +_Workaround:_ These interactive features would be difficult and | |
| 444 | +expensive (in terms of network I/O) to implement without JavaScript. A | |
| 445 | +far simpler alternative is to manually edit the URL, per above. | |
| 443 | 446 | |
| 444 | 447 | [mainc]: https://fossil-scm.org/fossil/artifact?ln&name=87d67e745 |
| 445 | 448 | |
| 446 | 449 | |
| 447 | 450 | ### <a id="sxsdiff"></a>Side-by-Side Diff Mode |
| @@ -487,12 +490,12 @@ | ||
| 487 | 490 | similar, hovering over that check-in shows a tooltip with details about |
| 488 | 491 | the type of artifact the hash refers to and allows you to click to copy |
| 489 | 492 | the hash to the clipboard. |
| 490 | 493 | |
| 491 | 494 | _Graceful Fallback:_ When JavaScript is disabled, these tooltips simply |
| 492 | -don’t appear. You can then select and copy the hash using your browser, | |
| 493 | -make “`fossil info`” queries on those hashes, etc. | |
| 495 | +don’t appear, but you can still select and copy the hash using your | |
| 496 | +platform’s “copy selected text” feature. | |
| 494 | 497 | |
| 495 | 498 | |
| 496 | 499 | ### <a id="bots"></a>Anti-Bot Defenses |
| 497 | 500 | |
| 498 | 501 | Fossil has [anti-bot defenses][abd], and it has some JavaScript code |
| @@ -525,29 +528,34 @@ | ||
| 525 | 528 | |
| 526 | 529 | ### <a id="clock"></a>Clock |
| 527 | 530 | |
| 528 | 531 | Some stock Fossil skins include JavaScript-based features such as the |
| 529 | 532 | current time of day. The Xekri skin includes this in its header, for |
| 530 | -example. A clock feature requires JavaScript not only to get the time | |
| 531 | -and update inline on the page once a minute, but also so it displays *in | |
| 532 | -the local time zone.* | |
| 533 | - | |
| 534 | -Since none of this code provides a necessary Fossil feature, the core | |
| 535 | -developers are unlikely to try to make these features work better in the | |
| 536 | -absence of JavaScript. | |
| 537 | - | |
| 538 | -However, we are willing to study patches to make this better. For | |
| 539 | -example, the wall clock displays could include the page load time in the | |
| 540 | -dynamically generated HTML shipped from the remote Fossil server, so | |
| 541 | -that in the absence of JavaScript, you at least get the page generation | |
| 542 | -time, expressed in the server’s time zone. | |
| 533 | +example. A clock feature requires JavaScript to get the time on initial | |
| 534 | +page load and then to update it once a minute. | |
| 535 | + | |
| 536 | +You may observe that the server could provide the current time when | |
| 537 | +generating the page, but the client and server may not be in the same | |
| 538 | +time zone, and there is no reliably-provided information from the client | |
| 539 | +that would let the server give the page load time in the client’s local | |
| 540 | +time zone. The server could only tell you *its* local time at page | |
| 541 | +request time, not the client’s time. That still wouldn’t be a “clock,” | |
| 542 | +since without client-side JavaScript code running, that part of the page | |
| 543 | +couldn’t update once a second. | |
| 544 | + | |
| 545 | +_Potential Graceful Fallback:_ You may consider showing the server’s | |
| 546 | +page generation time rather than the client’s wall clock time in the | |
| 547 | +local time zone to be a useful fallback for the current feature, so [a | |
| 548 | +patch to do this][cg] may well be accepted. Since this is not a | |
| 549 | +*necessary* Fossil feature, an interested user is unlikely to get the | |
| 550 | +core developers to do this work for them. | |
| 543 | 551 | |
| 544 | 552 | ---- |
| 545 | 553 | |
| 546 | 554 | ## <a id="future"></a>Future Plans for JavaScript in Fossil |
| 547 | 555 | |
| 548 | -As of mid-2020, the informal provisional plan is to increase the Fossil | |
| 556 | +As of mid-2020, the informal provisional plan is to increase Fossil | |
| 549 | 557 | UI's use of JavaScript considerably compared to its historically minimal |
| 550 | 558 | uses. To that end, a framework of Fossil-centric APIs is being developed |
| 551 | 559 | in conjunction with new features to consolidate Fossil's historical |
| 552 | 560 | hodge-podge of JavaScript snippets into a coherent code base. |
| 553 | 561 | |
| @@ -580,7 +588,7 @@ | ||
| 580 | 588 | coding even when they really don't want to. 😉 |
| 581 | 589 | |
| 582 | 590 | In all of this, Fossil's project lead understandably has the final |
| 583 | 591 | say-so in whether any given feature indeed gets merged into the mainline |
| 584 | 592 | trunk. Development of any given feature, no matter how much effort was |
| 585 | -involved, does not guaranty its eventual inclusion into the public | |
| 593 | +involved, does not guarantee its eventual inclusion into the public | |
| 586 | 594 | releases. |
| 587 | 595 |
| --- www/javascript.md | |
| +++ www/javascript.md | |
| @@ -120,22 +120,19 @@ | |
| 120 | Fossil attempts to set two cookies on all web clients: a login session |
| 121 | cookie and a display preferences cookie. These cookies are restricted to |
| 122 | the Fossil instance, so even this limited data cannot leak between |
| 123 | Fossil instances or into other web sites. |
| 124 | |
| 125 | There is some server-side event logging, but that is done entirely |
| 126 | without JavaScript, so it’s off-topic here. |
| 127 | |
| 128 | 5. “**JavaScript is fundamentally insecure.**” |
| 129 | |
| 130 | JavaScript is historically associated with some nefarious uses, but |
| 131 | if we wish to have more features in Fossil, the alternative is to |
| 132 | add more C code to the Fossil binary, a language with *far more* |
| 133 | historical security problems associated with it. |
| 134 | |
| 135 | Does it not make sense to place as much trust in Fossil’s JavaScript |
| 136 | code as in its C code? |
| 137 | |
| 138 | The question is not whether JavaScript is itself evil, it is whether |
| 139 | its *authors* are evil. *Every byte* of JavaScript code used within |
| 140 | the Fossil UI is: |
| 141 | |
| @@ -207,11 +204,11 @@ | |
| 207 | between these two forces, the number of no-JS purists among Fossil’s |
| 208 | user base is still a tiny minority. |
| 209 | |
| 210 | 9. <a id="block"></a>“**I block JavaScript entirely in my browser. That breaks Fossil.**” |
| 211 | |
| 212 | First, see our philosophy statement above. Briefly, we intend that |
| 213 | there always be some other way to get any given result without using |
| 214 | JavaScript, developer interest willing. |
| 215 | |
| 216 | But second, it doesn’t have to be all-or-nothing. We recommend that |
| 217 | those interested in blocking problematic uses of JavaScript use |
| @@ -224,20 +221,20 @@ | |
| 224 | exclude other tools. |
| 225 | |
| 226 | The primary difference between these two for our purposes is that |
| 227 | NoScript lets you select scripts to run on a page on a case-by-case |
| 228 | basis, whereas uBlock Origin delegates those choices to a group of |
| 229 | motivated volunteers who maintain whitelists and blacklists to control |
| 230 | all of this; you can then override UBO’s stock rules as needed. |
| 231 | |
| 232 | |
| 233 | 10. “**My browser doesn’t even *have* a JavaScript interpreter.**” |
| 234 | |
| 235 | The Fossil open source project has no full-time developers, and only |
| 236 | a few of these part-timers are responsible for the bulk of the code |
| 237 | in Fossil. If you want Fossil to support such niche use cases, then |
| 238 | you will have to [get involved with its development][cg]; it’s |
| 239 | *your* uncommon itch. |
| 240 | |
| 241 | 11. <a id="compat"></a>“**Fossil’s JavaScript code isn’t compatible with my browser.**” |
| 242 | |
| 243 | The Fossil project’s developers aim to remain compatible with |
| @@ -250,32 +247,39 @@ | |
| 250 | |
| 251 | We set this threshold based on the amount of time it typically takes for |
| 252 | new standards to propagate through the installed base. |
| 253 | |
| 254 | As of this writing, this means we are only using features defined in |
| 255 | [ECMAScript 2015][es2015], colloquially called “JavaScript 6.” That is a |
| 256 | sufficiently rich standard that it more than suffices for our purposes. |
| 257 | |
| 258 | [2cbsd]: https://fossil-scm.org/home/doc/trunk/COPYRIGHT-BSD2.txt |
| 259 | [ciu]: https://caniuse.com/ |
| 260 | [cskin]: ./customskin.md |
| 261 | [dcsp]: ./defcsp.md |
| 262 | [es2015]: https://ecma-international.org/ecma-262/6.0/ |
| 263 | [fcgi]: /help?cmd=cgi |
| 264 | [ffor]: https://fossil-scm.org/forum/ |
| 265 | [flic]: /doc/trunk/COPYRIGHT-BSD2.txt |
| 266 | [fshome]: /doc/trunk/www/server/ |
| 267 | [fsrc]: https://fossil-scm.org/home/file/src |
| 268 | [fsrv]: /help?cmd=server |
| 269 | [hljs]: https://fossil-scm.org/forum/forumpost/9150bc22ca |
| 270 | [ns]: https://noscript.net/ |
| 271 | [pjs]: https://fossil-scm.org/forum/forumpost/1198651c6d |
| 272 | [s1]: https://blockmetry.com/blog/javascript-disabled |
| 273 | [s2]: https://gds.blog.gov.uk/2013/10/21/how-many-people-are-missing-out-on-javascript-enhancement/ |
| 274 | [s3]: https://w3techs.com/technologies/overview/client_side_language/all |
| 275 | [ubo]: https://github.com/gorhill/uBlock/ |
| 276 | [v8]: https://en.wikipedia.org/wiki/V8_(JavaScript_engine) |
| 277 | |
| 278 | |
| 279 | ---- |
| 280 | |
| 281 | ## <a id="uses"></a>Places Where Fossil’s Web UI Uses JavaScript |
| @@ -313,12 +317,12 @@ | |
| 313 | [wt]: https://fossil-scm.org/fossil/timeline |
| 314 | |
| 315 | |
| 316 | ### <a id="wedit"></a>The New Wiki Editor |
| 317 | |
| 318 | As of Fossil 2.12, the [Fossil wiki][fwt] document editor requires |
| 319 | JavaScript for a few unavoidable reasons. |
| 320 | |
| 321 | First, it allows in-browser previews without losing client-side editor |
| 322 | state, such as where your cursor is. With the old editor, you had to |
| 323 | re-locate the place you were last editing on each preview, which would |
| 324 | reduce the incentive to use the preview function. In the new wiki |
| @@ -337,14 +341,10 @@ | |
| 337 | that there is a way for the app to restore its prior state from |
| 338 | persistent media when it’s restarted, giving the illusion that it was |
| 339 | never shut down in the first place. This feature of Fossil’s new wiki |
| 340 | editor provides that. |
| 341 | |
| 342 | There are many other new features in the enhanced Fossil 2.12 wiki |
| 343 | editor, but those are the ones that absolutely require JavaScript to |
| 344 | work. |
| 345 | |
| 346 | With this change, we lost the old WYSIWYG wiki editor, available since |
| 347 | Fossil version 1.24. It hadn’t been maintained for years, it was |
| 348 | disabled by default, and no one stepped up to defend its existence when |
| 349 | this new editor was created, replacing it. If someone rescues that |
| 350 | feature, merging it in with the new editor, it will doubtless require |
| @@ -358,11 +358,11 @@ | |
| 358 | desire, only because the person who wrote the new wiki editor didn’t |
| 359 | want to maintain three different editors. (New Ajaxy editor, old |
| 360 | script-free HTML form based editor, and the old WYSIWYG JavaScript-based |
| 361 | editor.) If someone wants to implement a `<noscript>` alternative to the |
| 362 | new wiki editor, we will likely accept that [contribution][cg] as long |
| 363 | as it doensn’t interfere with the new editor. (The same goes for adding |
| 364 | a WYSIWYG mode to the new Ajaxy wiki editor.) |
| 365 | |
| 366 | _Workaround:_ You don’t have to use the browser-based wiki editor to |
| 367 | maintain your repository’s wiki at all. Fossil’s [`wiki` command][fwc] |
| 368 | lets you manipulate wiki documents from the command line. For example, |
| @@ -425,23 +425,26 @@ | |
| 425 | |
| 426 | When viewing source files, Fossil offers to show line numbers in some |
| 427 | cases. ([Example][mainc].) Toggling them on and off is currently handled |
| 428 | in JavaScript, rather than forcing a page-reload via a button click. |
| 429 | |
| 430 | _Workaround:_ Edit the URL to give the “`ln`” query parameter per [the |
| 431 | `/file` docs](/help?cmd=/file). Alternately, someone sufficiently |
| 432 | interested could [provide a patch][cg] to add a `<noscript>` wrapped |
| 433 | HTML button that would reload the page with this parameter |
| 434 | included/excluded to implement the toggle via a server round-trip. |
| 435 | |
| 436 | As of Fossil 2.12, there is also a JavaScript-based interactive method |
| 437 | for selecting a range of lines by clicking the line numbers when they’re |
| 438 | visible, then copying the resulting URL to share your selection with |
| 439 | others. |
| 440 | |
| 441 | _Workaround:_ These interactive features absolutely require JavaScript. |
| 442 | The alternative is to manually edit the URL, per above. |
| 443 | |
| 444 | [mainc]: https://fossil-scm.org/fossil/artifact?ln&name=87d67e745 |
| 445 | |
| 446 | |
| 447 | ### <a id="sxsdiff"></a>Side-by-Side Diff Mode |
| @@ -487,12 +490,12 @@ | |
| 487 | similar, hovering over that check-in shows a tooltip with details about |
| 488 | the type of artifact the hash refers to and allows you to click to copy |
| 489 | the hash to the clipboard. |
| 490 | |
| 491 | _Graceful Fallback:_ When JavaScript is disabled, these tooltips simply |
| 492 | don’t appear. You can then select and copy the hash using your browser, |
| 493 | make “`fossil info`” queries on those hashes, etc. |
| 494 | |
| 495 | |
| 496 | ### <a id="bots"></a>Anti-Bot Defenses |
| 497 | |
| 498 | Fossil has [anti-bot defenses][abd], and it has some JavaScript code |
| @@ -525,29 +528,34 @@ | |
| 525 | |
| 526 | ### <a id="clock"></a>Clock |
| 527 | |
| 528 | Some stock Fossil skins include JavaScript-based features such as the |
| 529 | current time of day. The Xekri skin includes this in its header, for |
| 530 | example. A clock feature requires JavaScript not only to get the time |
| 531 | and update inline on the page once a minute, but also so it displays *in |
| 532 | the local time zone.* |
| 533 | |
| 534 | Since none of this code provides a necessary Fossil feature, the core |
| 535 | developers are unlikely to try to make these features work better in the |
| 536 | absence of JavaScript. |
| 537 | |
| 538 | However, we are willing to study patches to make this better. For |
| 539 | example, the wall clock displays could include the page load time in the |
| 540 | dynamically generated HTML shipped from the remote Fossil server, so |
| 541 | that in the absence of JavaScript, you at least get the page generation |
| 542 | time, expressed in the server’s time zone. |
| 543 | |
| 544 | ---- |
| 545 | |
| 546 | ## <a id="future"></a>Future Plans for JavaScript in Fossil |
| 547 | |
| 548 | As of mid-2020, the informal provisional plan is to increase the Fossil |
| 549 | UI's use of JavaScript considerably compared to its historically minimal |
| 550 | uses. To that end, a framework of Fossil-centric APIs is being developed |
| 551 | in conjunction with new features to consolidate Fossil's historical |
| 552 | hodge-podge of JavaScript snippets into a coherent code base. |
| 553 | |
| @@ -580,7 +588,7 @@ | |
| 580 | coding even when they really don't want to. 😉 |
| 581 | |
| 582 | In all of this, Fossil's project lead understandably has the final |
| 583 | say-so in whether any given feature indeed gets merged into the mainline |
| 584 | trunk. Development of any given feature, no matter how much effort was |
| 585 | involved, does not guaranty its eventual inclusion into the public |
| 586 | releases. |
| 587 |
| --- www/javascript.md | |
| +++ www/javascript.md | |
| @@ -120,22 +120,19 @@ | |
| 120 | Fossil attempts to set two cookies on all web clients: a login session |
| 121 | cookie and a display preferences cookie. These cookies are restricted to |
| 122 | the Fossil instance, so even this limited data cannot leak between |
| 123 | Fossil instances or into other web sites. |
| 124 | |
| 125 | 5. “**JavaScript is fundamentally insecure.**” |
| 126 | |
| 127 | JavaScript is certainly sometimes used for nefarious ends, but if we |
| 128 | wish to have more features in Fossil, the alternative is to add more |
| 129 | code to the Fossil binary, [most likely in C][fslpl], a language |
| 130 | implicated in [over 4× more security vulnerabilities][whmsl]. |
| 131 | |
| 132 | Therefore, does it not make sense to place approximately four times |
| 133 | as much trust in Fossil’s JavaScript code as in its C code? |
| 134 | |
| 135 | The question is not whether JavaScript is itself evil, it is whether |
| 136 | its *authors* are evil. *Every byte* of JavaScript code used within |
| 137 | the Fossil UI is: |
| 138 | |
| @@ -207,11 +204,11 @@ | |
| 204 | between these two forces, the number of no-JS purists among Fossil’s |
| 205 | user base is still a tiny minority. |
| 206 | |
| 207 | 9. <a id="block"></a>“**I block JavaScript entirely in my browser. That breaks Fossil.**” |
| 208 | |
| 209 | First, see our philosophy statements above. Briefly, we intend that |
| 210 | there always be some other way to get any given result without using |
| 211 | JavaScript, developer interest willing. |
| 212 | |
| 213 | But second, it doesn’t have to be all-or-nothing. We recommend that |
| 214 | those interested in blocking problematic uses of JavaScript use |
| @@ -224,20 +221,20 @@ | |
| 221 | exclude other tools. |
| 222 | |
| 223 | The primary difference between these two for our purposes is that |
| 224 | NoScript lets you select scripts to run on a page on a case-by-case |
| 225 | basis, whereas uBlock Origin delegates those choices to a group of |
| 226 | motivated volunteers who maintain allow/block lists to control all |
| 227 | of this; you can then override UBO’s stock rules as needed. |
| 228 | |
| 229 | |
| 230 | 10. “**My browser doesn’t even *have* a JavaScript interpreter.**” |
| 231 | |
| 232 | The Fossil open source project has no full-time developers, and only |
| 233 | a few of these part-timers are responsible for the bulk of the code |
| 234 | in Fossil. If you want Fossil to support such niche use cases, then |
| 235 | you will have to [get involved with its development][cg]: it’s |
| 236 | *your* uncommon itch. |
| 237 | |
| 238 | 11. <a id="compat"></a>“**Fossil’s JavaScript code isn’t compatible with my browser.**” |
| 239 | |
| 240 | The Fossil project’s developers aim to remain compatible with |
| @@ -250,32 +247,39 @@ | |
| 247 | |
| 248 | We set this threshold based on the amount of time it typically takes for |
| 249 | new standards to propagate through the installed base. |
| 250 | |
| 251 | As of this writing, this means we are only using features defined in |
| 252 | [ECMAScript 2015][es2015], colloquially called “JavaScript 6.” That |
| 253 | is a sufficiently rich standard that it more than suffices for our |
| 254 | purposes, and it is [widely deployed][es6dep]. The biggest single |
| 255 | outlier remaining is MSIE 11, and [even Microsoft is moving their |
| 256 | own products off of it][ie11x]. |
| 257 | |
| 258 | [2cbsd]: https://fossil-scm.org/home/doc/trunk/COPYRIGHT-BSD2.txt |
| 259 | [ciu]: https://caniuse.com/ |
| 260 | [cskin]: ./customskin.md |
| 261 | [dcsp]: ./defcsp.md |
| 262 | [es2015]: https://ecma-international.org/ecma-262/6.0/ |
| 263 | [es6dep]: https://caniuse.com/#feat=es6 |
| 264 | [fcgi]: /help?cmd=cgi |
| 265 | [ffor]: https://fossil-scm.org/forum/ |
| 266 | [flic]: /doc/trunk/COPYRIGHT-BSD2.txt |
| 267 | [fshome]: /doc/trunk/www/server/ |
| 268 | [fslpl]: /doc/trunk/www/fossil-v-git.wiki#portable |
| 269 | [fsrc]: https://fossil-scm.org/home/file/src |
| 270 | [fsrv]: /help?cmd=server |
| 271 | [hljs]: https://fossil-scm.org/forum/forumpost/9150bc22ca |
| 272 | [ie11x]: https://techcommunity.microsoft.com/t5/microsoft-365-blog/microsoft-365-apps-say-farewell-to-internet-explorer-11-and/ba-p/1591666 |
| 273 | [ns]: https://noscript.net/ |
| 274 | [pjs]: https://fossil-scm.org/forum/forumpost/1198651c6d |
| 275 | [s1]: https://blockmetry.com/blog/javascript-disabled |
| 276 | [s2]: https://gds.blog.gov.uk/2013/10/21/how-many-people-are-missing-out-on-javascript-enhancement/ |
| 277 | [s3]: https://w3techs.com/technologies/overview/client_side_language/all |
| 278 | [ubo]: https://github.com/gorhill/uBlock/ |
| 279 | [v8]: https://en.wikipedia.org/wiki/V8_(JavaScript_engine) |
| 280 | [whmsl]: https://www.whitesourcesoftware.com/most-secure-programming-languages/ |
| 281 | |
| 282 | |
| 283 | ---- |
| 284 | |
| 285 | ## <a id="uses"></a>Places Where Fossil’s Web UI Uses JavaScript |
| @@ -313,12 +317,12 @@ | |
| 317 | [wt]: https://fossil-scm.org/fossil/timeline |
| 318 | |
| 319 | |
| 320 | ### <a id="wedit"></a>The New Wiki Editor |
| 321 | |
| 322 | The [new wiki editor][fwt] added in Fossil 2.12 has many new features, a |
| 323 | few of which are impossible to get without use of JavaScript. |
| 324 | |
| 325 | First, it allows in-browser previews without losing client-side editor |
| 326 | state, such as where your cursor is. With the old editor, you had to |
| 327 | re-locate the place you were last editing on each preview, which would |
| 328 | reduce the incentive to use the preview function. In the new wiki |
| @@ -337,14 +341,10 @@ | |
| 341 | that there is a way for the app to restore its prior state from |
| 342 | persistent media when it’s restarted, giving the illusion that it was |
| 343 | never shut down in the first place. This feature of Fossil’s new wiki |
| 344 | editor provides that. |
| 345 | |
| 346 | With this change, we lost the old WYSIWYG wiki editor, available since |
| 347 | Fossil version 1.24. It hadn’t been maintained for years, it was |
| 348 | disabled by default, and no one stepped up to defend its existence when |
| 349 | this new editor was created, replacing it. If someone rescues that |
| 350 | feature, merging it in with the new editor, it will doubtless require |
| @@ -358,11 +358,11 @@ | |
| 358 | desire, only because the person who wrote the new wiki editor didn’t |
| 359 | want to maintain three different editors. (New Ajaxy editor, old |
| 360 | script-free HTML form based editor, and the old WYSIWYG JavaScript-based |
| 361 | editor.) If someone wants to implement a `<noscript>` alternative to the |
| 362 | new wiki editor, we will likely accept that [contribution][cg] as long |
| 363 | as it doesn’t interfere with the new editor. (The same goes for adding |
| 364 | a WYSIWYG mode to the new Ajaxy wiki editor.) |
| 365 | |
| 366 | _Workaround:_ You don’t have to use the browser-based wiki editor to |
| 367 | maintain your repository’s wiki at all. Fossil’s [`wiki` command][fwc] |
| 368 | lets you manipulate wiki documents from the command line. For example, |
| @@ -425,23 +425,26 @@ | |
| 425 | |
| 426 | When viewing source files, Fossil offers to show line numbers in some |
| 427 | cases. ([Example][mainc].) Toggling them on and off is currently handled |
| 428 | in JavaScript, rather than forcing a page-reload via a button click. |
| 429 | |
| 430 | _Workaround:_ Manually edit the URL to give the “`ln`” query parameter |
| 431 | per [the `/file` docs](/help?cmd=/file). |
| 432 | |
| 433 | _Potential Better Workaround:_ Someone sufficiently interested could |
| 434 | [provide a patch][cg] to add a `<noscript>` wrapped HTML button that |
| 435 | would reload the page with this parameter included/excluded to implement |
| 436 | the toggle via a server round-trip. |
| 437 | |
| 438 | As of Fossil 2.12, there is also a JavaScript-based interactive method |
| 439 | for selecting a range of lines by clicking the line numbers when they’re |
| 440 | visible, then copying the resulting URL to share your selection with |
| 441 | others. |
| 442 | |
| 443 | _Workaround:_ These interactive features would be difficult and |
| 444 | expensive (in terms of network I/O) to implement without JavaScript. A |
| 445 | far simpler alternative is to manually edit the URL, per above. |
| 446 | |
| 447 | [mainc]: https://fossil-scm.org/fossil/artifact?ln&name=87d67e745 |
| 448 | |
| 449 | |
| 450 | ### <a id="sxsdiff"></a>Side-by-Side Diff Mode |
| @@ -487,12 +490,12 @@ | |
| 490 | similar, hovering over that check-in shows a tooltip with details about |
| 491 | the type of artifact the hash refers to and allows you to click to copy |
| 492 | the hash to the clipboard. |
| 493 | |
| 494 | _Graceful Fallback:_ When JavaScript is disabled, these tooltips simply |
| 495 | don’t appear, but you can still select and copy the hash using your |
| 496 | platform’s “copy selected text” feature. |
| 497 | |
| 498 | |
| 499 | ### <a id="bots"></a>Anti-Bot Defenses |
| 500 | |
| 501 | Fossil has [anti-bot defenses][abd], and it has some JavaScript code |
| @@ -525,29 +528,34 @@ | |
| 528 | |
| 529 | ### <a id="clock"></a>Clock |
| 530 | |
| 531 | Some stock Fossil skins include JavaScript-based features such as the |
| 532 | current time of day. The Xekri skin includes this in its header, for |
| 533 | example. A clock feature requires JavaScript to get the time on initial |
| 534 | page load and then to update it once a minute. |
| 535 | |
| 536 | You may observe that the server could provide the current time when |
| 537 | generating the page, but the client and server may not be in the same |
| 538 | time zone, and there is no reliably-provided information from the client |
| 539 | that would let the server give the page load time in the client’s local |
| 540 | time zone. The server could only tell you *its* local time at page |
| 541 | request time, not the client’s time. That still wouldn’t be a “clock,” |
| 542 | since without client-side JavaScript code running, that part of the page |
| 543 | couldn’t update once a second. |
| 544 | |
| 545 | _Potential Graceful Fallback:_ You may consider showing the server’s |
| 546 | page generation time rather than the client’s wall clock time in the |
| 547 | local time zone to be a useful fallback for the current feature, so [a |
| 548 | patch to do this][cg] may well be accepted. Since this is not a |
| 549 | *necessary* Fossil feature, an interested user is unlikely to get the |
| 550 | core developers to do this work for them. |
| 551 | |
| 552 | ---- |
| 553 | |
| 554 | ## <a id="future"></a>Future Plans for JavaScript in Fossil |
| 555 | |
| 556 | As of mid-2020, the informal provisional plan is to increase Fossil |
| 557 | UI's use of JavaScript considerably compared to its historically minimal |
| 558 | uses. To that end, a framework of Fossil-centric APIs is being developed |
| 559 | in conjunction with new features to consolidate Fossil's historical |
| 560 | hodge-podge of JavaScript snippets into a coherent code base. |
| 561 | |
| @@ -580,7 +588,7 @@ | |
| 588 | coding even when they really don't want to. 😉 |
| 589 | |
| 590 | In all of this, Fossil's project lead understandably has the final |
| 591 | say-so in whether any given feature indeed gets merged into the mainline |
| 592 | trunk. Development of any given feature, no matter how much effort was |
| 593 | involved, does not guarantee its eventual inclusion into the public |
| 594 | releases. |
| 595 |