Opened 9 years ago

Closed 9 years ago

#11250 closed defect (duplicate)

dojox.storage.Provider.clear API incorrect

Reported by: Adam Peller Owned by: Shane O'Sullivan
Priority: high Milestone: tbd
Component: Dojox Version: 1.5.0b2
Keywords: Cc:
Blocked By: Blocking:

Description

The DojoDoc? for: dojox.storage.Provider.js::clear(/*string?*/namespace) states:

"Completely clears this storage system of all of it's [sic] values and keys. If 'namespace' is provided just clears the keys in that namespace."

This is incorrect based on the the implementations for WhatWG and Flash storage implementations. If the 'namespace' is not provided in the clear call, it does not purge storage of all values as stated, but only clears the storage for the "default" namespace.

I would like to say that the impls are incorrect and that proper behavior should purge all values from all namespaces as stated in the API doc. The only reason I'm raising this as a bug is that it caused a lot of pain and debugging to identify the root cause of of an engagement issue due to this conflict form expected behavior.

Workaround is trivial:

dojo.forEach( dojox.storage.getNamespaces(), function(ns) {
    //console.debug(F, "Purging storage for namespace: ", ns);
    dojox.storage.clear( ns );
});
//-- This clear is not required as the internal default ns is purged above
//-- but is left here for completeness.
//console.debug(F, "Purging generic storage");
dojox.storage.clear();

Change History (1)

comment:1 Changed 9 years ago by Adam Peller

Resolution: duplicate
Status: newclosed

oops. dup of #11050

Note: See TracTickets for help on using tickets.