Fix the CookieManager issue #172

This commit is contained in:
baku 2017-02-21 00:42:01 +01:00 committed by Jonathan Kingston
parent e955d17460
commit f110da267e

View file

@ -230,6 +230,34 @@ const ContainerService = {
version: self.version
}).sendEvent;
// Begin-Of-Hack
function workaroundForCookieManager(method, userContextId) {
let identity = method.call(ContextualIdentityService, userContextId);
if (!identity && userContextId) {
identity = {
userContextId,
icon: "",
color: "",
name: "Pending to be deleted",
public: true,
}
}
return identity;
}
let oldGetIdentityFromId = ContextualIdentityService.getIdentityFromId;
ContextualIdentityService.getIdentityFromId = function(userContextId) {
return workaroundForCookieManager(oldGetIdentityFromId, userContextId);
}
if ("getPublicIdentityFromId" in ContextualIdentityService) {
let oldGetPublicIdentityFromId = ContextualIdentityService.getIdentityFromId;
ContextualIdentityService.getIdentityFromId = function(userContextId) {
return workaroundForCookieManager(oldGetPublicIdentityFromId, userContextId);
}
}
// End-Of-Hack
},
// utility methods