Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Firefox: "Permission denied ... Components.classes"

Reply
Thread Tools

Firefox: "Permission denied ... Components.classes"

 
 
kj
Guest
Posts: n/a
 
      02-03-2008



Hi!

I'd like to implement a "global error observer" [GEO] for my
JavaScript scripts. The ideal GEO would be one that would be able
to detect any error or exception whatsoever (including those
triggered by throw), and optionally execute some code in response.

I realize that the implementation of a GEO is probably intimately
tied to the browser, but for starters, I'd be happy to be able to
do this for Firefox.

My first (very naive) approach was to define an onerror event
handler for the 'body' element, but I immediately discovered that
this misses the exceptions raised by "throw". I want something
better.

I spent some time trying to figure out how Firebug
(http://www.getfirebug.com) does it, and I determined that it relies
on an "addObserver" method of a certain "observer-service" class.
To load this class, Firebug executes the equivalent of this:

var C = Components;
var _CC = C.classes; // *bombs*
var _CI = Components.interfaces;
var c_name = '@mozilla.org/observer-service;1';
var iface_name = 'nsIObserverService';
var observer_service = _CC[ c_name ].getService( _CI[ iface_name ] );

But when I try to execute this code (specifically, the line indicated
with the comment) I get the error

[Exception... "'Permission denied to get property UnnamedClass.classes' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]

Does anyone know how I can get around this problem?

TIA!

kynn

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
 
Reply With Quote
 
 
 
 
Joost Diepenmaat
Guest
Posts: n/a
 
      02-03-2008
kj <(E-Mail Removed)> writes:

> [Exception... "'Permission denied to get property
> UnnamedClass.classes' when calling method:
> [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e
> (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]
>
> Does anyone know how I can get around this problem?


Sounds like that stuff is not accessible to user scripts. Lots of things
in mozilla are restricted like that for obvious reasons.

Run the code from a FF extension (or use greasemonkey).

Joost.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
403 Forbidden: You were denied access because: Access denied by access control list Southern Kiwi NZ Computing 6 03-19-2006 05:19 AM
Access to workgroup denied =?Utf-8?B?QnVkIEtldHRlcmw=?= Wireless Networking 2 01-07-2005 03:37 AM
Access denied over wireless network =?Utf-8?B?cnZiYXNz?= Wireless Networking 3 11-13-2004 02:46 PM
Access denied =?Utf-8?B?U2FzZmxv?= Wireless Networking 1 10-12-2004 08:07 PM
Access Denied Ed. Wireless Networking 1 08-11-2004 05:28 PM



Advertisments