Bug 1444745 - Part 2: Add the xptshim and xptshimfile attributes to xpidl, r=mccr8
authorNika Layzell <nika@thelayzells.com>
Wed, 04 Apr 2018 18:16:21 -0400
changeset 414196 e6049a77ddc24cc109ac3f95800f9ea5ad33dfa2
parent 414195 da98166e73a816cb3973c799e1e9c46ec2bd9dc7
child 414197 a0b17dbda47e7f356e3df848488f62a6d61ebf47
push id33861
push userccoroiu@mozilla.com
push dateWed, 18 Apr 2018 10:50:38 +0000
treeherdermozilla-central@4af4ae0aee55 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1444745
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1444745 - Part 2: Add the xptshim and xptshimfile attributes to xpidl, r=mccr8 In the previous patch, one of the files which was deleted is ShimInterfaceInfo. This is an implementor of nsIInterfaceInfo which exists for legacy reasons, in order to allow Components.interfaces.nsIDOM* to have the correct constants and IIDs associated with them. As that file was deleted, this information now has to be stored in the typelib. To do this, the information is moved to the xptshim and xptshimfile attributes on the relevant xpcom interfaces. xptshim(...) means that this xpcom interface is a shim for the WebIDL interface with the specified name. xptshimfile(...) is for use when the webidl interface is declared in another interface's .webidl file, (in our case, MessageManager.webidl). It contains the name of the parent binding, such that we can #include the correct file in our generated code. This patch does not add the code which uses these changes, only the parsing logic.
dom/base/moz.build
dom/base/nsIDOMDOMCursor.idl
dom/base/nsIDOMDOMRequest.idl
dom/base/nsIDOMParser.idl
dom/base/nsIMessageManager.idl
dom/base/nsISelection.idl
dom/interfaces/core/nsIDOMDocument.idl
dom/interfaces/core/nsIDOMDocumentFragment.idl
dom/interfaces/core/nsIDOMElement.idl
dom/interfaces/core/nsIDOMNode.idl
dom/interfaces/core/nsIDOMNodeList.idl
dom/interfaces/events/nsIDOMEvent.idl
dom/interfaces/events/nsIDOMEventTarget.idl
dom/interfaces/geolocation/nsIDOMGeoPositionError.idl
dom/interfaces/html/nsIDOMHTMLInputElement.idl
dom/interfaces/offline/nsIDOMOfflineResourceList.idl
dom/interfaces/range/nsIDOMRange.idl
layout/xul/nsIListBoxObject.idl
xpcom/idl-parser/xpidl/xpidl.py
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -63,16 +63,17 @@ EXPORTS += [
     'nsDocumentWarningList.h',
     'nsDOMAttributeMap.h',
     'nsDOMCID.h',
     'nsDOMJSUtils.h',
     'nsDOMNavigationTiming.h',
     'nsDOMString.h',
     'nsDOMTokenList.h',
     'nsFocusManager.h',
+    'nsFrameLoader.h',  # Because binding headers include it.
     'nsFrameMessageManager.h',
     'nsGlobalWindow.h',  # Because binding headers include it.
     'nsGlobalWindowInner.h',  # Because binding headers include it.
     'nsGlobalWindowOuter.h',  # Because binding headers include it.
     'nsIAnimationObserver.h',
     'nsIAttribute.h',
     'nsIContent.h',
     'nsIContentInlines.h',
--- a/dom/base/nsIDOMDOMCursor.idl
+++ b/dom/base/nsIDOMDOMCursor.idl
@@ -7,14 +7,14 @@
 #include "nsISupports.idl"
 
 [scriptable, function, uuid(3a75d80a-9258-4ab8-95fd-ec0b5f634df1)]
 interface nsICursorContinueCallback : nsISupports
 {
   void handleContinue();
 };
 
-[builtinclass, uuid(062ea35a-5158-425a-b7bc-3ae9daa84398)]
+[uuid(062ea35a-5158-425a-b7bc-3ae9daa84398)]
 interface nsIDOMDOMCursor : nsISupports
 {
   readonly attribute boolean done;
   void continue();
 };
--- a/dom/base/nsIDOMDOMRequest.idl
+++ b/dom/base/nsIDOMDOMRequest.idl
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIDOMEventTarget.idl"
 
 interface mozIDOMWindow;
 interface nsICursorContinueCallback;
 
-[builtinclass, uuid(e39da69e-2232-4e49-9856-b8a4a6210336)]
+[shim(DOMRequest), uuid(e39da69e-2232-4e49-9856-b8a4a6210336)]
 interface nsIDOMDOMRequest : nsIDOMEventTarget
 {
   readonly attribute DOMString readyState; // "pending" or "done"
 
   readonly attribute jsval result;
 
   // DOMException
   readonly attribute nsISupports error;
--- a/dom/base/nsIDOMParser.idl
+++ b/dom/base/nsIDOMParser.idl
@@ -14,17 +14,17 @@ interface nsIGlobalObject;
 /**
  * The nsIDOMParser interface is a non-SAX interface that can be used
  * to parse a string or byte stream containing XML or HTML content
  * to a DOM document. Parsing is always synchronous - a document is always
  * returned from the parsing methods. This is as opposed to loading and
  * parsing with the XMLHttpRequest interface, which can be used for
  * asynchronous (callback-based) loading.
  */
-[uuid(70b9600e-8622-4c93-9ad8-22c28058dc44)]
+[shim(DOMParser), uuid(70b9600e-8622-4c93-9ad8-22c28058dc44)]
 interface nsIDOMParser : nsISupports
 {
   /**
    * The string passed in is parsed into a DOM document.
    *
    * @param str The UTF16 string to be parsed
    * @param contentType The content type of the string (see parseFromStream)
    * @returns The DOM document created as a result of parsing the 
--- a/dom/base/nsIMessageManager.idl
+++ b/dom/base/nsIMessageManager.idl
@@ -2,22 +2,24 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 interface nsIContent;
 
-[uuid(bb5d79e4-e73c-45e7-9651-4d718f4b994c)]
+[shim(MessageSender), shimfile(MessageManager),
+ uuid(bb5d79e4-e73c-45e7-9651-4d718f4b994c)]
 interface nsIMessageSender : nsISupports
 {
 };
 
-[uuid(694e367c-aa25-4446-8499-2c527c4bd838)]
+[shim(ContentFrameMessageManager), shimfile(MessageManager),
+ uuid(694e367c-aa25-4446-8499-2c527c4bd838)]
 interface nsIContentFrameMessageManager : nsIMessageSender
 {
 };
 
 [uuid(b39a3324-b574-4f85-8cdb-274d04f807ef)]
 interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
 {
   [notxpcom] nsIContent getOwnerContent();
--- a/dom/base/nsISelection.idl
+++ b/dom/base/nsISelection.idl
@@ -20,17 +20,17 @@ class Selection;
 
 /**
  * Interface for manipulating and querying the current selected range
  * of nodes within the document.
  *
  * @version 1.0
  */
 
-[builtinclass, uuid(e0a4d4b3-f34e-44bd-b1f2-4e3bde9b6915)]
+[shim(Selection), uuid(e0a4d4b3-f34e-44bd-b1f2-4e3bde9b6915)]
 interface nsISelection : nsISupports
 {
     /**
      * Returns the node in which the selection begins.
      */
     readonly attribute nsIDOMNode anchorNode;
 
     /**
--- a/dom/interfaces/core/nsIDOMDocument.idl
+++ b/dom/interfaces/core/nsIDOMDocument.idl
@@ -13,12 +13,12 @@
  * cannot exist outside the context of a Document, the nsIDOMDocument
  * interface also contains the factory methods needed to create these
  * objects.
  *
  * For more information on this interface please see
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
  */
 
-[uuid(b15fa0f4-97c1-4388-af62-2ceff7a89bdf)]
+[shim(Document), uuid(b15fa0f4-97c1-4388-af62-2ceff7a89bdf)]
 interface nsIDOMDocument : nsIDOMNode
 {
 };
--- a/dom/interfaces/core/nsIDOMDocumentFragment.idl
+++ b/dom/interfaces/core/nsIDOMDocumentFragment.idl
@@ -9,12 +9,12 @@
  * DocumentFragment is a "lightweight" or "minimal" Document object.
  * nsIDOMDocumentFragment is used in situations where the Document
  * interface can potentially be a heavyweight interface.
  *
  * For more information on this interface please see 
  * http://www.w3.org/TR/DOM-Level-2-Core/
  */
 
-[builtinclass, uuid(48eb8d72-95bb-402e-a8fc-f2b187abcbdb)]
+[shim(DocumentFragment), uuid(48eb8d72-95bb-402e-a8fc-f2b187abcbdb)]
 interface nsIDOMDocumentFragment : nsIDOMNode
 {
 };
--- a/dom/interfaces/core/nsIDOMElement.idl
+++ b/dom/interfaces/core/nsIDOMElement.idl
@@ -19,12 +19,12 @@ interface nsIDOMMozNamedAttrMap;
 /**
  * The nsIDOMElement interface represents an element in an HTML or 
  * XML document. 
  *
  * For more information on this interface please see 
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-element
  */
 
-[uuid(6289999b-1008-4269-b42a-413ec5a9d3f4)]
+[shim(Element), uuid(6289999b-1008-4269-b42a-413ec5a9d3f4)]
 interface nsIDOMElement : nsIDOMNode
 {
 };
--- a/dom/interfaces/core/nsIDOMNode.idl
+++ b/dom/interfaces/core/nsIDOMNode.idl
@@ -9,12 +9,12 @@
  * The nsIDOMNode interface is the primary datatype for the entire
  * Document Object Model.
  * It represents a single node in the document tree.
  *
  * For more information on this interface please see
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
  */
 
-[uuid(cc35b412-009b-46a3-9be0-76448f12548d)]
+[shim(Node), uuid(cc35b412-009b-46a3-9be0-76448f12548d)]
 interface nsIDOMNode : nsISupports
 {
 };
--- a/dom/interfaces/core/nsIDOMNodeList.idl
+++ b/dom/interfaces/core/nsIDOMNodeList.idl
@@ -10,12 +10,12 @@
  * collection of nodes, without defining or constraining how this collection 
  * is implemented.
  * The items in the list are accessible via an integral index, starting from 0.
  *
  * For more information on this interface please see 
  * http://www.w3.org/TR/DOM-Level-2-Core/
  */
 
-[uuid(450cf0ba-de90-4f86-85bf-e10cc8b8713f)]
+[shim(NodeList), uuid(450cf0ba-de90-4f86-85bf-e10cc8b8713f)]
 interface nsIDOMNodeList : nsISupports
 {
 };
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -37,17 +37,17 @@ class EventTarget;
  * The nsIDOMEvent interface is the primary datatype for all events in
  * the Document Object Model.
  *
  * For more information on this interface please see 
  * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html and
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
  */
 
-[builtinclass, uuid(f58daacf-4d1a-4002-8fd7-06b614dfbcf6)]
+[shim(Event), uuid(f58daacf-4d1a-4002-8fd7-06b614dfbcf6)]
 interface nsIDOMEvent : nsISupports
 {
   // PhaseType
   /**
    * The event isn't being dispatched.
    */
   const unsigned short      NONE                           = 0;
   /**
--- a/dom/interfaces/events/nsIDOMEventTarget.idl
+++ b/dom/interfaces/events/nsIDOMEventTarget.idl
@@ -1,11 +1,11 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "domstubs.idl"
 
-[uuid(9a78ac3c-9507-4d00-b2d6-10b508d2ec31)]
+[shim(EventTarget), uuid(9a78ac3c-9507-4d00-b2d6-10b508d2ec31)]
 interface nsIDOMEventTarget : nsISupports
 {
 };
--- a/dom/interfaces/geolocation/nsIDOMGeoPositionError.idl
+++ b/dom/interfaces/geolocation/nsIDOMGeoPositionError.idl
@@ -7,17 +7,17 @@
 
 // undef the GetMessage macro defined in winuser.h from the MS Platform SDK
 %{C++
 #ifdef GetMessage
 #undef GetMessage
 #endif
 %}
 
-[uuid(85255CC3-07BA-49FD-BC9B-18D2963DAF7F)]
+[shim(PositionError), uuid(85255CC3-07BA-49FD-BC9B-18D2963DAF7F)]
 interface nsIDOMGeoPositionError : nsISupports
 {
   const unsigned short PERMISSION_DENIED  = 1;
   const unsigned short POSITION_UNAVAILABLE = 2;
   const unsigned short TIMEOUT = 3;
 
   readonly attribute short code;
   readonly attribute AString message;
--- a/dom/interfaces/html/nsIDOMHTMLInputElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLInputElement.idl
@@ -11,12 +11,12 @@
   *
   * This interface is trying to follow the DOM Level 2 HTML specification:
   * http://www.w3.org/TR/DOM-Level-2-HTML/
   *
   * with changes from the work-in-progress WHATWG HTML specification:
   * http://www.whatwg.org/specs/web-apps/current-work/
   */
 
-[uuid(64aeda0b-e9b5-4868-a4f9-e4776e32e733)]
+[shim(HTMLInputElement), uuid(64aeda0b-e9b5-4868-a4f9-e4776e32e733)]
 interface nsIDOMHTMLInputElement : nsISupports
 {
 };
--- a/dom/interfaces/offline/nsIDOMOfflineResourceList.idl
+++ b/dom/interfaces/offline/nsIDOMOfflineResourceList.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "domstubs.idl"
 
-[uuid(6044702d-e4a9-420c-b711-558b7d6a3b9f)]
+[shim(OfflineResourceList), uuid(6044702d-e4a9-420c-b711-558b7d6a3b9f)]
 interface nsIDOMOfflineResourceList : nsISupports
 {
   /**
    * Get the list of dynamically-managed entries.
    */
   readonly attribute nsISupports mozItems;
 
   /**
--- a/dom/interfaces/range/nsIDOMRange.idl
+++ b/dom/interfaces/range/nsIDOMRange.idl
@@ -7,12 +7,12 @@
 
 /**
  * The nsIDOMRange interface is an interface to a DOM range object.
  *
  * For more information on this interface please see
  * http://www.w3.org/TR/DOM-Level-2-Traversal-Range/
  */
 
-[builtinclass, uuid(1f94055c-42e7-4a30-96a1-6a804f1c2d1e)]
+[shim(Range), uuid(1f94055c-42e7-4a30-96a1-6a804f1c2d1e)]
 interface nsIDOMRange : nsISupports
 {
 };
--- a/layout/xul/nsIListBoxObject.idl
+++ b/layout/xul/nsIListBoxObject.idl
@@ -4,16 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 // DEPRECATED: see ListBoxObject.webidl
 
 interface nsIDOMElement;
 
-[uuid(AA9DEF4E-2E59-412d-A6DF-B76F52167795)]
+[shim(ListBoxObject), uuid(AA9DEF4E-2E59-412d-A6DF-B76F52167795)]
 interface nsIListBoxObject : nsISupports
 {
   long getRowCount();
 
   nsIDOMElement getItemAtIndex(in long index);
   long getIndexOfItem(in nsIDOMElement item);
 };
--- a/xpcom/idl-parser/xpidl/xpidl.py
+++ b/xpcom/idl-parser/xpidl/xpidl.py
@@ -686,16 +686,18 @@ class Interface(object):
 
 class InterfaceAttributes(object):
     uuid = None
     scriptable = False
     builtinclass = False
     function = False
     noscript = False
     main_process_scriptable_only = False
+    shim = None
+    shimfile = None
 
     def setuuid(self, value):
         self.uuid = value.lower()
 
     def setscriptable(self):
         self.scriptable = True
 
     def setfunction(self):
@@ -705,24 +707,32 @@ class InterfaceAttributes(object):
         self.noscript = True
 
     def setbuiltinclass(self):
         self.builtinclass = True
 
     def setmain_process_scriptable_only(self):
         self.main_process_scriptable_only = True
 
+    def setshim(self, value):
+        self.shim = value
+
+    def setshimfile(self, value):
+        self.shimfile = value
+
     actions = {
         'uuid':       (True, setuuid),
         'scriptable': (False, setscriptable),
         'builtinclass': (False, setbuiltinclass),
         'function':   (False, setfunction),
         'noscript':   (False, setnoscript),
         'object':     (False, lambda self: True),
         'main_process_scriptable_only': (False, setmain_process_scriptable_only),
+        'shim':    (True, setshim),
+        'shimfile': (True, setshimfile),
         }
 
     def __init__(self, attlist, location):
         def badattribute(self):
             raise IDLError("Unexpected interface attribute '%s'" % name, location)
 
         for name, val, aloc in attlist:
             hasval, action = self.actions.get(name, (False, badattribute))
@@ -749,16 +759,20 @@ class InterfaceAttributes(object):
         if self.scriptable:
             l.append("\tscriptable\n")
         if self.builtinclass:
             l.append("\tbuiltinclass\n")
         if self.function:
             l.append("\tfunction\n")
         if self.main_process_scriptable_only:
             l.append("\tmain_process_scriptable_only\n")
+        if self.shim:
+            l.append("\tshim: %s\n" % self.shim)
+        if self.shimfile:
+            l.append("\tshimfile: %s\n" % self.shimfile)
         return "".join(l)
 
 
 class ConstMember(object):
     kind = 'const'
 
     def __init__(self, type, name, value, location, doccomments):
         self.type = type