WWW-Mechanize-PhantomJS
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/WWW/Mechanize/PhantomJS/ghostdriver/request_handlers/session_manager_request_handler.js view on Meta::CPAN
// Prepare the session to be deleted
_sessions[sessionId].aboutToDelete();
// Delete the session and the handler
delete _sessions[sessionId];
delete _sessionRHs[sessionId];
}
},
_deleteSessionCommand = function(req, res) {
var sId = req.urlParsed.file;
if (sId === "")
throw _errors.createInvalidReqMissingCommandParameterEH(req);
if (typeof(_sessions[sId]) !== "undefined") {
_deleteSession(sId);
res.success(sId);
} else {
throw _errors.createInvalidReqVariableResourceNotFoundEH(req);
}
},
_getSessionCapabilitiesCommand = function(req, res) {
var sId = req.urlParsed.file,
session;
if (sId === "")
throw _errors.createInvalidReqMissingCommandParameterEH(req);
session = _getSession(sId);
if (session !== null) {
res.success(sId, _sessions[sId].getCapabilities());
} else {
throw _errors.createInvalidReqVariableResourceNotFoundEH(req);
}
},
_getSession = function(sessionId) {
if (typeof(_sessions[sessionId]) !== "undefined") {
return _sessions[sessionId];
}
return null;
},
_getSessionReqHand = function(sessionId) {
if (_getSession(sessionId) !== null) {
// The session exists: what about the relative Session Request Handler?
if (typeof(_sessionRHs[sessionId]) === "undefined") {
_sessionRHs[sessionId] = new ghostdriver.SessionReqHand(_getSession(sessionId));
}
return _sessionRHs[sessionId];
}
return null;
},
_cleanupWindowlessSessions = function() {
var sId;
// Do this cleanup only if there are sessions
if (Object.keys(_sessions).length > 0) {
_log.info("_cleanupWindowlessSessions", "Asynchronous Sessions clean-up phase starting NOW");
for (sId in _sessions) {
if (_sessions[sId].getWindowsCount() === 0) {
_deleteSession(sId);
_log.info("_cleanupWindowlessSessions", "Deleted Session '"+sId+"', because windowless");
}
}
}
};
// Regularly cleanup un-used sessions
setInterval(_cleanupWindowlessSessions, _CLEANUP_WINDOWLESS_SESSIONS_TIMEOUT);
// public:
return {
handle : _handle,
getSession : _getSession,
getSessionReqHand : _getSessionReqHand
};
};
// prototype inheritance:
ghostdriver.SessionManagerReqHand.prototype = new ghostdriver.RequestHandler();
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.588 second using v1.00-cache-2.02-grep-82fe00e-cpan-1310916c57ae )