Yamini Sharma wrote:
> 
> Hi,
> 
> I have written an xpcom component in javascript on the same lines as
> nsSample.js. I wish to show an alert box from one of the
> functions of this component. Can i invoke other javascript functions as
> 'alert' from within a javascript component function ?
> 
> When i just try to embed a javascript function 'alert' in this object i
> get following error:
> 
> ************************************************************
> * Call to xpconnect wrapped JSObject produced this error:  *
> [Exception... "[JavaScript Error: Alert is not defined"
> {file: "/home/yamini/netscape6/components/nsFeedback.js" line: 28}]
> [nsIFeedback::callback]"  nsresult: "0x80570021
> (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame ::
> file:///home/yamini/Mozilla_source/mozilla/xpcom/Feedback/xpconnect-sample.html
> :: sampleWrite :: line 16"  data: yes]
> ************************************************************
> 
> Please let em know what should i do make this work. How can i
> use various javascript objects in a javascript component.
> 
> Thanks and regards,
> Yamini.

JS Components do not execute in the context of a window. Alert is
a property of window and not available to JS components. JS
components get only the core JS classes, 'Components', 'dump',
and 'debug'.

John.

Reply via email to