开发者

How to assign a view object to an XUL tree widget without enablePrivilege

开发者 https://www.devze.com 2023-04-12 14:10 出处:网络
I see that enablePrivilege is deprecated in Firefox. I am trying to adapt my intranet code base to this.

I see that enablePrivilege is deprecated in Firefox. I am trying to adapt my intranet code base to this.

The most critical place is assigning the 'view' of a 'tree'开发者_如何学编程 element. This requires elevated privs, though I really don't understand why. Is there another way to do this that does not require the elevated privileges? Will a way to do this be provided before enablePrivilege goes away?

The application is not an extension but a signed JAR file that runs as content.


Looking through bug 546848, Mozilla doesn't plan to allow websites with elevated privileges any more. This functionality introduces security risks that are simply not worth it (similarly to remote XUL in general). The proposed solution would be using a Firefox extension to do any special actions that might be needed. Ideally, you would move your entire web application UI into an extension and only leave the server as a backend. But I guess that this solution would require too much effort on your side. A simpler solution would be a single-purpose extension that receives a message from your website and sets the tree view.

Interaction between privileged and non-privileged pages describes how this communication could be implemented. Your website would set a property _myTreeView on the <tree> element and dispatch an event on it. The extension would receive the event, verify that event.target.ownerDocument.defaultView.location.host is your intranet website (important, allowing any website to trigger your extension would be a security hole) and then set event.target.view = event.target.wrappedJSObject._myTreeView. See XPCNativeWrapper documentation on why wrappedJSObject is necessary here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号