var getShortenedUrl = function () {
chrome.tabs.getSelected(null, function (tab) {
var request_data = {
'command': 'generate',
'params': {
'url': tab.url,
'code': text_field.value
}
}
chrome.extension.sendRequest(request_data, function (data) {
switch (data.status) {
case 'OK':
setTextField(data.shortened_url)
bindBtnToCoopy()
chrome.storage.local.get(data.shortened_url, function (arr) {
if (!arr[data.shortened_url]) {
chrome.storage.local.set(
{data.shortened_url:
tab.url}) /* <-- this thing throws an error */
}
})
break
/* ... */
}
})
})
}
见https://github.com/noformnocontent/git-io-chrome/blob/master/chrome/popup.js#L96
如果我把这chrome.storage.local.set
部分评论出来,一切都是“完美的”