2016-05-17 21:52:45 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title></title>
|
|
|
|
<script>
|
2016-11-15 11:41:23 +00:00
|
|
|
function testStorageClear (callback) {
|
|
|
|
chrome.storage.sync.clear(function () {
|
|
|
|
chrome.storage.sync.get(null, function (syncItems) {
|
|
|
|
chrome.storage.local.clear(function () {
|
|
|
|
chrome.storage.local.get(null, function(localItems) {
|
|
|
|
callback(syncItems, localItems)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function testStorageRemove (callback) {
|
|
|
|
chrome.storage.sync.remove('bar', function () {
|
2016-06-28 20:01:51 +00:00
|
|
|
chrome.storage.sync.get({foo: 'baz'}, function (syncItems) {
|
2016-11-15 11:41:23 +00:00
|
|
|
chrome.storage.local.remove(['hello'], function () {
|
2016-06-28 20:01:51 +00:00
|
|
|
chrome.storage.local.get(null, function(localItems) {
|
|
|
|
callback(syncItems, localItems)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
2016-06-09 21:14:20 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-11-15 11:41:23 +00:00
|
|
|
function testStorageSet (callback) {
|
|
|
|
chrome.storage.sync.set({foo: 'bar', bar: 'foo'}, function () {
|
|
|
|
chrome.storage.sync.get({foo: 'baz', bar: 'fooo'}, function (syncItems) {
|
|
|
|
chrome.storage.local.set({hello: 'world', world: 'hello'}, function () {
|
|
|
|
chrome.storage.local.get(null, function(localItems) {
|
|
|
|
callback(syncItems, localItems)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function testStorage (callback) {
|
|
|
|
testStorageSet(function (syncForSet, localForSet) {
|
|
|
|
testStorageRemove(function (syncForRemove, localForRemove) {
|
|
|
|
testStorageClear(function (syncForClear, localForClear) {
|
|
|
|
callback(
|
|
|
|
syncForSet, localForSet,
|
|
|
|
syncForRemove, localForRemove,
|
|
|
|
syncForClear, localForClear
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
testStorage(function (
|
|
|
|
syncForSet, localForSet,
|
|
|
|
syncForRemove, localForRemove,
|
|
|
|
syncForClear, localForClear
|
|
|
|
) {
|
2016-06-09 21:14:20 +00:00
|
|
|
var message = JSON.stringify({
|
|
|
|
runtimeId: chrome.runtime.id,
|
2016-06-09 23:35:00 +00:00
|
|
|
tabId: chrome.devtools.inspectedWindow.tabId,
|
|
|
|
i18nString: chrome.i18n.getMessage('foo', ['bar', 'baz']),
|
2016-06-28 20:01:51 +00:00
|
|
|
storageItems: {
|
2016-11-15 11:41:23 +00:00
|
|
|
local: {
|
|
|
|
set: localForSet,
|
|
|
|
remove: localForRemove,
|
|
|
|
clear: localForClear
|
|
|
|
},
|
|
|
|
sync: {
|
|
|
|
set: syncForSet,
|
|
|
|
remove: syncForRemove,
|
|
|
|
clear: syncForClear
|
|
|
|
}
|
2016-06-28 20:01:51 +00:00
|
|
|
}
|
2016-06-09 21:14:20 +00:00
|
|
|
})
|
2016-08-03 00:59:31 +00:00
|
|
|
|
2016-06-09 21:14:20 +00:00
|
|
|
var sendMessage = `require('electron').ipcRenderer.send('answer', ${message})`
|
|
|
|
window.chrome.devtools.inspectedWindow.eval(sendMessage, function () {})
|
2016-06-06 21:36:01 +00:00
|
|
|
})
|
2016-05-17 21:52:45 +00:00
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
a custom devtools extension
|
|
|
|
</body>
|
|
|
|
</html>
|