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

html5 localStorage error when using safari in private mode

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.9
    • 2.9.3
    • JavaScript
    • MOODLE_29_STABLE
    • MOODLE_29_STABLE
    • 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).

    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

            andrew_dc_hancox Andrew Hancox
            andrew_dc_hancox Andrew Hancox
            Dan Poltawski Dan Poltawski
            Andrew Lyons Andrew Lyons
            Simey Lameze Simey Lameze
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9/Nov/15