I'm writing a user JS script for Opera, and I'm trying to use window.opera.scriptStorage to store and retrieve values.
I have created a type called __EnvDriver to encapsulate the script storage.
window.__EnvDriver.storage = window.opera.scriptStorage;
if(window.__EnvDriver.storage == undefined)
{
console.log('[__EnvDriver] Opera UserJS script storage seems to be disabled. Please set the quota to a non-zero value in opera:config.');
}
window.__EnvDriver.storageGetValue = function(key)
{
return window.__EnvDriver.storage[key];
};
window.__EnvDriver.storageSetValue = function(key, value)
{
window.__EnvDriver.storage[key] = value;
};
(The functions othe __EnvDriver type are determined at runtime, to easily implement support for Firefox or Chrome in the future.)
I can store values without problem, but when trying to read a value, I get the following error:
Uncaught exception: ReferenceError: Security error: attempted to read protected variable
Error thrown at line 45, column 2 in <anonymous function: window.__EnvDriver.storageGetValue>(key):
return window.__EnvDriver.storage[key];
The problem seems to be with accessing the window.__EnvDriver.storage
value, as the same error occurs when I try to use it in any way. I tried storing the storage object in different places, but all of them show the same behavior. This seem to have been occurring only since the very latest Opera update (v12.01).
Any help would be greatly appreciated.