Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

nsIContentPolicy and user interaction

2 views
Skip to first unread message

jib

unread,
Nov 27, 2006, 11:12:17 PM11/27/06
to
I'm trying to make an extension that will ask the user for confirmation
before trying to load certain files. What is a good way to do this?

http://www.xulplanet.com/references/xpcomref/ifaces/nsIContentPolicy.html
says "do not block the caller from shouldLoad or shouldProcess", so it
seems nsIContentPolicy can't be used to ask the user before loading a
page.

Boris Zbarsky

unread,
Nov 27, 2006, 11:19:05 PM11/27/06
to
jib wrote:
> http://www.xulplanet.com/references/xpcomref/ifaces/nsIContentPolicy.html
> says "do not block the caller from shouldLoad or shouldProcess", so it
> seems nsIContentPolicy can't be used to ask the user before loading a
> page.

That's correct. Doing that will lead to rendering bugs at best and exploitable
security holes at worst.

The only way to do what you want is to have your content policy deny the load,
remember enough information to restart it, then off a time out put up the
dialog, etc.

Note that some loads (POST loads come to mind, though there may also be issues
with named targets; not sure) don't pass enough information for content policy
to be able to restart them.

-Boris

0 new messages