Your Search Results


    Components.returnCode is a property which can hold an XPCOM return code additionally to the value returned by the return statement.

    Note that Components.returnCode is currently non-functional due to bug 287107. This problem was introduced in Mozilla 1.4.


    Components.returnCode is a property that can be used to indicate to an XPCOM caller of the JavaScript method that the method is returning a specific nsresult code.

    Generally, XPConnect does a fine job of making it unnecessary for JavaScript code to worry about nsresult codes. By default the successful completion of the JavaScript method will cause XPConnect to return a result code of NS_OK to the caller. If the JavaScript code needs to signal failure then that is done by throwing an exception. However, there are a very few XPCOM interfaces that specify success code return values. Components.returnCode exists in order to make it possible to implement these rare interfaces in JavaScript.


    var foo = {
      bar: function(i) {
        if (yada_yada)
          Components.returnCode = 5;
        return i * 2;

    Document Tags and Contributors

    Contributors to this page: Andreas Wuest, Nickolay, Mgjbot
    Last updated by: Mgjbot,