Fix the CookieManager issue #172
This commit is contained in:
parent
e955d17460
commit
f110da267e
1 changed files with 28 additions and 0 deletions
28
index.js
28
index.js
|
@ -230,6 +230,34 @@ const ContainerService = {
|
||||||
version: self.version
|
version: self.version
|
||||||
}).sendEvent;
|
}).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
|
// utility methods
|
||||||
|
|
Loading…
Add table
Reference in a new issue