Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-59148

Use fallback CSS whilst waiting for CSS to build

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Setup
      1. Open your browsers dev tools to their network tab, filtered to 'styles.php'
      2. Disable the browser cache and, if possible, enable the "Preserve log" function to assist you
      Generic tests
      1. Refresh the page
      2. Purge your caches and refresh the page (or press the "Purge all caches" link)
        1. Confirm that there was a single request to styles.php which returned straight away
        2. Confirm that the page fully rendered and that the call to styles.php looks to have finished
      3. Navigate to another page
        1. Confirm that there was a single request to styles.php which returned straight away
        2. Confirm that the theme looks as anticipated, including language direction
      RTL Langauge
      1. Switch to an RTL language
      2. Run the Generic tests again
      3. Switch between LTR + RTL langauges without a cache purge, confirming that you get the correct stylesheet each time
      Alternative theme test
      1. Repeat all of the above tests with the More and Clean themes.
      Brownie test
      1. Add error_log calls to theme/styles.php around the fallback handling and:
        1. see if you can understand how it works
        2. ensure that if one fallback process starts the queueing process, that another just skips the process entirely because it's unable to get the lock
      Changes test
      1. Make a change to something obvious in your theme (e.g. colour) and save changes
        1. Confirm that there was a single request to styles.php which returned straight away
        2. Confirm that the page fully rendered and that the call to styles.php looks to have finished
      2. Wait a while for the theme to generate and navigate to a different page
      3. Make a change to something obvious in your theme (e.g. colour) and save changes
        1. Confirm that the change was present
        2. Confirm that there was a single request to styles.php which returned straight away
      Show
      Setup Open your browsers dev tools to their network tab, filtered to 'styles.php' Disable the browser cache and, if possible, enable the "Preserve log" function to assist you Generic tests Refresh the page Purge your caches and refresh the page (or press the "Purge all caches" link) Confirm that there was a single request to styles.php which returned straight away Confirm that the page fully rendered and that the call to styles.php looks to have finished Navigate to another page Confirm that there was a single request to styles.php which returned straight away Confirm that the theme looks as anticipated, including language direction RTL Langauge Switch to an RTL language Run the Generic tests again Switch between LTR + RTL langauges without a cache purge, confirming that you get the correct stylesheet each time Alternative theme test Repeat all of the above tests with the More and Clean themes. Brownie test Add error_log calls to theme/styles.php around the fallback handling and: see if you can understand how it works ensure that if one fallback process starts the queueing process, that another just skips the process entirely because it's unable to get the lock Changes test Make a change to something obvious in your theme (e.g. colour) and save changes Confirm that there was a single request to styles.php which returned straight away Confirm that the page fully rendered and that the call to styles.php looks to have finished Wait a while for the theme to generate and navigate to a different page Make a change to something obvious in your theme (e.g. colour) and save changes Confirm that the change was present Confirm that there was a single request to styles.php which returned straight away
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull Master Branch:
      MDL-59148-master-7

      Description

      When serving Just-in-time compiled themes, we should serve a fallback version of the theme while it is compiling.

      1. if the theme is currently available in localcache for the requested revision, serve it immediately and stop.
      2. if the theme revision is found in MUC, copy it to localcache, serve it immediately and stop.
      3. if there's a previous copy of the the theme, serve it now and do not die;
      4. attempt to get a lock for the theme generation
        1. if the fallback was served and it was not possible to get a lock, die immediately - there is no point generating the theme as it won't be served anyway.
      5. generate the new theme instance
      6. if the fallback was served, die immediately - there is no point serving the newly generated theme as the client has closed the connection.
      7. serve the newly generated theme

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17