Changes to the xpidl compiler -

Error if an interface is declared [scriptable], but contains methods that can't be scripted because they refer to native-declared types, unless the method is declared [noscript].

This change is intended to make it easier to determine when an interface is not scriptable, and to make it easier to see what changes need to be made to make it scriptable.

As many of the .idl files in the tree defined [scriptable] interfaces that contained non-scriptable methods, I've sprinkled [noscript] throughout.  As the interfaces weren't scriptable anyway, this shouldn't change their visibility to javascript.
This commit is contained in:
mccabe%netscape.com 1999-08-10 12:18:01 +00:00
Родитель fa19a5296c
Коммит 2a403483de
34 изменённых файлов: 236 добавлений и 142 удалений

Просмотреть файл

@ -85,7 +85,7 @@ interface nsIEcho : nsISupports {
inout string p15,
inout wstring p16);
void MethodWithNative(in long p1, in voidStar p2);
[noscript] void MethodWithNative(in long p1, in voidStar p2);
void ReturnCode(in long code);
void FailInJSTest(in long fail);
void SharedString([retval, shared] out string str);

Просмотреть файл

@ -76,12 +76,12 @@ interface nsIAbCard : nsISupports {
void SetCardValue(in string attrname, in string value);
void SetAbDatabase(in nsIAddrDatabase database);
void GetAnonymousStrAttrubutesList(out nsVoidArray attrlist);
void GetAnonymousStrValuesList(out nsVoidArray valuelist);
void GetAnonymousIntAttrubutesList(out nsVoidArray attrlist);
void GetAnonymousIntValuesList(out nsVoidArray valuelist);
void GetAnonymousBoolAttrubutesList(out nsVoidArray attrlist);
void GetAnonymousBoolValuesList(out nsVoidArray valuelist);
[noscript] void GetAnonymousStrAttrubutesList(out nsVoidArray attrlist);
[noscript] void GetAnonymousStrValuesList(out nsVoidArray valuelist);
[noscript] void GetAnonymousIntAttrubutesList(out nsVoidArray attrlist);
[noscript] void GetAnonymousIntValuesList(out nsVoidArray valuelist);
[noscript] void GetAnonymousBoolAttrubutesList(out nsVoidArray attrlist);
[noscript] void GetAnonymousBoolValuesList(out nsVoidArray valuelist);
void SetAnonymousStringAttribute(in string attrname, in string value);
void SetAnonymousIntAttribute(in string attrname, in unsigned long value);

Просмотреть файл

@ -44,6 +44,6 @@ interface nsIAddrBookSession : nsISupports {
void NotifyDirectoryItemAdded(in nsIAbDirectory directory, in nsISupports item);
void NotifyDirectoryItemDeleted(in nsIAbDirectory directory, in nsISupports item);
void GetUserProfileDirectory(out nsFileSpec userDir);
[noscript] void GetUserProfileDirectory(out nsFileSpec userDir);
};

Просмотреть файл

@ -34,10 +34,10 @@ interface nsIAddrDatabase : nsIAddrDBAnnouncer {
attribute nsFileSpec dbPath;
void Open(in nsFileSpec folderName, in boolean create,
[noscript] void Open(in nsFileSpec folderName, in boolean create,
out nsIAddrDatabase pCardDB, in boolean upgrading);
void Close(in boolean forceCommit);
void OpenMDB(in nsFileSpec dbName, in boolean create);
[noscript] void OpenMDB(in nsFileSpec dbName, in boolean create);
void CloseMDB(in boolean commit);
void OpenAnonymousDB(out nsIAddrDatabase pCardDB);
void CloseAnonymousDB(in boolean forceCommit);

Просмотреть файл

@ -58,7 +58,7 @@ interface nsIMsgCopyServiceListener : nsISupports {
* uniqueness.
* aMessageId -
*/
void GetMessageId(in nsCString aMessageId);
[noscript] void GetMessageId(in nsCString aMessageId);
/**
* Notify the observer that the message copied operation has completed.

Просмотреть файл

@ -25,7 +25,7 @@ interface nsIMsgGroupRecord : nsISupports {
/* making this a voidStar is really ugly, but it's a quick
* solution right now
*/
void Init(in voidStar parent,
[noscript] void Init(in voidStar parent,
in string partname,
in long long time,
in long uniqueid,

Просмотреть файл

@ -34,14 +34,14 @@ interface nsIMsgFilter : nsISupports {
attribute boolean enabled;
attribute string filterName;
attribute string filterDesc;
void AddTerm(in nsMsgSearchAttribute attrib,
[noscript] void AddTerm(in nsMsgSearchAttribute attrib,
in nsMsgSearchOperator op,
in nsMsgSearchValue value,
in boolean BooleanAND,
in string arbitraryHeader);
readonly attribute long numTerms;
void GetTerm(in long termIndex,
[noscript] void GetTerm(in long termIndex,
out nsMsgSearchAttribute attrib,
out nsMsgSearchOperator op,
in nsMsgSearchValue value, // bad! using shared structure
@ -50,8 +50,8 @@ interface nsIMsgFilter : nsISupports {
attribute nsMsgSearchScopeTerm scope;
void SetAction(in nsMsgRuleActionType type, in voidStar value);
void GetAction(out nsMsgRuleActionType type, out voidStar value);
[noscript] void SetAction(in nsMsgRuleActionType type, in voidStar value);
[noscript] void GetAction(out nsMsgRuleActionType type, out voidStar value);
void MatchHdr(in nsIMsgDBHdr msgHdr, in nsIMsgFolder folder,
in nsIMsgDatabase db, in string headers,

Просмотреть файл

@ -24,10 +24,10 @@
[scriptable, uuid(6673cad0-072e-11d3-8d70-00805f8a6617)]
interface nsIMsgFilterService : nsISupports {
nsIMsgFilterList OpenFilterList(in nsFileSpecPtr filterFile);
[noscript] nsIMsgFilterList OpenFilterList(in nsFileSpecPtr filterFile);
void CloseFilterList(in nsIMsgFilterList filterList);
void SaveFilterList(in nsIMsgFilterList filterList,
[noscript] void SaveFilterList(in nsIMsgFilterList filterList,
in nsFileSpecPtr filterFile);
void CancelFilterList(in nsIMsgFilterList filterList);

Просмотреть файл

@ -31,17 +31,19 @@ class nsMsgSearchScopeTerm;
[scriptable, uuid(66f4b80c-0fb5-11d3-a515-0060b0fc04b7)]
interface nsIMsgSearchAdapter : nsISupports {
void Init(in nsMsgSearchScopeTerm scope, in nsMsgSearchTermArray terms);
[noscript] void Init(in nsMsgSearchScopeTerm scope,
in nsMsgSearchTermArray terms);
void ValidateTerms();
void Search();
void SendUrl();
void OpenResultElement(in nsMsgResultElement element);
void ModifyResultElement(in nsMsgResultElement element,
[noscript] void OpenResultElement(in nsMsgResultElement element);
[noscript] void ModifyResultElement(in nsMsgResultElement element,
in nsMsgSearchValue value);
readonly attribute string encoding;
nsIMsgFolder FindTargetFolder([const] in nsMsgResultElement element);
[noscript] nsIMsgFolder FindTargetFolder([const] in nsMsgResultElement
element);
void Abort();
};

Просмотреть файл

@ -28,6 +28,7 @@
[scriptable, uuid(a819050a-0302-11d3-a50a-0060b0fc04b7)]
interface nsIMsgSearchSession {
[noscript]
void AddSearchTerm(in nsMsgSearchAttribute attrib, /* attribute for this term */
in nsMsgSearchOperator op,/* operator e.g. opContains */
in nsMsgSearchValue value, /* value e.g. "Dogbert" */
@ -36,6 +37,7 @@ interface nsIMsgSearchSession {
readonly attribute long numSearchTerms;
[noscript]
void GetNthSearchTerm(in long whichTerm,
in nsMsgSearchAttribute attrib,
in nsMsgSearchOperator op,
@ -43,6 +45,7 @@ interface nsIMsgSearchSession {
long MSG_CountSearchScopes();
[noscript]
voidStar MSG_GetNthSearchScope(in long which,
in nsMsgSearchScopeAttribute scopeId);
@ -51,13 +54,13 @@ interface nsIMsgSearchSession {
in nsIMsgFolder folder);
/* special cases for LDAP since LDAP isn't really a folderInfo */
void AddLdapScope(in nsMsgDIRServer server);
[noscript] void AddLdapScope(in nsMsgDIRServer server);
/* void AddAllLdapScopes(XP_List* dirServerList); */
/* Call this function everytime the scope changes! It informs the FE if
the current scope support custom header use. FEs should not display the
custom header dialog if custom headers are not supported */
boolean ScopeUsesCustomHeaders(in nsMsgSearchScopeAttribute scope,
[noscript] boolean ScopeUsesCustomHeaders(in nsMsgSearchScopeAttribute scope,
/* could be a folder or server based on scope */
in voidStar selection,
in boolean forFilters);
@ -71,10 +74,10 @@ interface nsIMsgSearchSession {
void Search();
void InterruptSearch();
readonly attribute voidStar searchParam;
[noscript] readonly attribute voidStar searchParam;
readonly attribute nsMsgSearchType searchType;
nsMsgSearchType SetSearchParam(in nsMsgSearchType type,
[noscript] nsMsgSearchType SetSearchParam(in nsMsgSearchType type,
in voidStar param);
readonly attribute long numResults;

Просмотреть файл

@ -154,6 +154,7 @@ interface nsIMsgSend : nsISupports
// NOTE: when aEditor is non-null, a multipart related MHTML message will
// be created
//
[noscript]
void CreateAndSendMessage(in nsIEditorShell aEditor,
in nsIMsgIdentity aUserIdentity,
in nsIMsgCompFields fields,
@ -169,6 +170,7 @@ interface nsIMsgSend : nsISupports
in voidStar relatedPart,
in sendListenerPtr aListenerArray); /* nsIMsgSendListener Array */
[noscript]
void SendMessageFile(
in nsIMsgIdentity aUserIdentity,
in nsIMsgCompFields fields,
@ -179,6 +181,7 @@ interface nsIMsgSend : nsISupports
in nsIMessage msgToReplace,
in sendListenerPtr aListenerArray); /* nsIMsgSendListener Array */
[noscript]
void SendWebPage(
in nsIMsgIdentity aUserIdentity,
in nsIMsgCompFields fields,

Просмотреть файл

@ -31,6 +31,7 @@
[scriptable, uuid(E15C83E8-1CF4-11d3-8EF0-00A024A7D144)]
interface nsIMsgSendLater : nsIOutputStream
{
[noscript]
void SendUnsentMessages(in nsIMsgIdentity identity,
in sendListenerPtr listenerArray);
void RemoveListener(in nsIMsgSendLaterListener aListener);

Просмотреть файл

@ -51,18 +51,19 @@ interface nsIDBFolderInfo : nsISupports {
void SetUint32Property(in string propertyName, in unsigned long propertyValue);
unsigned long GetUint32Property(in string propertyName);
void GetCharacterSet(in nsString result);
void SetCharacterSet(in nsString result);
void GetLocale(in nsString result);
void SetLocale(in nsString locale);
[noscript] void GetCharacterSet(in nsString result);
[noscript] void SetCharacterSet(in nsString result);
[noscript] void GetLocale(in nsString result);
[noscript] void SetLocale(in nsString locale);
void SetMailboxName(in nsString newBoxName);
void GetMailboxName(in nsString boxName);
[noscript] void SetMailboxName(in nsString newBoxName);
[noscript] void GetMailboxName(in nsString boxName);
void GetProperty(in string propertyName, in nsString resultProperty);
void SetProperty(in string propertyName, in nsString propertyStr);
void SetKnownArtsSet(in nsString newsArtSet);
void GetKnownArtsSet(in nsString newsArtSet);
[noscript] void GetProperty(in string propertyName, in nsString resultProperty);
[noscript] void SetProperty(in string propertyName, in nsString propertyStr);
[noscript] void SetKnownArtsSet(in nsString newsArtSet);
[noscript] void GetKnownArtsSet(in nsString newsArtSet);
};

Просмотреть файл

@ -75,7 +75,7 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
nsIMsgDBHdr CopyHdrFromExistingHdr(in nsMsgKey key, in nsIMsgDBHdr existingHdr);
void ListAllKeys(in nsMsgKeyArrayRef outputKeys);
[noscript] void ListAllKeys(in nsMsgKeyArrayRef outputKeys);
nsIEnumerator EnumerateMessages();
nsIEnumerator EnumerateThreads();
@ -123,11 +123,11 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
boolean IsMarked(in nsMsgKey key);
boolean HasAttachments(in nsMsgKey key);
void MarkAllRead(in nsMsgKeyArrayPtr thoseMarked);
[noscript] void MarkAllRead(in nsMsgKeyArrayPtr thoseMarked);
void MarkReadByDate (in PRTime startDate, in PRTime endDate, in nsMsgKeyArrayPtr markedIds);
[noscript] void MarkReadByDate (in PRTime startDate, in PRTime endDate, in nsMsgKeyArrayPtr markedIds);
void DeleteMessages(in nsMsgKeyArrayPtr nsMsgKeys, in nsIDBChangeListener instigator);
[noscript] void DeleteMessages(in nsMsgKeyArrayPtr nsMsgKeys, in nsIDBChangeListener instigator);
void DeleteMessage(in nsMsgKey key,
in nsIDBChangeListener instigator,
in boolean commit);
@ -143,7 +143,7 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
in nsIDBChangeListener instigator);
// returns NS_OK on success, NS_COMFALSE on failure
void AllMsgKeysImapDeleted(in nsMsgKeyArrayPtr keys);
[noscript] void AllMsgKeysImapDeleted(in nsMsgKeyArrayPtr keys);
void MarkImapDeleted(in nsMsgKey key, in boolean deleted,
in nsIDBChangeListener instigator);
@ -159,8 +159,8 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
void SetSummaryValid(in boolean valid);
// offline operations
void ListAllOfflineOpIds(in nsMsgKeyArrayPtr offlineOpIds);
void ListAllOfflineDeletes(in nsMsgKeyArrayPtr offlineDeletes);
[noscript] void ListAllOfflineOpIds(in nsMsgKeyArrayPtr offlineOpIds);
[noscript] void ListAllOfflineDeletes(in nsMsgKeyArrayPtr offlineDeletes);
readonly attribute nsMsgKey LowWaterArticleNum;
readonly attribute nsMsgKey HighWaterArticleNum;

Просмотреть файл

@ -44,7 +44,7 @@ interface nsIMailboxService : nsISupports {
* pass in a mailbox parser (the consumer). The url listener can be null
* if you have no interest in tracking the url.
*/
nsIURI ParseMailbox(in nsFileSpec aMailboxPath,
[noscript] nsIURI ParseMailbox(in nsFileSpec aMailboxPath,
in nsIStreamListener aMailboxParser,
in nsIUrlListener aUrlListener);

Просмотреть файл

@ -33,20 +33,20 @@ interface nsIPop3Sink : nsISupports {
void AbortMailDelivery();
/* returns a closure ? */
voidStar IncorporateBegin(in string uidlString, in nsIURI aURL,
[noscript] voidStar IncorporateBegin(in string uidlString, in nsIURI aURL,
in unsigned long flags);
void IncorporateWrite(in voidStar closure, in string block,
[noscript] void IncorporateWrite(in voidStar closure, in string block,
in long length);
void IncorporateComplete(in voidStar closure);
void IncorporateAbort(in voidStar closure, in long status);
[noscript] void IncorporateComplete(in voidStar closure);
[noscript] void IncorporateAbort(in voidStar closure, in long status);
void BiffGetNewMail();
void SetBiffStateAndUpdateFE(in unsigned long biffState, in long numNewMessages);
void SetSenderAuthedFlag(in voidStar closure, in boolean authed);
[noscript] void SetSenderAuthedFlag(in voidStar closure, in boolean authed);
attribute nsIPop3IncomingServer popServer;
attribute nsIMsgFolder folder;

Просмотреть файл

@ -40,9 +40,9 @@ interface nsINntpService : nsISupports {
string ConvertNewsgroupsString(in string newsgroupsStr);
nsIURI PostMessage (in nsFilePath pathToFile, in string newsgroupNames, in nsIUrlListener aUrlListener);
[noscript] nsIURI PostMessage (in nsFilePath pathToFile, in string newsgroupNames, in nsIUrlListener aUrlListener);
nsIURI RunNewsUrl (in nsString urlString, in nsString newsgroupName, in nsMsgKey aKey, in nsISupports aConsumer, in nsIUrlListener aUrlListener);
[noscript] nsIURI RunNewsUrl (in nsString urlString, in nsString newsgroupName, in nsMsgKey aKey, in nsISupports aConsumer, in nsIUrlListener aUrlListener);
nsIURI GetNewNews (in nsINntpIncomingServer nntpServer, in string uri, in nsIUrlListener aUrlListener);

Просмотреть файл

@ -71,7 +71,7 @@ interface nsIPref : nsISupports {
/* Getters */
long GetIntPref(in string pref);
boolean GetBoolPref(in string pref);
void GetBinaryPref(in string pref, in voidStar buf, inout long buf_length);
[noscript] void GetBinaryPref(in string pref, in voidStar buf, inout long buf_length);
void GetColorPref(in string pref, out octet red, out octet green, out octet blue);
unsigned long GetColorPrefDWord(in string pref);
@ -83,7 +83,7 @@ interface nsIPref : nsISupports {
void SetCharPref(in string pref, in string value);
void SetIntPref(in string pref, in long value);
void SetBoolPref(in string pref, in boolean value);
void SetBinaryPref(in string pref, in voidStar value, in unsigned long size);
[noscript] void SetBinaryPref(in string pref, in voidStar value, in unsigned long size);
void SetColorPref(in string pref,in octet red, in octet green,in octet blue);
void SetColorPrefDWord(in string pref, in unsigned long colorref);
@ -95,7 +95,7 @@ interface nsIPref : nsISupports {
/* get defaults */
long GetDefaultIntPref(in string pref);
boolean GetDefaultBoolPref(in string pref);
void GetDefaultBinaryPref(in string pref, in voidStar value,
[noscript] void GetDefaultBinaryPref(in string pref, in voidStar value,
out long length);
void GetDefaultColorPref(in string pref,
out octet red, out octet green, out octet blue);
@ -109,7 +109,7 @@ interface nsIPref : nsISupports {
void SetDefaultCharPref(in string pref, in string value);
void SetDefaultIntPref(in string pref, in long value);
void SetDefaultBoolPref(in string pref, in boolean value);
void SetDefaultBinaryPref(in string pref, in voidStar value, in unsigned long size);
[noscript] void SetDefaultBinaryPref(in string pref, in voidStar value, in unsigned long size);
void SetDefaultColorPref(in string pref,in octet red, in octet green,in octet blue);
void SetDefaultRectPref(in string pref,
@ -118,10 +118,10 @@ interface nsIPref : nsISupports {
/* copy versions of getters */
string CopyCharPref(in string pref);
voidStar CopyBinaryPref(in string pref, out long size);
[noscript] voidStar CopyBinaryPref(in string pref, out long size);
string CopyDefaultCharPref(in string pref);
voidStar CopyDefaultBinaryPref(in string pref, out long size);
[noscript] voidStar CopyDefaultBinaryPref(in string pref, out long size);
nsIFileSpec GetFilePref(in string pref);
void SetFilePref(in string pref, in nsIFileSpec value, in boolean setDefault);
@ -131,10 +131,10 @@ interface nsIPref : nsISupports {
void SavePrefFile();
void RegisterCallback(in string domain,
[noscript] void RegisterCallback(in string domain,
in PrefChangedFunc callback,
in voidStar closure);
void UnregisterCallback(in string domain,
[noscript] void UnregisterCallback(in string domain,
in PrefChangedFunc callback,
in voidStar closure);

Просмотреть файл

@ -41,7 +41,7 @@ interface nsIDNSListener : nsISupports
/**
* Notify the listener that we have found one or more addresses for the hostname.
*/
void OnFound(in nsISupports ctxt, in string hostname,
[noscript] void OnFound(in nsISupports ctxt, in string hostname,
in nsHostEntStar entry);
/**

Просмотреть файл

@ -49,7 +49,8 @@ interface nsIRDFXMLSink : nsISupports
void Resume();
void EndLoad();
void AddNameSpace(in nsIAtomPtr aPrefix, [const] in nsStringRef aURI);
[noscript] void AddNameSpace(in nsIAtomPtr aPrefix,
[const] in nsStringRef aURI);
void AddXMLSinkObserver(in nsIRDFXMLSinkObserver aObserver);
void RemoveXMLSinkObserver(in nsIRDFXMLSinkObserver aObserver);

Просмотреть файл

@ -24,7 +24,7 @@
class nsIOutputStream;
%}
[scriptable, uuid(4DA56F10-99FE-11d2-8EBB-00805F29F370)]
[uuid(4DA56F10-99FE-11d2-8EBB-00805F29F370)]
interface nsIRDFXMLSource : nsISupports
{
void Serialize(in nsIOutputStreamPtr aStream);

Просмотреть файл

@ -62,7 +62,7 @@ interface nsIFileSpecWithUI : nsIFileSpec
};
enum { kNumStandardFilters = 5 };
%}
void chooseInputFile(
[noscript] void chooseInputFile(
in string title
, in StandardFilterMask standardFilterMask
, in string extraFilterTitle

Просмотреть файл

@ -36,5 +36,5 @@ interface nsIInputStream : nsIBaseStream
* bytes read, eof if 0. if an error occurs, the
* read count will be undefined
*/
unsigned long Read(in charStar buf, in unsigned long count);
[noscript] unsigned long Read(in charStar buf, in unsigned long count);
};

Просмотреть файл

@ -7,12 +7,12 @@ native nsID(nsID *);
interface nsIProxyCreateInstance : nsISupports
{
void CreateInstanceByIID(in nsIIDRef cid,
[noscript] void CreateInstanceByIID(in nsIIDRef cid,
in nsISupports aOuter,
in nsIIDRef iid,
out voidStar result);
void CreateInstanceByProgID(in string aProgID,
[noscript] void CreateInstanceByProgID(in string aProgID,
in nsISupports aOuter,
in nsIIDRef iid,
out voidStar result);

Просмотреть файл

@ -151,4 +151,29 @@ xpidl_sprint_iid(struct nsID *iid, char iidbuf[]);
gboolean
xpidl_parse_iid(nsID *id, const char *str);
/* Try to common a little node-handling stuff. */
/* is this node from an aggregate type (interface)? */
#define UP_IS_AGGREGATE(node) \
(IDL_NODE_UP(node) && \
(IDL_NODE_TYPE(IDL_NODE_UP(node)) == IDLN_INTERFACE || \
IDL_NODE_TYPE(IDL_NODE_UP(node)) == IDLN_FORWARD_DCL))
#define UP_IS_NATIVE(node) \
(IDL_NODE_UP(node) && \
IDL_NODE_TYPE(IDL_NODE_UP(node)) == IDLN_NATIVE)
/* is this type output in the form "<foo> *"? */
#define STARRED_TYPE(node) (IDL_NODE_TYPE(node) == IDLN_TYPE_STRING || \
IDL_NODE_TYPE(node) == IDLN_TYPE_WIDE_STRING || \
(IDL_NODE_TYPE(node) == IDLN_IDENT && \
UP_IS_AGGREGATE(node)))
/*
* Perform various validation checks on methods.
*/
gboolean
verify_method_declaration(TreeState *state);
#endif /* __xpidl_h */

Просмотреть файл

@ -23,22 +23,6 @@
#include "xpidl.h"
#include <ctype.h>
/* is this node from an aggregate type (interface)? */
#define UP_IS_AGGREGATE(node) \
(IDL_NODE_UP(node) && \
(IDL_NODE_TYPE(IDL_NODE_UP(node)) == IDLN_INTERFACE || \
IDL_NODE_TYPE(IDL_NODE_UP(node)) == IDLN_FORWARD_DCL))
#define UP_IS_NATIVE(node) \
(IDL_NODE_UP(node) && \
IDL_NODE_TYPE(IDL_NODE_UP(node)) == IDLN_NATIVE)
/* is this type output in the form "<foo> *"? */
#define STARRED_TYPE(node) (IDL_NODE_TYPE(node) == IDLN_TYPE_STRING || \
IDL_NODE_TYPE(node) == IDLN_TYPE_WIDE_STRING || \
(IDL_NODE_TYPE(node) == IDLN_IDENT && \
UP_IS_AGGREGATE(node)))
static void
write_header(gpointer key, gpointer value, gpointer user_data)
{
@ -471,11 +455,8 @@ op_dcl(TreeState *state)
(IDL_tree_property_get(op->ident, "notxpcom") != NULL);
IDL_tree iter;
if (op->f_varargs) {
/* We don't currently support varargs. */
IDL_tree_error(state->tree, "varargs are not currently supported\n");
if (!verify_method_declaration(state))
return FALSE;
}
xpidl_write_comment(state, 2);

Просмотреть файл

@ -804,3 +804,82 @@ xpidl_parse_iid(struct nsID *id, const char *str)
#endif
return (gboolean)(count == 11);
}
/*
* Common method verification code, called by *op_dcl in the various backends.
*/
gboolean
verify_method_declaration(TreeState *state)
{
struct _IDL_OP_DCL *op = &IDL_OP_DCL(state->tree);
IDL_tree iface;
gboolean scriptable_interface;
if (op->f_varargs) {
/* We don't currently support varargs. */
IDL_tree_error(state->tree, "varargs are not currently supported\n");
return FALSE;
}
/*
* Verify that we've been called on an interface, and decide if the
* interface was marked [scriptable].
*/
if (IDL_NODE_UP(state->tree) && IDL_NODE_UP(IDL_NODE_UP(state->tree)) &&
IDL_NODE_TYPE(iface = IDL_NODE_UP(IDL_NODE_UP(state->tree)))
== IDLN_INTERFACE)
{
scriptable_interface =
(IDL_tree_property_get(IDL_INTERFACE(iface).ident, "scriptable")
!= NULL);
} else {
IDL_tree_error(state->tree, "verify_op_dcl called on a non-interface?");
return FALSE;
}
/*
* Require that any method in an interface marked as [scriptable], that
* *isn't* scriptable because it refers to some native type, be marked
* [noscript] or [notxpcom].
*/
if (scriptable_interface &&
IDL_tree_property_get(op->ident, "notxpcom") == NULL &&
IDL_tree_property_get(op->ident, "noscript") == NULL)
{
IDL_tree iter;
/* Loop through the parameters and check. */
for (iter = op->parameter_dcls; iter; iter = IDL_LIST(iter).next) {
IDL_tree param_type =
IDL_PARAM_DCL(IDL_LIST(iter).data).param_type_spec;
IDL_tree simple_decl =
IDL_PARAM_DCL(IDL_LIST(iter).data).simple_declarator;
/*
* Reject this method if a parameter is native and isn't marked
* with either nsid or iid_is.
*/
if (UP_IS_NATIVE(param_type) &&
IDL_tree_property_get(param_type, "nsid") == NULL &&
IDL_tree_property_get(simple_decl, "iid_is") == NULL)
{
IDL_tree_error(state->tree,
"methods in [scriptable] interfaces which are "
"non-scriptable because they refer to native "
"types (parameter \"%s\") must be marked "
"[noscript]\n", IDL_IDENT(simple_decl).str);
return FALSE;
}
}
/* How about the return type? */
if (op->op_type_spec != NULL && UP_IS_NATIVE(op->op_type_spec)) {
IDL_tree_error(state->tree,
"methods in [scriptable] interfaces which are "
"non-scriptable because they return native "
"types must be marked [noscript]\n");
return FALSE;
}
}
return TRUE;
}

Просмотреть файл

@ -425,6 +425,9 @@ method_declaration(TreeState *state)
IDL_tree iterator = NULL;
IDL_tree retval_param = NULL;
if (!verify_method_declaration(state))
return FALSE;
xpidl_write_comment(state, 4);
/*

Просмотреть файл

@ -859,14 +859,13 @@ typelib_op_dcl(TreeState *state)
IDL_tree iter;
uint16 num_args = 0;
uint8 op_flags = 0;
gboolean op_notxpcom = !!IDL_tree_property_get(op->ident, "notxpcom");
gboolean op_noscript = !!IDL_tree_property_get(op->ident, "noscript");
gboolean op_notxpcom = (IDL_tree_property_get(op->ident, "notxpcom")
!= NULL);
gboolean op_noscript = (IDL_tree_property_get(op->ident, "noscript")
!= NULL);
if (op->f_varargs) {
/* We don't currently support varargs. */
IDL_tree_error(state->tree, "varargs are not currently supported\n");
if (!verify_method_declaration(state))
return FALSE;
}
if (!XPT_InterfaceDescriptorAddMethods(id, 1))
return FALSE;
@ -878,10 +877,6 @@ typelib_op_dcl(TreeState *state)
if (op->op_type_spec && !op_notxpcom)
num_args++; /* fake param for _retval */
/*
* don't look at op->f_noscript, because we want 'noscript' as a bare keyword
* to go away. (it becomes __f_noscript in libIDL 0.6.8)
*/
if (op_noscript || op_notxpcom)
op_flags |= XPT_MD_HIDDEN;
if (op->f_varargs)
@ -903,7 +898,7 @@ typelib_op_dcl(TreeState *state)
return FALSE;
}
/* XXX unless [nonxpcom] */
/* XXX unless [notxpcom] */
if (!op_notxpcom) {
if (op->op_type_spec) {
if (!fill_pd_from_type(state, &meth->params[num_args],

Просмотреть файл

@ -26,7 +26,7 @@
native nsString(nsString&);
native constnsString(const nsString&);
[scriptable, uuid(be5c13bd-ba9f-11d2-96c4-0060b0fb9956)]
[uuid(be5c13bd-ba9f-11d2-96c4-0060b0fb9956)]
interface nsIDOMBaseAppCore : nsISupports
{
void GetId(in nsString id);

Просмотреть файл

@ -57,16 +57,16 @@ interface nsIWindowMediator: nsIRDFDataSource
nsIDOMWindow ConvertISupportsToDOMWindow( in nsISupports inWindow );
/* Add the webshellwindow to the list */
void RegisterWindow( in nsIWebShellWindow inWindow);
[noscript] void RegisterWindow( in nsIWebShellWindow inWindow);
/* remove the window from the list */
void UnregisterWindow( in nsIWebShellWindow inWindow );
[noscript] void UnregisterWindow( in nsIWebShellWindow inWindow );
/* Call when the window gains focus. Used to determine the most recent window */
void UpdateWindowTimeStamp( in nsIWebShellWindow inWindow );
[noscript] void UpdateWindowTimeStamp( in nsIWebShellWindow inWindow );
/* */
void UpdateWindowTitle(in nsIWebShellWindow inWindow, in wstring inTitle );
[noscript] void UpdateWindowTitle(in nsIWebShellWindow inWindow, in wstring inTitle );
};

Просмотреть файл

@ -70,7 +70,7 @@ interface nsIFindComponent : nsIAppShellComponent {
| Clients do have to call Release() when they're no longer interested in |
| this search context. |
--------------------------------------------------------------------------*/
nsISupports CreateContext( in nsIWebShell aWebShell,
[noscript] nsISupports CreateContext( in nsIWebShell aWebShell,
in nsIEditor aEditor );
/*--------------------------------- Find -----------------------------------
@ -109,7 +109,7 @@ interface nsIFindComponent : nsIAppShellComponent {
| this will be the equivalent of calling Release() on the old context and |
| then creating a new one for aNewWebShell. |
--------------------------------------------------------------------------*/
void ResetContext( in nsISupports aContext,
[noscript] void ResetContext( in nsISupports aContext,
in nsIWebShell aNewWebShell,
in nsIEditor aEditor );
};

Просмотреть файл

@ -73,7 +73,7 @@ interface nsIAppShellComponent : nsISupports {
/*------------------------------ Initialize --------------------------------
| Called at application startup. |
--------------------------------------------------------------------------*/
void Initialize( in nsIAppShellService anAppShell,
[noscript] void Initialize( in nsIAppShellService anAppShell,
in nsICmdLineService args );
/*------------------------------- Shutdown ---------------------------------

Просмотреть файл

@ -43,7 +43,7 @@ class nsIDOMWindow;
| stream transfer is completed. The result generally indicates only whether |
| or not the stream transfer was successfully initiated. |
------------------------------------------------------------------------------*/
[scriptable, uuid(a6cf90f0-15b3-11d2-932e-00805f8add32)]
[uuid(a6cf90f0-15b3-11d2-932e-00805f8add32)]
interface nsIStreamTransfer : nsIAppShellComponent {
/*-------------------- SelectFileAndTransferLocation -----------------------