I am having a problem with the Chrome browser and not Firefox.
Paused on exception ReferenceError: browser is not defined
ReferenceError: browser is not defined at shouldWrapAPIs (polyfill.js:228) at polyfill.js:250
I can’t identify the cause of the problem, only that it happens in Chrome and not Firefox.
Could someone give me some help indicating what causes that problem?
It shows me in polyfill.js the following. indicating precisely the following line
return !(browser.storage.local.get() instanceof Promise);
function shouldWrapAPIs()
{
try
{
return !(browser.storage.local.get() instanceof Promise);
}
catch (error)
{
}
return true;
}
As indicated by error in the line return! (Browser.storage.local.get () instanceof Promise); I consider that it is an error that possibly comes from saving or storing data in the browser.
I save data in the browser with the following API.
export async function setItem(key: string, value: any) {
await Storage.set({
key: key,
value: value
});
}
export async function getItem(key: string) : Promise<any>{
const { value } = await Storage.get({ key: key});
return value;
}
export async function removeItem(key: string) {
await Storage.remove({ key: key });
}
Is it possible that the problem comes from there?
I use the API for example as shown in the following code:
axios.get(url+"1"+"/"+user+"/"+email)
.then((res: { data: any; }) => {
const resquest = res.data;
console.log(res.data)
if(resquest==="User alredy taken"){
onShowAlert();
}
else{
setItem("isRegistered", user );
setItem("infoCompleted", false);
setItem("clientType", "1");
setCount(5);
}
})
Thanks in advance.