我有一个Firefox的bootstrapped扩展.现在我想实现nsIContentPolicy XPCOM组件.我写了一个组件模块代码.现在我想注册这个组件.我想注册组件的原因是我想将我的组件添加到 nsICategoryManager.addCategoryEntry"content-policy"类别.
var {Cc, Ci, Cu} = require("chrome");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
//console.error("Running interceptor");
function Interceptor()
}
Interceptor.prototype = {
classDescription: "DeferredTo HTTP requests Interceptor",
classID: "{B5B3D9A0-08FC-11E3-8253-5EF06188709B}",
contractID: "@deferredto.com/Interceptor;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPolicy]),
shouldLoad : function dt_shouldLoad(aContentType, aContentLocation, aRequestOrigin, aContext, aMimeTypeGuess, aExtra) {
console.log("dt_shouldLoad");
if (contentLocation.scheme != "http" && contentLocation.scheme != "https")
return Ci.nsIContentPolicy.ACCEPT;
let result = Ci.nsIContentPolicy.ACCEPT;
// we should check for TYPE_SUBDOCUMENT as well if we want frames.
if ((Ci.nsIContentPolicy.TYPE_DOCUMENT == aContentType) &&
SOME_REGULAR_EXPRESSION.test(aContentLocation.spec)) {
// do stuff here, possibly changing …Run Code Online (Sandbox Code Playgroud) 我正在开发使用 Zoom API 的网络应用程序。在此应用程序中,用户能够参加特定的 Zoom 会议。目前,我们使用基于 HTTPS 的链接,但 Zoom 的链接提供了非常低质量的用户体验。如何将用户重定向到zoomus://会议?我发现 Zoom Documentation存在这样的链接。并没有找到有关这些链接格式的信息。
所以,我的问题是:
zoomus://URL 架构链接的格式是什么我有一个名为的设置页面posting.pug,它是extends一个哈巴狗settingsLayout模板。我的应用程序中有几个设置页面。我想将一个变量传递 posting=1到settingsLayout页面以向用户显示发布页面是当前页面。
我应该如何将变量传递给我扩展的模板?
我之前尝试设置一个变量extends。这是不允许的。
我尝试将它作为属性传递 - 不起作用。
Laular AngularJS(1.3 beta 19)使用eval.这在铬镀铬中是禁止的.
如何解决问题而不允许进行贬值?
错误信息:
拒绝将字符串评估为JavaScript,因为"unsafe-eval"不是以下内容安全策略指令中允许的脚本源:"script-src'self'chrome-extension-resource:".
堆栈跟踪:
angular.js:1011
csp angular.js:1011
(anonymous function) angular.js:23556
Run Code Online (Sandbox Code Playgroud)
更新:请参阅https://docs.angularjs.org/api/ng/directive/ngCsp的文档ng-csp
OUTDATED:看起来AngularJS无法在chrome扩展中检测到CSP.使用显式ng-csp.链接到AngularJS问题:https://github.com/angular/angular.js/issues/8777