Back to index

lightning-sunbird  0.9+nobinonly
xpccomponents.idl
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is Mozilla Communicator client code, released
00017  * March 31, 1998.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications Corporation.
00021  * Portions created by the Initial Developer are Copyright (C) 1998
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *   John Bandhauer <jband@netscape.com> (original author)
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #include "nsISupports.idl"
00042 #include "xpcexception.idl"
00043 #include "xpcjsid.idl"
00044 #include "nsIComponentManager.idl"
00045 #include "nsIScriptableInterfaces.idl"
00046 
00051 [scriptable, uuid(978ff520-d26c-11d2-9842-006008962422)]
00052 interface nsIXPCComponents_Classes : nsISupports
00053 {
00054 };
00055 
00060 [scriptable, uuid(336a9590-4d19-11d3-9893-006008962422)]
00061 interface nsIXPCComponents_ClassesByID : nsISupports
00062 {
00063 };
00064 
00069 [scriptable, uuid(2fc229a0-5860-11d3-9899-006008962422)]
00070 interface nsIXPCComponents_Results : nsISupports
00071 {
00072 };
00073 
00078 [scriptable, uuid(7994a6e0-e028-11d3-8f5d-0010a4e73d9a)]
00079 interface nsIXPCComponents_ID : nsISupports
00080 {
00081 };
00082 
00087 [scriptable, uuid(5bf039c0-e028-11d3-8f5d-0010a4e73d9a)]
00088 interface nsIXPCComponents_Exception : nsISupports
00089 {
00090 };
00091 
00096 [scriptable, uuid(88655640-e028-11d3-8f5d-0010a4e73d9a)]
00097 interface nsIXPCComponents_Constructor : nsISupports
00098 {
00099 };
00100 
00105 [scriptable, uuid(c814ca20-e0dc-11d3-8f5f-0010a4e73d9a)]
00106 interface nsIXPCConstructor : nsISupports
00107 {
00108     readonly attribute nsIJSCID classID;
00109     readonly attribute nsIJSIID interfaceID;
00110     readonly attribute string   initializer;
00111 };
00112 
00116 [scriptable, uuid(4f8ae0dc-d266-4a32-875b-6a9de71a8ce9)]
00117 interface nsIXPCComponents_utils_Sandbox : nsISupports
00118 {
00119 };
00120 
00124 [scriptable, uuid(bcd54a63-34d9-468c-9a55-0fb5d2d8c677)]
00125 interface nsIXPCComponents_Utils : nsISupports
00126 {
00127 
00128     /* reportError is designed to be called from JavaScript only.
00129      *
00130      * It will report a JS Error object to the JS console, and return. It
00131      * is meant for use in exception handler blocks which want to "eat"
00132      * an exception, but still want to report it to the console.
00133      *
00134      * It must be called with one param, usually an object which was caught by
00135      * an exception handler.  If it is not a JS error object, the parameter
00136      * is converted to a string and reported as a new error.
00137      */
00138     void reportError();
00139 
00140     /* lookupMethod is designed to be called from JavaScript only.
00141      *
00142      * It returns a method looking only at the idl interfaces and
00143      * ignores any overrides or resolvers that might be in place for
00144      * a given scriptable wrapped native.
00145      * It must be called with two params: an object and a method name.
00146      * It returns a function object or throws an exception on error.
00147      * This method exists only to solve mozilla browser problems
00148      * when chrome attempts to lookup and call methods in content
00149      * and *must* not get confused by method properties that have been
00150      * replaced in the content JS code. This method is not recommended for
00151      * any other use.
00152      */
00153     void lookupMethod();
00154 
00155     readonly attribute nsIXPCComponents_utils_Sandbox Sandbox;
00156 
00157     /*
00158      * evalInSandbox is only meant to be called from JavaScript.
00159      *
00160      * evalInSandbox evaluates the provided source string in the given sandbox.
00161      * It returns the result of the evaluation to the caller.
00162      *
00163      * var s = new C.u.Sandbox("http://www.mozilla.org");
00164      * var res = C.u.evalInSandbox("var five = 5; 2 + five", s);
00165      * var outerFive = s.five;
00166      * s.seven = res;
00167      * var thirtyFive = C.u.evalInSandbox("five * seven", s);
00168      */
00169     void evalInSandbox(in AString source/*, obj */);
00170 };
00171 
00175 [scriptable, uuid(155809f1-71f1-47c5-be97-d812ba560405)]
00176 interface nsIXPCComponents : nsISupports
00177 {
00178     readonly attribute nsIScriptableInterfaces      interfaces;
00179     readonly attribute nsIScriptableInterfacesByID  interfacesByID;
00180     readonly attribute nsIXPCComponents_Classes     classes;
00181     readonly attribute nsIXPCComponents_ClassesByID classesByID;
00182     readonly attribute nsIStackFrame                stack;
00183     readonly attribute nsIXPCComponents_Results     results;
00184     readonly attribute nsIComponentManager          manager;
00185     readonly attribute nsIXPCComponents_Utils       utils;
00186 
00187     readonly attribute nsIXPCComponents_ID          ID;
00188     readonly attribute nsIXPCComponents_Exception   Exception;
00189     readonly attribute nsIXPCComponents_Constructor Constructor;
00190 
00191     boolean isSuccessCode(in nsresult result);
00192 
00193     /* DEPRECATED: use Components.utils.lookupMethod instead.
00194      * (But are you sure you really want this method any more?
00195      *  See http://developer-test.mozilla.org/en/docs/XPCNativeWrapper )
00196      */
00197     void lookupMethod();
00198 
00199     /* DEPRECATED: use Components.utils.reportError instead. */
00200     void reportError();
00201 
00202     /* 'lastResult' is accessable via JavaScript only */
00203     /* 'returnCode' is accessable via JavaScript only */
00204 };