Opened 9 years ago

Closed 7 years ago

#11050 closed defect (worksforme)

dojox.storage.Provider.clear API incorrect

Reported by: Jared Jurkiewicz Owned by: Shane O'Sullivan
Priority: high Milestone: 1.9
Component: Dojox Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Adam Peller)

Reported by Karl Bishop (IBM)

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 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 (4)

comment:1 Changed 9 years ago by Jared Jurkiewicz

Description: modified (diff)

comment:2 Changed 9 years ago by Adam Peller

Description: modified (diff)

comment:3 Changed 9 years ago by Adam Peller

Summary: Dojox.storage issuedojox.storage.Provider.clear API incorrect

comment:4 Changed 7 years ago by dylan

Milestone: tbd1.9
Resolution: worksforme
Status: newclosed

dojox/storage is deprecated. That said, if you want to send an updated patch, I'll commit it.

Note: See TracTickets for help on using tickets.