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

html5 localStorage error when using safari in private mode

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9
    • Fix Version/s: 2.9.3
    • Component/s: JavaScript
    • Labels:
    • Testing Instructions:
      Hide
      1. Open a Private Browsing tab in Safari
      2. Run the following code in the developer tools' Console:

        require(['core/localstorage'], function(s) {s.set('foo', 'bar');});
        

      3. Repeat on Safari (non-private), Chrome (private + non-private), IE (private + non-private), and Firefox (private + non-private).
      Show
      Open a Private Browsing tab in Safari Run the following code in the developer tools' Console: require(['core/localstorage'], function(s) {s.set('foo', 'bar');}); Repeat on Safari (non-private), Chrome (private + non-private), IE (private + non-private), and Firefox (private + non-private).
    • Affected Branches:
      MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull Master Branch:

      Description

      One of my clients uses Safari in private mode a lot and had issues with a feature I developed which utilised the new templating engine. When Moodle renders the mustache template in browser it uses the localstorage system to cache things. In private mode safari reports local storage as being available but then throws an exception any time you try to write to it which totally breaks client side rendering of mustache templates. In order to solve this I have extended the detectSupport method in the core/localstorage javascript module to actually try to insert and remove an item, this solves the issue.
      I have no idea where in core Moodle client side js rendering is actually used so I cannot provide test instructions.

        Attachments

          Activity

            People

            Assignee:
            andrew_dc_hancox Andrew Hancox
            Reporter:
            andrew_dc_hancox Andrew Hancox
            Peer reviewer:
            Dan Poltawski
            Integrator:
            Andrew Nicols
            Tester:
            Simey Lameze
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              9/Nov/15