Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript alert not defined . .
    primarykey
    data
    text
    <p>I am creating a javascript xpcom component Its source is as follows-</p> <pre><code>Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); function callback() { } callback.prototype = { classDescription: "My Hello World Javascript XPCOM Component", classID: Components.ID("{3459D788-D284-4ef0-8AFF-96CBAF51BD35}"), contractID: "@jscallback.p2psearch.com/f2f;1", QueryInterface: XPCOMUtils.generateQI([Components.interfaces.ICallback]), received:function(data){ alert("Received: " +data); }, status:function(data){ alert("Status: "+data); }, expr:function(data){ alert("Expr: "+expr); } }; var components = [callback]; function NSGetModule(compMgr, fileSpec) { return XPCOMUtils.generateModule(components); } </code></pre> <p>When I call it using:</p> <pre><code>try { const p2pjcid = "@jscallback.p2psearch.com/f2f;1"; var jobj = Components.classes[p2pjcid].createInstance(); jobj = jobj.QueryInterface(Components.interfaces.ICallback); jobj.received("Hello from javascript") } catch (err) { alert(err); return; } </code></pre> <p>I get Error as : </p> <pre><code>[Exception... "'[JavaScript Error: "alert is not defined" {file: "file:///C:/Documents%20and%20Settings/mypc/Application%20Data/Mozilla/Firefox/Profiles/ngi5btaf.default/extensions/spsarolkar@gmail/components/callback.js" line: 11}]' when calling method: [ICallback::received]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: chrome://sample/content/clock.js :: initClock :: line 28" data: yes] </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload