Ignore errors when copying global object

Basically I need to ignore errors when accessing properties those not available in Firefox chrome context, i.e. scripts on chrome://...
In chrome:// context, accessing the following properties throws NS_ERROR_ILLEGAL_VALUE: mozIndexedDB, indexedDB, localStorage, sessionStorage.