|
@ -40,14 +40,12 @@ |
|
|
var µm = µMatrix; |
|
|
var µm = µMatrix; |
|
|
|
|
|
|
|
|
var recordPageCookiesQueue = new Map(); |
|
|
var recordPageCookiesQueue = new Map(); |
|
|
var removePageCookiesQueue = new Map(); |
|
|
|
|
|
var removeCookieQueue = new Set(); |
|
|
var removeCookieQueue = new Set(); |
|
|
var cookieDict = new Map(); |
|
|
var cookieDict = new Map(); |
|
|
var cookieEntryJunkyard = []; |
|
|
var cookieEntryJunkyard = []; |
|
|
var processRemoveQueuePeriod = 2 * 60 * 1000; |
|
|
var processRemoveQueuePeriod = 2 * 60 * 1000; |
|
|
var processCleanPeriod = 10 * 60 * 1000; |
|
|
var processCleanPeriod = 10 * 60 * 1000; |
|
|
var processPageRecordQueueTimer = null; |
|
|
var processPageRecordQueueTimer = null; |
|
|
var processPageRemoveQueueTimer = null; |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
@ -260,24 +258,6 @@ var recordPageCookie = (function() { |
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
// Look for cookies to potentially remove for a specific web page
|
|
|
|
|
|
|
|
|
|
|
|
var removePageCookiesAsync = function(pageStats) { |
|
|
|
|
|
// Hold onto pageStats objects so that it doesn't go away
|
|
|
|
|
|
// before we handle the job.
|
|
|
|
|
|
// rhill 2013-10-19: pageStats could be nil, for example, this can
|
|
|
|
|
|
// happens if a file:// ... makes an xmlHttpRequest
|
|
|
|
|
|
if ( !pageStats ) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
removePageCookiesQueue.set(pageStats.pageUrl, pageStats); |
|
|
|
|
|
if ( processPageRemoveQueueTimer === null ) { |
|
|
|
|
|
processPageRemoveQueueTimer = vAPI.setTimeout(processPageRemoveQueue, 15 * 1000); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
// Candidate for removal
|
|
|
// Candidate for removal
|
|
|
|
|
|
|
|
|
var removeCookieAsync = function(cookieKey) { |
|
|
var removeCookieAsync = function(cookieKey) { |
|
@ -332,17 +312,6 @@ var processPageRecordQueue = function() { |
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
var processPageRemoveQueue = function() { |
|
|
|
|
|
processPageRemoveQueueTimer = null; |
|
|
|
|
|
|
|
|
|
|
|
for ( var pageStore of removePageCookiesQueue.values() ) { |
|
|
|
|
|
findAndRemovePageCookies(pageStore); |
|
|
|
|
|
} |
|
|
|
|
|
removePageCookiesQueue.clear(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
// Effectively remove cookies.
|
|
|
// Effectively remove cookies.
|
|
|
|
|
|
|
|
|
var processRemoveQueue = function() { |
|
|
var processRemoveQueue = function() { |
|
@ -442,16 +411,6 @@ var findAndRecordPageCookies = function(pageStore) { |
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
var findAndRemovePageCookies = function(pageStore) { |
|
|
|
|
|
for ( var cookieKey of cookieDict.keys() ) { |
|
|
|
|
|
if ( cookieMatchDomains(cookieKey, pageStore.allHostnamesString) ) { |
|
|
|
|
|
removeCookieAsync(cookieKey); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
var canRemoveCookie = function(cookieKey, srcHostnames) { |
|
|
var canRemoveCookie = function(cookieKey, srcHostnames) { |
|
|
var cookieEntry = cookieDict.get(cookieKey); |
|
|
var cookieEntry = cookieDict.get(cookieKey); |
|
|
if ( cookieEntry === undefined ) { return false; } |
|
|
if ( cookieEntry === undefined ) { return false; } |
|
@ -587,8 +546,7 @@ vAPI.setTimeout(processClean, processCleanPeriod); |
|
|
// Expose only what is necessary
|
|
|
// Expose only what is necessary
|
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
recordPageCookies: recordPageCookiesAsync, |
|
|
|
|
|
removePageCookies: removePageCookiesAsync |
|
|
|
|
|
|
|
|
recordPageCookies: recordPageCookiesAsync |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
|