mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-08-14 09:36:05 +08:00
add
This commit is contained in:
parent
6ee357aadd
commit
f76a0c75ce
@ -85,21 +85,27 @@ function AttachDebugger() {
|
|||||||
}
|
}
|
||||||
var currtabid;
|
var currtabid;
|
||||||
var currdomain;
|
var currdomain;
|
||||||
|
function get_cookie(){
|
||||||
|
chrome.cookies.getAll({}, function(cookie){
|
||||||
|
var cookies = []
|
||||||
|
for (var i = 0; i < cookie.length; i++) {
|
||||||
|
if (currdomain.indexOf(cookie[i].domain) != -1){
|
||||||
|
cookies.push(cookie[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chrome.tabs.sendMessage(currtabid, {action: {type:'getcookie', info: cookies}}, function(){})
|
||||||
|
});
|
||||||
|
}
|
||||||
chrome.extension.onMessage.addListener(function (req, sender, sendResponse){
|
chrome.extension.onMessage.addListener(function (req, sender, sendResponse){
|
||||||
if (req.getcookie){
|
if (req.getcookie){
|
||||||
currtabid = sender.tab.id
|
currtabid = sender.tab.id
|
||||||
currdomain = req.domain
|
currdomain = req.domain
|
||||||
|
get_cookie()
|
||||||
sendResponse({})
|
sendResponse({})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
chrome.cookies.onChanged.addListener(function(info){
|
chrome.cookies.onChanged.addListener(function(info){
|
||||||
if (currtabid){
|
if (currtabid){
|
||||||
chrome.cookies.getAll({domain: currdomain}, function(cookie){
|
get_cookie()
|
||||||
var cookies = []
|
|
||||||
for (var i = 0; i < cookie.length; i++) {
|
|
||||||
cookies.push(cookie[i])
|
|
||||||
}
|
|
||||||
chrome.tabs.sendMessage(currtabid, {action: {type:'getcookie', info: cookies}}, function(){})
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user