In my Firefox addon I\'m looking for a secure way to let content code detect the presence of the addon itself. Ideally what I\'d like to end up with is allowing content code to
Adapted from here (but using a getter to make the my_addon value read-only)
// contentWindow is the window object of a contentDocument being displayed
var s = new Components.utils.Sandbox(contentWindow);
s.window = contentWindow;
Components.utils.evalInSandbox("
window.wrappedJSObject.navigator.__defineGetter__('my_addon', function(){
return true; // or whatever we want its value to be
// (note: this is unprivileged code!)
});",
s
);