firebase - Firefox Addon 中的 Firebase:此应用程序运行的环境不支持此操作
问题描述
编辑:
我刚刚注意到我错误地发现了错误并且有一些错误:
运行此应用程序的环境不支持此操作。\"location.protocol\" 必须是 http、https 或 chrome-extension 并且必须启用网络存储
这是有道理的,因为我的页面的地址从moz-extension
.
有什么解决方法吗?
原始问题:
我正在构建 Firefox 扩展。它会更改打开新标签后显示的默认页面。我想在该页面上使用 Firebase Auth。
在显示的 html 中,我创建了一个用于 Google 登录的按钮。单击它时,将执行以下代码:
var provider = new firebase.auth.GoogleAuthProvider();
$("#authenticated_user_content").hide();
$("#google_login").on("click", function() {
console.log("GOogle login");
firebase
.auth()
.signInWithPopup(provider)
.then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
$("#not_logged_in_content").show();
$("#authenticated_user_content").show();
})
.catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});
});
发生的情况是:单击#google_login
在浏览器控制台中显示“Google 登录”消息,但没有带有 Google 登录表单的弹出窗口。
Firefox 不会在控制台中显示任何错误(F12
在浏览器中单击后)。我厌倦了去about:debugging
点击Debug
我的分机旁边。#google_login
单击按钮后出现新窗口并显示此消息:
TypeError:无法访问死对象
还有其他方法可以调查问题所在吗?为什么弹窗不显示?Firefox 是否会阻止扩展程序显示的网页中的此类功能?
解决方案
推荐阅读
- compiler-construction - 野牛中间规则动作不起作用
- vbscript - 通过命令行 .rev1 在 Windows 中重命名由条件选择的多个文件
- django - 如何在 Django 中检查和存储特定时间段?
- r - Test R app via openCPU localy
- elasticsearch - 嵌套对象的 Elasticsearch 查询
- api - 如何在 BigCommerce Api 中向购物车行项目添加修饰符
- ionic3 - 在 ionic v3 中使用 img src"" 添加授权
- firebase - 是否可以向 Firebase 默认的“session_start”事件添加参数?
- java - 是否可以访问我在调试窗口中看到的 $loader 变量?
- vba - 范围的联合在 VBA 函数中不起作用