In the chrome developer tools you can switch between different contexts in the javascript console and individually query the chrome.storage.local.get()
and chrome.storage.sync.get()
APIs. Is there a way to view the totality of what is stored there for all of chrome?
问问题
334 次
2 回答
0
如果您查看 API 的源代码
bool StorageGetFunction::RunWithStorage(ValueStore* storage) {
Value* input = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input));
switch (input->GetType()) {
case Value::TYPE_NULL:
return UseReadResult(storage->Get());
case Value::TYPE_STRING: {
std::string as_string;
input->GetAsString(&as_string);
return UseReadResult(storage->Get(as_string));
}
case Value::TYPE_LIST: {
std::vector<std::string> as_string_list;
AddAllStringValues(*static_cast<ListValue*>(input), &as_string_list);
return UseReadResult(storage->Get(as_string_list));
}
case Value::TYPE_DICTIONARY: {
DictionaryValue* as_dict = static_cast<DictionaryValue*>(input);
ValueStore::ReadResult result = storage->Get(GetKeys(*as_dict));
if (result->HasError()) {
return UseReadResult(result.Pass());
}
DictionaryValue* with_default_values = as_dict->DeepCopy();
with_default_values->MergeDictionary(result->settings().get());
return UseReadResult(
ValueStore::MakeReadResult(with_default_values));
}
default:
return UseReadResult(
ValueStore::MakeReadResult(kUnsupportedArgumentType));
}
}
存储类型用作查询结果的参数。因此,到目前为止,还无法查看所有 chrome 中存储的全部内容,您必须使用两个不同的查询(chrome.storage.local.get()
和chrome.storage.sync.get()
API)。
于 2013-02-14T06:40:53.230 回答
0
你试过这个吗?控制台.log(chrome.storage);
于 2013-10-17T04:42:44.380 回答