Skip to content

Commit

Permalink
Bug 1406829 (part 3) - Use [ptr] native for nsAtom pointers in .idl…
Browse files Browse the repository at this point in the history
… files. r=froydnj.

Even though it's more verbose because of the `%{C++` section, it's the proper
way to do this kind of thing, rather than faking it with `interface`.
  • Loading branch information
nnethercote committed Oct 10, 2017
1 parent d1f403b commit d9e9fa6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
8 changes: 6 additions & 2 deletions dom/xul/templates/nsIXULTemplateBuilder.idl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "domstubs.idl"

interface nsAtom; // not a real interface; used in [noscript] methods only
interface nsIContent;
interface nsIXULBuilderListener;
interface nsIXULTemplateResult;
Expand All @@ -15,6 +14,11 @@ interface nsIRDFResource;
interface nsIRDFCompositeDataSource;
interface nsIDOMDataTransfer;

%{C++
class nsAtom;
%}
[ptr] native nsAtomPtr(nsAtom);

/**
* A template builder, given an input source of data, a template, and a
* reference point, generates a list of results from the input, and copies
Expand Down Expand Up @@ -268,7 +272,7 @@ interface nsIXULTemplateBuilder : nsISupports
* @param aTag tag that must match
*/
[noscript] boolean hasGeneratedContent(in nsIRDFResource aNode,
in nsAtom aTag);
in nsAtomPtr aTag);

/**
* Adds a rule filter for a given rule, which may be used for specialized
Expand Down
16 changes: 10 additions & 6 deletions dom/xul/templates/nsIXULTemplateQueryProcessor.idl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@

#include "domstubs.idl"

interface nsAtom; // not a real interface; used in [noscript] methods only
interface nsIArray;
interface nsISimpleEnumerator;
interface nsIXULTemplateResult;
interface nsIXULTemplateRuleFilter;
interface nsIXULTemplateBuilder;

%{C++
class nsAtom;
%}
[ptr] native nsAtomPtr(nsAtom);

/**
* A query processor takes a template query and generates results for it given
* a datasource and a reference point. There is a one-to-one relationship
Expand Down Expand Up @@ -164,8 +168,8 @@ interface nsIXULTemplateQueryProcessor : nsISupports
*/
[noscript] nsISupports compileQuery(in nsIXULTemplateBuilder aBuilder,
in nsIDOMNode aQuery,
in nsAtom aRefVariable,
in nsAtom aMemberVariable);
in nsAtomPtr aRefVariable,
in nsAtomPtr aMemberVariable);

/**
* Generate the results of a query and return them in an enumerator. The
Expand Down Expand Up @@ -223,8 +227,8 @@ interface nsIXULTemplateQueryProcessor : nsISupports
* @param aExpr expression used to compute the value to assign
*/
[noscript] void addBinding(in nsIDOMNode aRuleNode,
in nsAtom aVar,
in nsAtom aRef,
in nsAtomPtr aVar,
in nsAtomPtr aRef,
in AString aExpr);

/**
Expand Down Expand Up @@ -271,6 +275,6 @@ interface nsIXULTemplateQueryProcessor : nsISupports
*/
[noscript] int32_t compareResults(in nsIXULTemplateResult aLeft,
in nsIXULTemplateResult aRight,
in nsAtom aVar,
in nsAtomPtr aVar,
in unsigned long aSortHints);
};
10 changes: 7 additions & 3 deletions dom/xul/templates/nsIXULTemplateResult.idl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@

#include "nsISupports.idl"

interface nsAtom; // not a real interface; used in [noscript] methods only
interface nsIDOMNode;
interface nsIRDFResource;

%{C++
class nsAtom;
%}
[ptr] native nsAtomPtr(nsAtom);

/**
* A single result generated from a template query. Each result is identified
* by an id, which must be unique within the set of results produced from a
Expand Down Expand Up @@ -80,7 +84,7 @@ interface nsIXULTemplateResult : nsISupports
*
* @return the value for the variable or a null string if it has no value
*/
[noscript] AString getBindingFor(in nsAtom aVar);
[noscript] AString getBindingFor(in nsAtomPtr aVar);

/**
* Get an object value for a variable such as ?name for this result.
Expand All @@ -93,7 +97,7 @@ interface nsIXULTemplateResult : nsISupports
*
* @return the value for the variable or null if it has no value
*/
[noscript] nsISupports getBindingObjectFor(in nsAtom aVar);
[noscript] nsISupports getBindingObjectFor(in nsAtomPtr aVar);

/**
* Indicate that a particular rule of a query has matched and that output
Expand Down
7 changes: 5 additions & 2 deletions rdf/base/nsIRDFXMLSerializer.idl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
#include "nsISupports.idl"
#include "nsIRDFDataSource.idl"

interface nsAtom; // not a real interface; used in [noscript] methods only
%{C++
class nsAtom;
%}
[ptr] native nsAtomPtr(nsAtom);

[scriptable, uuid(8ae1fbf8-1dd2-11b2-bd21-d728069cca92)]
interface nsIRDFXMLSerializer : nsISupports
Expand All @@ -24,5 +27,5 @@ interface nsIRDFXMLSerializer : nsISupports
* @param aPrefix the attribute namespace prefix
* @param aURI the namespace URI
*/
[noscript] void addNameSpace(in nsAtom aPrefix, in DOMString aURI);
[noscript] void addNameSpace(in nsAtomPtr aPrefix, in DOMString aURI);
};
7 changes: 5 additions & 2 deletions rdf/base/nsIRDFXMLSink.idl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@

#include "nsISupports.idl"

interface nsAtom; // not a real interface; used in [noscript] methods only
%{C++
class nsAtom;
%}
[ptr] native nsAtomPtr(nsAtom);

// XXX Until these get scriptable. See nsIRDFXMLSink::AddNameSpace()
[ref] native nsStringRef(nsString);
Expand Down Expand Up @@ -102,7 +105,7 @@ interface nsIRDFXMLSink : nsISupports
* @param aPrefix the namespace prefix
* @param aURI the namespace URI
*/
[noscript] void addNameSpace(in nsAtom aPrefix,
[noscript] void addNameSpace(in nsAtomPtr aPrefix,
[const] in nsStringRef aURI);

/**
Expand Down

0 comments on commit d9e9fa6

Please sign in to comment.