<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28093</bug_id>
          
          <creation_ts>2015-02-24 16:50:06 +0000</creation_ts>
          <short_desc>Consider using namespaceURI in the IDL</short_desc>
          <delta_ts>2015-02-25 16:20:41 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Philip Jägenstedt">philipj</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bugs</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>mike</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>118119</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-02-24 16:50:06 +0000</bug_when>
    <thetext>I&apos;m trying to get Blink&apos;s IDL as close as possible to the spec, but because namespace is a C++ keyword it cannot be used, at least not without special-casing the code generator.

Our IDL files use namespaceURI, which seems to be from the older DOM specs. Any other browser implemented in C++ will have the same &quot;problem&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118120</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-02-24 17:14:13 +0000</bug_when>
    <thetext>Could you please be more specific? I&apos;m not sure I follow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118121</commentid>
    <comment_count>2</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2015-02-24 17:26:40 +0000</bug_when>
    <thetext>Isn&apos;t that just about how you map idl methods to C++.
In Gecko Node&apos;s readonly attribute DOMString? namespaceURI; for example
becomes
void GetNamespaceURI(nsAString&amp; aNamespaceURI)

In case binary name must be something else, Gecko has
https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#BinaryName</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118122</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-02-24 17:27:58 +0000</bug_when>
    <thetext>It might help if you said which &quot;namespace&quot; instance you&apos;re talking about.

That said....

&gt; at least not without special-casing the code generator.

This is a problem all over, no?  Specifically, I&apos;m aware of at least the following cases in which C++ keywords of various sorts are used in IDL in various capacities:

1) Methods named &quot;delete&quot; on at least FontFaceSet, Headers, URLSearchParams,
   IDBCursor.
2) A method named &quot;default&quot; on FetchEvent.
3) A method named &quot;continue&quot; on IDBCursor.
4) A method named &quot;register&quot; on ServiceWorkerContainer.

and there are probably more; these were just the ones that would have led Gecko&apos;s codegen to spit out the keyword in C++ code, which of course depends on the details of our codegen (and in particular we only end up using the original IDL name for method names; for example we typically don&apos;t use the argument names from the IDL for anything, so argument names don&apos;t show up in the list above much, we modify the case of dictionary members, so dictionary member names don&apos;t show up above, etc).

What we end up doing in practice is that we have a blacklist of C++ keywords and we munge things that we&apos;d spit out as barewords in C++ if they&apos;re in that blacklist.  See &lt;http://hg.mozilla.org/mozilla-central/file/b74938ef94bc/dom/bindings/Codegen.py#l7703&gt;.  I recommend doing something similar in your codegen, because restricting web specs based on what the set of keywords in C++ happens to be and what the internals of some particular code generators spitting out C++ look like is not really desirable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118161</commentid>
    <comment_count>4</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-02-25 16:20:41 +0000</bug_when>
    <thetext>(In reply to Boris Zbarsky from comment #3)
&gt; It might help if you said which &quot;namespace&quot; instance you&apos;re talking about.

I&apos;m talking about the DOMString? namespace arguments to many functions, the one I happened to try renaming yesterday was for NamedNodeMap.getNamedItemNS.

&gt; That said....
&gt; 
&gt; &gt; at least not without special-casing the code generator.
&gt; 
&gt; This is a problem all over, no?  Specifically, I&apos;m aware of at least the
&gt; following cases in which C++ keywords of various sorts are used in IDL in
&gt; various capacities:
&gt; 
&gt; 1) Methods named &quot;delete&quot; on at least FontFaceSet, Headers, URLSearchParams,
&gt;    IDBCursor.
&gt; 2) A method named &quot;default&quot; on FetchEvent.
&gt; 3) A method named &quot;continue&quot; on IDBCursor.
&gt; 4) A method named &quot;register&quot; on ServiceWorkerContainer.
&gt; 
&gt; and there are probably more; these were just the ones that would have led
&gt; Gecko&apos;s codegen to spit out the keyword in C++ code, which of course depends
&gt; on the details of our codegen (and in particular we only end up using the
&gt; original IDL name for method names; for example we typically don&apos;t use the
&gt; argument names from the IDL for anything, so argument names don&apos;t show up in
&gt; the list above much, we modify the case of dictionary members, so dictionary
&gt; member names don&apos;t show up above, etc).
&gt; 
&gt; What we end up doing in practice is that we have a blacklist of C++ keywords
&gt; and we munge things that we&apos;d spit out as barewords in C++ if they&apos;re in
&gt; that blacklist.  See
&gt; &lt;http://hg.mozilla.org/mozilla-central/file/b74938ef94bc/dom/bindings/
&gt; Codegen.py#l7703&gt;.  I recommend doing something similar in your codegen,
&gt; because restricting web specs based on what the set of keywords in C++
&gt; happens to be and what the internals of some particular code generators
&gt; spitting out C++ look like is not really desirable.

It looks like for methods that are keywords, Blink&apos;s IDL files use [ImplementedAs=remove] or similar to avoid the problem.

Thanks for pointing out that the problem exists elsewhere. It looks like a better solution than changing the spec would be to deal with all of these with a mapping in the code generator.

I see that Gecko has &quot;DOMString? namespace&quot; in its IDL files already, so I&apos;ll WONTFIX this.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>