Bug 824237. Add support for "partial interface" to WebIDL parser. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 10 Jan 2013 10:49:07 -0500
changeset 128288 1a7ca1f81bd21b1d678762a9586287294b25d378
parent 128287 f3d89d6870e69563af14e0d97ef80f0528c09d78
child 128289 5f53242d94bc53526c862705736f4a816b05b55f
push idunknown
push userunknown
push dateunknown
reviewerskhuey
bugs824237
milestone21.0a1
Bug 824237. Add support for "partial interface" to WebIDL parser. r=khuey
dom/bindings/parser/WebIDL.py
dom/bindings/parser/tests/test_interface.py
dom/webidl/Document.webidl
dom/webidl/DocumentFragment.webidl
dom/webidl/Element.webidl
dom/webidl/HTMLAnchorElement.webidl
dom/webidl/HTMLBodyElement.webidl
dom/webidl/HTMLDListElement.webidl
dom/webidl/HTMLDivElement.webidl
dom/webidl/HTMLElement.webidl
dom/webidl/HTMLHeadingElement.webidl
dom/webidl/HTMLImageElement.webidl
dom/webidl/HTMLLIElement.webidl
dom/webidl/HTMLOListElement.webidl
dom/webidl/HTMLParagraphElement.webidl
dom/webidl/HTMLPreElement.webidl
dom/webidl/HTMLScriptElement.webidl
dom/webidl/HTMLTableCaptionElement.webidl
dom/webidl/HTMLTableCellElement.webidl
dom/webidl/HTMLTableColElement.webidl
dom/webidl/HTMLTableElement.webidl
dom/webidl/HTMLTableRowElement.webidl
dom/webidl/HTMLTableSectionElement.webidl
dom/webidl/HTMLUListElement.webidl
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -431,34 +431,42 @@ class IDLExternalInterface(IDLObjectWith
 
     def addExtendedAttributes(self, attrs):
         assert len(attrs) == 0
 
     def resolve(self, parentScope):
         pass
 
 class IDLInterface(IDLObjectWithScope):
-    def __init__(self, location, parentScope, name, parent, members):
+    def __init__(self, location, parentScope, name, parent, members,
+                 isPartial):
         assert isinstance(parentScope, IDLScope)
         assert isinstance(name, IDLUnresolvedIdentifier)
-        assert not parent or isinstance(parent, IDLIdentifierPlaceholder)
-
-        self.parent = parent
+        assert not isPartial or not parent
+
+        self.parent = None
         self._callback = False
         self._finished = False
-        self.members = list(members) # clone the list
+        self.members = []
         self.implementedInterfaces = set()
         self._consequential = False
+        self._isPartial = True
         # self.interfacesBasedOnSelf is the set of interfaces that inherit from
         # self or have self as a consequential interface, including self itself.
         # Used for distinguishability checking.
         self.interfacesBasedOnSelf = set([self])
 
         IDLObjectWithScope.__init__(self, location, parentScope, name)
 
+        if not isPartial:
+            self.setNonPartial(location, parent, members)
+        else:
+            # Just remember our members for now
+            self.members = members
+
     def __str__(self):
         return "Interface '%s'" % self.identifier.name
 
     def ctor(self):
         identifier = IDLUnresolvedIdentifier(self.location, "constructor",
                                              allowForbidden=True)
         try:
             return self._lookupIdentifier(identifier)
@@ -484,16 +492,21 @@ class IDLInterface(IDLObjectWithScope):
         return retval
 
     def finish(self, scope):
         if self._finished:
             return
 
         self._finished = True
 
+        if self._isPartial:
+            raise WebIDLError("Interface %s does not have a non-partial "
+                              "declaration" % self.identifier.name,
+                              [self.location])
+
         assert not self.parent or isinstance(self.parent, IDLIdentifierPlaceholder)
         parent = self.parent.finish(scope) if self.parent else None
         if parent and isinstance(parent, IDLExternalInterface):
             raise WebIDLError("%s inherits from %s which does not have "
                               "a definition" %
                               (self.identifier.name,
                                self.parent.identifier.name),
                               [self.location])
@@ -827,16 +840,31 @@ class IDLInterface(IDLObjectWithScope):
             loopPoint = iface.findInterfaceLoopPoint(otherInterface)
             if loopPoint:
                 return loopPoint
         return None
 
     def getExtendedAttribute(self, name):
         return self._extendedAttrDict.get(name, None)
 
+    def setNonPartial(self, location, parent, members):
+        assert not parent or isinstance(parent, IDLIdentifierPlaceholder)
+        if not self._isPartial:
+            raise WebIDLError("Two non-partial definitions for the "
+                              "same interface",
+                              [location, self.location])
+        self._isPartial = False
+        # Now make it look like we were parsed at this new location, since
+        # that's the place where the interface is "really" defined
+        self.location = location
+        assert not self.parent
+        self.parent = parent
+        # Put the new members at the beginning
+        self.members = members + self.members
+
 class IDLDictionary(IDLObjectWithScope):
     def __init__(self, location, parentScope, name, parent, members):
         assert isinstance(parentScope, IDLScope)
         assert isinstance(name, IDLUnresolvedIdentifier)
         assert not parent or isinstance(parent, IDLIdentifierPlaceholder)
 
         self.parent = parent
         self._finished = False
@@ -2980,19 +3008,35 @@ class Parser(Tokenizer):
         p[0] = p[1]
 
     def p_Interface(self, p):
         """
             Interface : INTERFACE IDENTIFIER Inheritance LBRACE InterfaceMembers RBRACE SEMICOLON
         """
         location = self.getLocation(p, 1)
         identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2])
-
         members = p[5]
-        p[0] = IDLInterface(location, self.globalScope(), identifier, p[3], members)
+        parent = p[3]
+
+        try:
+            if self.globalScope()._lookupIdentifier(identifier):
+                p[0] = self.globalScope()._lookupIdentifier(identifier)
+                if not isinstance(p[0], IDLInterface):
+                    raise WebIDLError("Partial interface has the same name as "
+                                      "non-interface object",
+                                      [location, p[0].location])
+                p[0].setNonPartial(location, parent, members)
+                return
+        except Exception, ex:
+            if isinstance(ex, WebIDLError):
+                raise ex
+            pass
+
+        p[0] = IDLInterface(location, self.globalScope(), identifier, parent,
+                            members, isPartial=False)
 
     def p_InterfaceForwardDecl(self, p):
         """
             Interface : INTERFACE IDENTIFIER SEMICOLON
         """
         location = self.getLocation(p, 1)
         identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2])
 
@@ -3004,16 +3048,39 @@ class Parser(Tokenizer):
             pass
 
         p[0] = IDLExternalInterface(location, self.globalScope(), identifier)
 
     def p_PartialInterface(self, p):
         """
             PartialInterface : PARTIAL INTERFACE IDENTIFIER LBRACE InterfaceMembers RBRACE SEMICOLON
         """
+        location = self.getLocation(p, 2)
+        identifier = IDLUnresolvedIdentifier(self.getLocation(p, 3), p[3])
+        members = p[5]
+
+        try:
+            if self.globalScope()._lookupIdentifier(identifier):
+                p[0] = self.globalScope()._lookupIdentifier(identifier)
+                if not isinstance(p[0], IDLInterface):
+                    raise WebIDLError("Partial interface has the same name as "
+                                      "non-interface object",
+                                      [location, p[0].location])
+                # Just throw our members into the existing IDLInterface.  If we
+                # have extended attributes, those will get added to it
+                # automatically.
+                p[0].members.extend(members)
+                return
+        except Exception, ex:
+            if isinstance(ex, WebIDLError):
+                raise ex
+            pass
+
+        p[0] = IDLInterface(location, self.globalScope(), identifier, None,
+                            members, isPartial=True)
         pass
 
     def p_Inheritance(self, p):
         """
             Inheritance : COLON ScopedName
         """
         p[0] = IDLIdentifierPlaceholder(self.getLocation(p, 2), p[2])
 
--- a/dom/bindings/parser/tests/test_interface.py
+++ b/dom/bindings/parser/tests/test_interface.py
@@ -181,8 +181,139 @@ def WebIDLTest(parser, harness):
             interface A;
             interface B : A {};
         """)
         results = parser.finish()
     except:
         threw = True
 
     harness.ok(threw, "Should not allow inheriting from an interface that is only forward declared")
+
+    parser = parser.reset()
+    parser.parse("""
+        [Constructor(long arg)]
+        interface A {
+            readonly attribute boolean x;
+            void foo();
+        };
+        [Constructor]
+        partial interface A {
+            readonly attribute boolean y;
+            void foo(long arg);
+        };
+    """);
+    results = parser.finish();
+    harness.check(len(results), 1,
+                  "Should have one result with partial interface")
+    iface = results[0]
+    harness.check(len(iface.members), 3,
+                  "Should have three members with partial interface")
+    harness.check(iface.members[0].identifier.name, "x",
+                  "First member should be x with partial interface")
+    harness.check(iface.members[1].identifier.name, "foo",
+                  "Second member should be foo with partial interface")
+    harness.check(len(iface.members[1].signatures()), 2,
+                  "Should have two foo signatures with partial interface")
+    harness.check(iface.members[2].identifier.name, "y",
+                  "Third member should be y with partial interface")
+    harness.check(len(iface.ctor().signatures()), 2,
+                  "Should have two constructors with partial interface")
+
+    parser = parser.reset()
+    parser.parse("""
+        [Constructor]
+        partial interface A {
+            readonly attribute boolean y;
+            void foo(long arg);
+        };
+        [Constructor(long arg)]
+        interface A {
+            readonly attribute boolean x;
+            void foo();
+        };
+    """);
+    results = parser.finish();
+    harness.check(len(results), 1,
+                  "Should have one result with reversed partial interface")
+    iface = results[0]
+    harness.check(len(iface.members), 3,
+                  "Should have three members with reversed partial interface")
+    harness.check(iface.members[0].identifier.name, "x",
+                  "First member should be x with reversed partial interface")
+    harness.check(iface.members[1].identifier.name, "foo",
+                  "Second member should be foo with reversed partial interface")
+    harness.check(len(iface.members[1].signatures()), 2,
+                  "Should have two foo signatures with reversed partial interface")
+    harness.check(iface.members[2].identifier.name, "y",
+                  "Third member should be y with reversed partial interface")
+    harness.check(len(iface.ctor().signatures()), 2,
+                  "Should have two constructors with reversed partial interface")
+
+    parser = parser.reset()
+    threw = False
+    try:
+        parser.parse("""
+            interface A {
+                readonly attribute boolean x;
+            };
+            interface A {
+                readonly attribute boolean y;
+            };
+        """)
+        results = parser.finish()
+    except:
+        threw = True
+    harness.ok(threw,
+               "Should not allow two non-partial interfaces with the same name")
+
+    parser = parser.reset()
+    threw = False
+    try:
+        parser.parse("""
+            partial interface A {
+                readonly attribute boolean x;
+            };
+            partial interface A {
+                readonly attribute boolean y;
+            };
+        """)
+        results = parser.finish()
+    except:
+        threw = True
+    harness.ok(threw,
+               "Must have a non-partial interface for a given name")
+
+    parser = parser.reset()
+    threw = False
+    try:
+        parser.parse("""
+            dictionary  A {
+                boolean x;
+            };
+            partial interface A {
+                readonly attribute boolean y;
+            };
+        """)
+        results = parser.finish()
+    except:
+        threw = True
+    harness.ok(threw,
+               "Should not allow a name collision between partial interface "
+               "and other object")
+
+    parser = parser.reset()
+    threw = False
+    try:
+        parser.parse("""
+            dictionary A {
+                boolean x;
+            };
+            interface A {
+                readonly attribute boolean y;
+            };
+        """)
+        results = parser.finish()
+    except:
+        threw = True
+    harness.ok(threw,
+               "Should not allow a name collision between interface "
+               "and other object")
+
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -85,22 +85,20 @@ interface Document : Node {
   // So sort of like Gecko extensions
   [Creator, Throws]
   CDATASection createCDATASection(DOMString data);
   [Creator, Throws]
   Attr createAttribute(DOMString name);
   [Creator, Throws]
   Attr createAttributeNS(DOMString? namespace, DOMString name);
   readonly attribute DOMString? inputEncoding;
-/*
 };
 
-http://www.whatwg.org/specs/web-apps/current-work/#the-document-object
+// http://www.whatwg.org/specs/web-apps/current-work/#the-document-object
 partial interface Document {
-*/
   [PutForwards=href, Unforgeable] readonly attribute Location? location;
   //(HTML only)         attribute DOMString domain;
   readonly attribute DOMString referrer;
   //(HTML only)         attribute DOMString cookie;
   readonly attribute DOMString lastModified;
   readonly attribute DOMString readyState;
 
   // DOM tree accessors
@@ -313,100 +311,85 @@ partial interface Document {
    * |-moz-element(#aImageElementId)|. If this is null, the function will
    * unregister the image element ID |aImageElementId|.
    *
    * @see <https://developer.mozilla.org/en/DOM/document.mozSetImageElement>
    */
   void mozSetImageElement(DOMString aImageElementId,
                           Element? aImageElement);
 
-/*
 };
 
-http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api
+// http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api
 partial interface Document {
-*/
   // Note: Per spec the 'S' in these two is lowercase, but the "Moz"
   // versions hve it uppercase.
   readonly attribute boolean mozFullScreenEnabled;
   [Throws]
   readonly attribute Element? mozFullScreenElement;
 
   //(Renamed?)void exitFullscreen();
 
   // Gecko-specific fullscreen bits
   readonly attribute boolean mozFullScreen;
   void mozCancelFullScreen();
-/*
 };
 
-http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface
+// http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface
 partial interface Document {
-*/
     readonly attribute Element? mozPointerLockElement;
     void mozExitPointerLock ();
-/*
 };
 
-http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#sec-document-interface
+// http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#sec-document-interface
 partial interface Document {
-*/
   readonly attribute boolean hidden;
   readonly attribute boolean mozHidden;
   readonly attribute VisibilityState visibilityState;
   readonly attribute VisibilityState mozVisibilityState;
-/*
 };
 
-http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface
+// http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface
 partial interface Document {
-*/
     [Constant]
     readonly attribute StyleSheetList styleSheets;
     attribute DOMString? selectedStyleSheetSet;
     readonly attribute DOMString? lastStyleSheetSet;
     readonly attribute DOMString? preferredStyleSheetSet;
     [Constant]
     readonly attribute DOMStringList styleSheetSets;
     void enableStyleSheetsForSet (DOMString? name);
-/*
 };
 
-http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
+// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
 partial interface Document {
-*/
     Element? elementFromPoint (float x, float y);
 
     CaretPosition? caretPositionFromPoint (float x, float y);
-/*
 };
 
-http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html
+// http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html
 partial interface Document {
-*/
     [Pref="dom.undo_manager.enabled"]
     readonly attribute UndoManager? undoManager;
-/*
 };
 
-http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions
+// http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions
 partial interface Document {
-*/
   [Throws]
   Element?  querySelector(DOMString selectors);
   [Throws]
   NodeList  querySelectorAll(DOMString selectors);
 
   //(Not implemented)Element?  find(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
   //(Not implemented)NodeList  findAll(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
-/*};
+};
 
-  Mozilla extensions of various sorts
-*/
-
+//  Mozilla extensions of various sorts
+partial interface Document {
   // nsIDOMDocumentXBL.  Wish we could make these [ChromeOnly], but
   // that would likely break bindings running with the page principal.
   NodeList? getAnonymousNodes(Element elt);
   Element? getAnonymousElementByAttribute(Element elt, DOMString attrName,
                                           DOMString attrValue);
   [Throws]
   void addBinding(Element elt, DOMString bindingURL);
   [Throws]
--- a/dom/webidl/DocumentFragment.webidl
+++ b/dom/webidl/DocumentFragment.webidl
@@ -14,20 +14,17 @@
 interface DocumentFragment : Node {
   // NEW
   /*
     FIXME: not implemented yet
 
   void prepend((Node or DOMString)... nodes);
   void append((Node or DOMString)... nodes);
   */
-
-/*
 };
 
-http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions
+// http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions
 partial interface DocumentFragment {
-*/
   [Throws]
   Element?  querySelector(DOMString selectors);
   [Throws]
   NodeList  querySelectorAll(DOMString selectors);
 };
--- a/dom/webidl/Element.webidl
+++ b/dom/webidl/Element.webidl
@@ -133,22 +133,20 @@ interface Element : Node {
   [Throws]
   Attr setAttributeNode(Attr newAttr);
   [Throws]
   Attr removeAttributeNode(Attr oldAttr);
   [Throws]
   Attr getAttributeNodeNS(DOMString? namespaceURI, DOMString localName);
   [Throws]
   Attr setAttributeNodeNS(Attr newAttr);
-/*
 };
 
 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
 partial interface Element {
-*/
   [Throws]
   ClientRectList getClientRects();
   ClientRect getBoundingClientRect();
 
   // scrolling
   void scrollIntoView(optional boolean top = true);
            attribute long scrollTop;   // scroll on setting
            attribute long scrollLeft;  // scroll on setting
@@ -161,41 +159,35 @@ partial interface Element {
   readonly attribute long clientHeight;
 
   // Mozilla specific stuff
   /* The maximum offset that the element can be scrolled to
      (i.e., the value that scrollLeft/scrollTop would be clamped to if they were
      set to arbitrarily large values. */
   readonly attribute long scrollTopMax;
   readonly attribute long scrollLeftMax;
-/*
 };
 
 // http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html
 partial interface Element {
-*/
   [Pref="dom.undo_manager.enabled"]
   readonly attribute UndoManager? undoManager;
   [SetterThrows,Pref="dom.undo_manager.enabled"]
   attribute boolean undoScope;
-/*
 };
 
 // http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
 partial interface Element {
-*/
   [Throws,TreatNullAs=EmptyString]
   attribute DOMString innerHTML;
   [Throws,TreatNullAs=EmptyString]
   attribute DOMString outerHTML;
   [Throws]
   void insertAdjacentHTML(DOMString position, DOMString text);
-/*
 };
 
 // http://www.w3.org/TR/selectors-api/#interface-definitions
 partial interface Element {
-*/
   [Throws]
   Element?  querySelector(DOMString selectors);
   [Throws]
   NodeList  querySelectorAll(DOMString selectors);
 };
--- a/dom/webidl/HTMLAnchorElement.webidl
+++ b/dom/webidl/HTMLAnchorElement.webidl
@@ -40,21 +40,20 @@ interface HTMLAnchorElement : HTMLElemen
   // URL decomposition IDL attributes
            attribute DOMString protocol;
            attribute DOMString host;
            attribute DOMString hostname;
            attribute DOMString port;
            attribute DOMString pathname;
            attribute DOMString search;
            attribute DOMString hash;
-/*};
+};
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLAnchorElement {
-*/
            [SetterThrows]
            attribute DOMString coords;
            [SetterThrows]
            attribute DOMString charset;
            [SetterThrows]
            attribute DOMString name;
            [SetterThrows]
            attribute DOMString rev;
--- a/dom/webidl/HTMLBodyElement.webidl
+++ b/dom/webidl/HTMLBodyElement.webidl
@@ -43,20 +43,18 @@ interface HTMLBodyElement : HTMLElement 
   [SetterThrows]
   attribute EventHandler onresize;
   //[SetterThrows]
   //attribute EventHandler onscroll;
   //[SetterThrows]
   //attribute EventHandler onstorage;
   [SetterThrows]
   attribute EventHandler onunload;
-/*
 };
 
 partial interface HTMLBodyElement {
-*/
   [TreatNullAs=EmptyString, SetterThrows] attribute DOMString text;
   [TreatNullAs=EmptyString, SetterThrows] attribute DOMString link;
   [TreatNullAs=EmptyString, SetterThrows] attribute DOMString vLink;
   [TreatNullAs=EmptyString, SetterThrows] attribute DOMString aLink;
   [TreatNullAs=EmptyString, SetterThrows] attribute DOMString bgColor;
   [SetterThrows]                          attribute DOMString background;
 };
--- a/dom/webidl/HTMLDListElement.webidl
+++ b/dom/webidl/HTMLDListElement.webidl
@@ -9,17 +9,15 @@
  *
  *  Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
 // http://www.whatwg.org/specs/web-apps/current-work/#the-dl-element
 interface HTMLDListElement : HTMLElement {
-/*
 };
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLDListElement {
-*/
            [SetterThrows]
            attribute boolean compact;
 };
--- a/dom/webidl/HTMLDivElement.webidl
+++ b/dom/webidl/HTMLDivElement.webidl
@@ -6,15 +6,14 @@
  * The origin of this IDL file is
  * http://www.whatwg.org/specs/web-apps/current-work/
  *
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
-interface HTMLDivElement : HTMLElement {/*};
+interface HTMLDivElement : HTMLElement {};
 
 partial interface HTMLDivElement {
-*/
   [SetterThrows]
            attribute DOMString align;
 };
--- a/dom/webidl/HTMLElement.webidl
+++ b/dom/webidl/HTMLElement.webidl
@@ -217,22 +217,20 @@ interface HTMLElement : Element {
            attribute EventHandler ontouchcancel;
 
   [SetterThrows]
            attribute EventHandler oncopy;
   [SetterThrows]
            attribute EventHandler oncut;
   [SetterThrows]
            attribute EventHandler onpaste;
-/*
 };
 
 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interface
 partial interface HTMLElement {
-*/
   readonly attribute Element? offsetParent;
   readonly attribute long offsetTop;
   readonly attribute long offsetLeft;
   readonly attribute long offsetWidth;
   readonly attribute long offsetHeight;
 };
 
 interface HTMLUnknownElement : HTMLElement {};
--- a/dom/webidl/HTMLHeadingElement.webidl
+++ b/dom/webidl/HTMLHeadingElement.webidl
@@ -8,15 +8,14 @@
  * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
 // http://www.whatwg.org/specs/web-apps/current-work/#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements
 interface HTMLHeadingElement : HTMLElement {
-/*};
+};
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLHeadingElement {
-*/
            attribute DOMString align;
 };
--- a/dom/webidl/HTMLImageElement.webidl
+++ b/dom/webidl/HTMLImageElement.webidl
@@ -34,21 +34,20 @@ interface HTMLImageElement : HTMLElement
            attribute boolean isMap;
            [SetterThrows]
            attribute unsigned long width;
            [SetterThrows]
            attribute unsigned long height;
   readonly attribute unsigned long naturalWidth;
   readonly attribute unsigned long naturalHeight;
   readonly attribute boolean complete;
-/*};
+};
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLImageElement {
-*/
            [SetterThrows]
            attribute DOMString name;
            [SetterThrows]
            attribute DOMString align;
            [SetterThrows]
            attribute unsigned long hspace;
            [SetterThrows]
            attribute unsigned long vspace;
--- a/dom/webidl/HTMLLIElement.webidl
+++ b/dom/webidl/HTMLLIElement.webidl
@@ -11,17 +11,15 @@
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
 // http://www.whatwg.org/specs/web-apps/current-work/#the-li-element
 interface HTMLLIElement : HTMLElement {
            [SetterThrows]
            attribute long value;
-/*
 };
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLLIElement {
-*/
            [SetterThrows]
            attribute DOMString type;
 };
--- a/dom/webidl/HTMLOListElement.webidl
+++ b/dom/webidl/HTMLOListElement.webidl
@@ -15,17 +15,15 @@
 // http://www.whatwg.org/specs/web-apps/current-work/#the-ol-element
 interface HTMLOListElement : HTMLElement {
            [SetterThrows]
            attribute boolean reversed;
            [SetterThrows]
            attribute long start;
            [SetterThrows]
            attribute DOMString type;
-/*
 };
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLOListElement {
-*/
            [SetterThrows]
            attribute boolean compact;
 };
--- a/dom/webidl/HTMLParagraphElement.webidl
+++ b/dom/webidl/HTMLParagraphElement.webidl
@@ -8,16 +8,15 @@
  * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
 // http://www.whatwg.org/specs/web-apps/current-work/#the-p-element
 interface HTMLParagraphElement : HTMLElement {
-/*};
+};
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLParagraphElement {
-*/
            [SetterThrows]
            attribute DOMString align;
 };
--- a/dom/webidl/HTMLPreElement.webidl
+++ b/dom/webidl/HTMLPreElement.webidl
@@ -8,16 +8,15 @@
  * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
 // http://www.whatwg.org/specs/web-apps/current-work/#the-pre-element
 interface HTMLPreElement : HTMLElement {
-/*};
+};
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLPreElement {
-*/
            [SetterThrows]
            attribute long width;
 };
--- a/dom/webidl/HTMLScriptElement.webidl
+++ b/dom/webidl/HTMLScriptElement.webidl
@@ -18,20 +18,18 @@ interface HTMLScriptElement : HTMLElemen
   [SetterThrows]
   attribute boolean async;
   [SetterThrows]
   attribute boolean defer;
   [SetterThrows]
   attribute DOMString crossOrigin;
   [SetterThrows]
   attribute DOMString text;
-/*
 };
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLScriptElement {
-*/
   [SetterThrows]
   attribute DOMString event;
   [SetterThrows]
   attribute DOMString htmlFor;
 };
 
--- a/dom/webidl/HTMLTableCaptionElement.webidl
+++ b/dom/webidl/HTMLTableCaptionElement.webidl
@@ -6,15 +6,14 @@
  * The origin of this IDL file is
  * http://www.whatwg.org/specs/web-apps/current-work/
  *
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
-interface HTMLTableCaptionElement : HTMLElement {/*};
+interface HTMLTableCaptionElement : HTMLElement {};
 
 partial interface HTMLTableCaptionElement {
-*/
            [SetterThrows]
            attribute DOMString align;
 };
--- a/dom/webidl/HTMLTableCellElement.webidl
+++ b/dom/webidl/HTMLTableCellElement.webidl
@@ -21,21 +21,19 @@ interface HTMLTableCellElement : HTMLEle
            attribute DOMString headers;
   readonly attribute long cellIndex;
 
   // Mozilla-specific extensions
            [SetterThrows]
            attribute DOMString abbr;
            [SetterThrows]
            attribute DOMString scope;
-/*
 };
 
 partial interface HTMLTableCellElement {
-*/
            [SetterThrows]
            attribute DOMString align;
            [SetterThrows]
            attribute DOMString axis;
            [SetterThrows]
            attribute DOMString height;
            [SetterThrows]
            attribute DOMString width;
--- a/dom/webidl/HTMLTableColElement.webidl
+++ b/dom/webidl/HTMLTableColElement.webidl
@@ -8,19 +8,17 @@
  *
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
 interface HTMLTableColElement : HTMLElement {
            attribute unsigned long span;
-/*
 };
 
 partial interface HTMLTableColElement {
-*/
            attribute DOMString align;
            attribute DOMString ch;
            attribute DOMString chOff;
            attribute DOMString vAlign;
            attribute DOMString width;
 };
--- a/dom/webidl/HTMLTableElement.webidl
+++ b/dom/webidl/HTMLTableElement.webidl
@@ -27,21 +27,19 @@ interface HTMLTableElement : HTMLElement
   //HTMLElement createTBody();
   readonly attribute HTMLCollection rows;
   [Throws]
   HTMLElement insertRow(optional long index = -1);
   [Throws]
   void deleteRow(long index);
   //         attribute boolean sortable;
   //void stopSorting();
-/*
 };
 
 partial interface HTMLTableElement {
-*/
            [SetterThrows]
            attribute DOMString align;
            [SetterThrows]
            attribute DOMString border;
            [SetterThrows]
            attribute DOMString frame;
            [SetterThrows]
            attribute DOMString rules;
--- a/dom/webidl/HTMLTableRowElement.webidl
+++ b/dom/webidl/HTMLTableRowElement.webidl
@@ -14,21 +14,19 @@
 interface HTMLTableRowElement : HTMLElement {
   readonly attribute long rowIndex;
   readonly attribute long sectionRowIndex;
   readonly attribute HTMLCollection cells;
   [Throws]
   HTMLElement insertCell(optional long index = -1);
   [Throws]
   void deleteCell(long index);
-/*
 };
 
 partial interface HTMLTableRowElement {
-*/
            [SetterThrows]
            attribute DOMString align;
            [SetterThrows]
            attribute DOMString ch;
            [SetterThrows]
            attribute DOMString chOff;
            [SetterThrows]
            attribute DOMString vAlign;
--- a/dom/webidl/HTMLTableSectionElement.webidl
+++ b/dom/webidl/HTMLTableSectionElement.webidl
@@ -12,21 +12,19 @@
  */
 
 interface HTMLTableSectionElement : HTMLElement {
   readonly attribute HTMLCollection rows;
   [Throws]
   HTMLElement insertRow(optional long index = -1);
   [Throws]
   void deleteRow(long index);
-/*
 };
 
 partial interface HTMLTableSectionElement {
-*/
            [SetterThrows]
            attribute DOMString align;
            [SetterThrows]
            attribute DOMString ch;
            [SetterThrows]
            attribute DOMString chOff;
            [SetterThrows]
            attribute DOMString vAlign;
--- a/dom/webidl/HTMLUListElement.webidl
+++ b/dom/webidl/HTMLUListElement.webidl
@@ -9,19 +9,17 @@
  *
  *  Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
 // http://www.whatwg.org/specs/web-apps/current-work/#the-ul-element
 interface HTMLUListElement : HTMLElement {
-/*
 };
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLUListElement {
-*/
            [SetterThrows]
            attribute boolean compact;
            [SetterThrows]
            attribute DOMString type;
 };