LCOV - code coverage report
Current view: top level - xpcom/reflect/xptinfo - ShimInterfaceInfo.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 20 99 20.2 %
Date: 2017-07-14 16:53:18 Functions: 7 27 25.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2             :  * vim: set ts=8 sw=4 et tw=78:
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       7             : 
       8             : #include "ShimInterfaceInfo.h"
       9             : 
      10             : #include "nsIBrowserBoxObject.h"
      11             : #include "nsIContainerBoxObject.h"
      12             : #include "nsIDOMAnimationEvent.h"
      13             : #include "nsIDOMAttr.h"
      14             : #include "nsIDOMBeforeUnloadEvent.h"
      15             : #include "nsIDOMCanvasRenderingContext2D.h"
      16             : #include "nsIDOMCDATASection.h"
      17             : #include "nsIDOMCharacterData.h"
      18             : #include "nsIDOMClientRect.h"
      19             : #include "nsIDOMClientRectList.h"
      20             : #include "nsIDOMClipboardEvent.h"
      21             : #include "nsIDOMCommandEvent.h"
      22             : #include "nsIDOMComment.h"
      23             : #include "nsIDOMCSSPrimitiveValue.h"
      24             : #include "nsIDOMCSSStyleDeclaration.h"
      25             : #include "nsIDOMCSSStyleSheet.h"
      26             : #include "nsIDOMCSSValue.h"
      27             : #include "nsIDOMCSSValueList.h"
      28             : #include "nsIDOMCustomEvent.h"
      29             : #ifdef MOZ_WEBRTC
      30             : #include "nsIDOMDataChannel.h"
      31             : #endif
      32             : #include "nsIDOMDataTransfer.h"
      33             : #include "nsIDOMDOMCursor.h"
      34             : #include "nsIDOMDOMException.h"
      35             : #include "nsIDOMDOMRequest.h"
      36             : #include "nsIDOMDocument.h"
      37             : #include "nsIDOMDocumentFragment.h"
      38             : #include "nsIDOMDocumentType.h"
      39             : #include "nsIDOMDocumentXBL.h"
      40             : #include "nsIDOMDragEvent.h"
      41             : #include "nsIDOMElement.h"
      42             : #include "nsIDOMEvent.h"
      43             : #include "nsIDOMEventTarget.h"
      44             : #include "nsIDOMFileList.h"
      45             : #include "nsIDOMFocusEvent.h"
      46             : #include "nsIDOMFormData.h"
      47             : #include "nsIDOMGeoPositionError.h"
      48             : #include "nsIDOMHistory.h"
      49             : #include "nsIDOMHTMLAnchorElement.h"
      50             : #include "nsIDOMHTMLAppletElement.h"
      51             : #include "nsIDOMHTMLAreaElement.h"
      52             : #include "nsIDOMHTMLBaseElement.h"
      53             : #include "nsIDOMHTMLBodyElement.h"
      54             : #include "nsIDOMHTMLButtonElement.h"
      55             : #include "nsIDOMHTMLCanvasElement.h"
      56             : #include "nsIDOMHTMLCollection.h"
      57             : #include "nsIDOMHTMLDirectoryElement.h"
      58             : #include "nsIDOMHTMLDocument.h"
      59             : #include "nsIDOMHTMLElement.h"
      60             : #include "nsIDOMHTMLEmbedElement.h"
      61             : #include "nsIDOMHTMLFieldSetElement.h"
      62             : #include "nsIDOMHTMLFormElement.h"
      63             : #include "nsIDOMHTMLFrameElement.h"
      64             : #include "nsIDOMHTMLFrameSetElement.h"
      65             : #include "nsIDOMHTMLHRElement.h"
      66             : #include "nsIDOMHTMLHeadElement.h"
      67             : #include "nsIDOMHTMLHtmlElement.h"
      68             : #include "nsIDOMHTMLIFrameElement.h"
      69             : #include "nsIDOMHTMLImageElement.h"
      70             : #include "nsIDOMHTMLInputElement.h"
      71             : #include "nsIDOMHTMLLIElement.h"
      72             : #include "nsIDOMHTMLLabelElement.h"
      73             : #include "nsIDOMHTMLLinkElement.h"
      74             : #include "nsIDOMHTMLMapElement.h"
      75             : #include "nsIDOMHTMLMediaElement.h"
      76             : #include "nsIDOMHTMLMenuElement.h"
      77             : #include "nsIDOMHTMLMenuItemElement.h"
      78             : #include "nsIDOMHTMLMetaElement.h"
      79             : #include "nsIDOMHTMLOListElement.h"
      80             : #include "nsIDOMHTMLObjectElement.h"
      81             : #include "nsIDOMHTMLOptGroupElement.h"
      82             : #include "nsIDOMHTMLOptionElement.h"
      83             : #include "nsIDOMHTMLOptionsCollection.h"
      84             : #include "nsIDOMHTMLParagraphElement.h"
      85             : #include "nsIDOMHTMLPreElement.h"
      86             : #include "nsIDOMHTMLQuoteElement.h"
      87             : #include "nsIDOMHTMLScriptElement.h"
      88             : #include "nsIDOMHTMLSelectElement.h"
      89             : #include "nsIDOMHTMLSourceElement.h"
      90             : #include "nsIDOMHTMLStyleElement.h"
      91             : #include "nsIDOMHTMLTableCellElement.h"
      92             : #include "nsIDOMHTMLTextAreaElement.h"
      93             : #include "nsIDOMHTMLUListElement.h"
      94             : #include "nsIDOMKeyEvent.h"
      95             : #include "nsIDOMMediaList.h"
      96             : #include "nsIDOMMouseEvent.h"
      97             : #include "nsIDOMMouseScrollEvent.h"
      98             : #include "nsIDOMMutationEvent.h"
      99             : #include "nsIDOMMozNamedAttrMap.h"
     100             : #include "nsIDOMNode.h"
     101             : #include "nsIDOMNodeIterator.h"
     102             : #include "nsIDOMNotifyPaintEvent.h"
     103             : #include "nsIDOMNSEvent.h"
     104             : #include "nsIDOMOfflineResourceList.h"
     105             : #include "nsIDOMPaintRequest.h"
     106             : #include "nsIDOMParser.h"
     107             : #include "nsIDOMProcessingInstruction.h"
     108             : #include "nsIDOMRange.h"
     109             : #include "nsIDOMRect.h"
     110             : #include "nsIDOMScreen.h"
     111             : #include "nsIDOMScrollAreaEvent.h"
     112             : #include "nsIDOMSerializer.h"
     113             : #include "nsIDOMSimpleGestureEvent.h"
     114             : #include "nsIDOMStyleSheet.h"
     115             : #include "nsIDOMStyleSheetList.h"
     116             : #include "nsIDOMSVGElement.h"
     117             : #include "nsIDOMSVGLength.h"
     118             : #include "nsIDOMText.h"
     119             : #include "nsIDOMTimeEvent.h"
     120             : #include "nsIDOMTimeRanges.h"
     121             : #include "nsIDOMTransitionEvent.h"
     122             : #include "nsIDOMTreeWalker.h"
     123             : #include "nsIDOMUIEvent.h"
     124             : #include "nsIDOMValidityState.h"
     125             : #include "nsIDOMWheelEvent.h"
     126             : #include "nsIDOMXMLDocument.h"
     127             : #include "nsIDOMXPathEvaluator.h"
     128             : #include "nsIDOMXPathResult.h"
     129             : #include "nsIDOMXULCommandEvent.h"
     130             : #include "nsIDOMXULDocument.h"
     131             : #include "nsIDOMXULElement.h"
     132             : #include "nsIListBoxObject.h"
     133             : #include "nsIMenuBoxObject.h"
     134             : #include "nsIScrollBoxObject.h"
     135             : #include "nsISelection.h"
     136             : #include "nsITreeBoxObject.h"
     137             : #include "nsIXMLHttpRequest.h"
     138             : 
     139             : #include "mozilla/dom/AnimationEventBinding.h"
     140             : #include "mozilla/dom/AttrBinding.h"
     141             : #include "mozilla/dom/BeforeUnloadEventBinding.h"
     142             : #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
     143             : #include "mozilla/dom/CDATASectionBinding.h"
     144             : #include "mozilla/dom/CharacterDataBinding.h"
     145             : #include "mozilla/dom/DOMRectBinding.h"
     146             : #include "mozilla/dom/DOMRectListBinding.h"
     147             : #include "mozilla/dom/ClipboardEventBinding.h"
     148             : #include "mozilla/dom/CommandEventBinding.h"
     149             : #include "mozilla/dom/CommentBinding.h"
     150             : #include "mozilla/dom/ContainerBoxObjectBinding.h"
     151             : #include "mozilla/dom/CSSPrimitiveValueBinding.h"
     152             : #include "mozilla/dom/CSSStyleDeclarationBinding.h"
     153             : #include "mozilla/dom/CSSStyleSheetBinding.h"
     154             : #include "mozilla/dom/CSSValueBinding.h"
     155             : #include "mozilla/dom/CSSValueListBinding.h"
     156             : #include "mozilla/dom/CustomEventBinding.h"
     157             : #ifdef MOZ_WEBRTC
     158             : #include "mozilla/dom/DataChannelBinding.h"
     159             : #endif
     160             : #include "mozilla/dom/DataTransferBinding.h"
     161             : #include "mozilla/dom/DOMCursorBinding.h"
     162             : #include "mozilla/dom/DOMExceptionBinding.h"
     163             : #include "mozilla/dom/DOMParserBinding.h"
     164             : #include "mozilla/dom/DOMRequestBinding.h"
     165             : #include "mozilla/dom/DocumentBinding.h"
     166             : #include "mozilla/dom/DocumentFragmentBinding.h"
     167             : #include "mozilla/dom/DocumentTypeBinding.h"
     168             : #include "mozilla/dom/DocumentBinding.h"
     169             : #include "mozilla/dom/DragEventBinding.h"
     170             : #include "mozilla/dom/ElementBinding.h"
     171             : #include "mozilla/dom/EventBinding.h"
     172             : #include "mozilla/dom/EventTargetBinding.h"
     173             : #include "mozilla/dom/FileListBinding.h"
     174             : #include "mozilla/dom/FocusEventBinding.h"
     175             : #include "mozilla/dom/FormDataBinding.h"
     176             : #include "mozilla/dom/HistoryBinding.h"
     177             : #include "mozilla/dom/HTMLAnchorElementBinding.h"
     178             : #include "mozilla/dom/HTMLAppletElementBinding.h"
     179             : #include "mozilla/dom/HTMLAreaElementBinding.h"
     180             : #include "mozilla/dom/HTMLBaseElementBinding.h"
     181             : #include "mozilla/dom/HTMLBodyElementBinding.h"
     182             : #include "mozilla/dom/HTMLButtonElementBinding.h"
     183             : #include "mozilla/dom/HTMLCanvasElementBinding.h"
     184             : #include "mozilla/dom/HTMLCollectionBinding.h"
     185             : #include "mozilla/dom/HTMLDirectoryElementBinding.h"
     186             : #include "mozilla/dom/HTMLDocumentBinding.h"
     187             : #include "mozilla/dom/HTMLElementBinding.h"
     188             : #include "mozilla/dom/HTMLEmbedElementBinding.h"
     189             : #include "mozilla/dom/HTMLFieldSetElementBinding.h"
     190             : #include "mozilla/dom/HTMLFormElementBinding.h"
     191             : #include "mozilla/dom/HTMLFrameElementBinding.h"
     192             : #include "mozilla/dom/HTMLFrameSetElementBinding.h"
     193             : #include "mozilla/dom/HTMLHRElementBinding.h"
     194             : #include "mozilla/dom/HTMLHeadElementBinding.h"
     195             : #include "mozilla/dom/HTMLHtmlElementBinding.h"
     196             : #include "mozilla/dom/HTMLIFrameElementBinding.h"
     197             : #include "mozilla/dom/HTMLImageElementBinding.h"
     198             : #include "mozilla/dom/HTMLInputElementBinding.h"
     199             : #include "mozilla/dom/HTMLLIElementBinding.h"
     200             : #include "mozilla/dom/HTMLLabelElementBinding.h"
     201             : #include "mozilla/dom/HTMLLinkElementBinding.h"
     202             : #include "mozilla/dom/HTMLMapElementBinding.h"
     203             : #include "mozilla/dom/HTMLMediaElementBinding.h"
     204             : #include "mozilla/dom/HTMLMenuElementBinding.h"
     205             : #include "mozilla/dom/HTMLMenuItemElementBinding.h"
     206             : #include "mozilla/dom/HTMLMetaElementBinding.h"
     207             : #include "mozilla/dom/HTMLOListElementBinding.h"
     208             : #include "mozilla/dom/HTMLObjectElementBinding.h"
     209             : #include "mozilla/dom/HTMLOptGroupElementBinding.h"
     210             : #include "mozilla/dom/HTMLOptionElementBinding.h"
     211             : #include "mozilla/dom/HTMLOptionsCollectionBinding.h"
     212             : #include "mozilla/dom/HTMLParagraphElementBinding.h"
     213             : #include "mozilla/dom/HTMLPreElementBinding.h"
     214             : #include "mozilla/dom/HTMLQuoteElementBinding.h"
     215             : #include "mozilla/dom/HTMLScriptElementBinding.h"
     216             : #include "mozilla/dom/HTMLSelectElementBinding.h"
     217             : #include "mozilla/dom/HTMLSourceElementBinding.h"
     218             : #include "mozilla/dom/HTMLStyleElementBinding.h"
     219             : #include "mozilla/dom/HTMLTableCellElementBinding.h"
     220             : #include "mozilla/dom/HTMLTextAreaElementBinding.h"
     221             : #include "mozilla/dom/HTMLUListElementBinding.h"
     222             : #include "mozilla/dom/KeyEventBinding.h"
     223             : #include "mozilla/dom/ListBoxObjectBinding.h"
     224             : #include "mozilla/dom/MediaListBinding.h"
     225             : #include "mozilla/dom/MessageEventBinding.h"
     226             : #include "mozilla/dom/MenuBoxObjectBinding.h"
     227             : #include "mozilla/dom/MouseEventBinding.h"
     228             : #include "mozilla/dom/MouseScrollEventBinding.h"
     229             : #include "mozilla/dom/MutationEventBinding.h"
     230             : #include "mozilla/dom/NamedNodeMapBinding.h"
     231             : #include "mozilla/dom/NodeIteratorBinding.h"
     232             : #include "mozilla/dom/NodeBinding.h"
     233             : #include "mozilla/dom/NotifyPaintEventBinding.h"
     234             : #include "mozilla/dom/EventBinding.h"
     235             : #include "mozilla/dom/OfflineResourceListBinding.h"
     236             : #include "mozilla/dom/PaintRequestBinding.h"
     237             : #include "mozilla/dom/PositionErrorBinding.h"
     238             : #include "mozilla/dom/ProcessingInstructionBinding.h"
     239             : #include "mozilla/dom/RangeBinding.h"
     240             : #include "mozilla/dom/RectBinding.h"
     241             : #include "mozilla/dom/ScreenBinding.h"
     242             : #include "mozilla/dom/ScrollBoxObjectBinding.h"
     243             : #include "mozilla/dom/SelectionBinding.h"
     244             : #include "mozilla/dom/ScrollAreaEventBinding.h"
     245             : #include "mozilla/dom/SimpleGestureEventBinding.h"
     246             : #include "mozilla/dom/StorageEventBinding.h"
     247             : #include "mozilla/dom/StyleSheetBinding.h"
     248             : #include "mozilla/dom/StyleSheetListBinding.h"
     249             : #include "mozilla/dom/SVGElementBinding.h"
     250             : #include "mozilla/dom/SVGLengthBinding.h"
     251             : #include "mozilla/dom/TextBinding.h"
     252             : #include "mozilla/dom/TimeEventBinding.h"
     253             : #include "mozilla/dom/TimeRangesBinding.h"
     254             : #include "mozilla/dom/TransitionEventBinding.h"
     255             : #include "mozilla/dom/TreeBoxObjectBinding.h"
     256             : #include "mozilla/dom/TreeWalkerBinding.h"
     257             : #include "mozilla/dom/UIEventBinding.h"
     258             : #include "mozilla/dom/ValidityStateBinding.h"
     259             : #include "mozilla/dom/WheelEventBinding.h"
     260             : #include "mozilla/dom/XMLDocumentBinding.h"
     261             : #include "mozilla/dom/XMLHttpRequestEventTargetBinding.h"
     262             : #include "mozilla/dom/XMLHttpRequestUploadBinding.h"
     263             : #include "mozilla/dom/XMLSerializerBinding.h"
     264             : #include "mozilla/dom/XPathEvaluatorBinding.h"
     265             : #include "mozilla/dom/XPathResultBinding.h"
     266             : #include "mozilla/dom/XULCommandEventBinding.h"
     267             : #include "mozilla/dom/XULDocumentBinding.h"
     268             : #include "mozilla/dom/XULElementBinding.h"
     269             : 
     270             : using namespace mozilla;
     271             : 
     272             : struct ComponentsInterfaceShimEntry {
     273             :   constexpr
     274             :   ComponentsInterfaceShimEntry(const char* aName, const nsIID& aIID,
     275             :                                const dom::NativePropertyHooks* aNativePropHooks)
     276             :     : geckoName(aName), iid(aIID), nativePropHooks(aNativePropHooks) {}
     277             : 
     278             :   const char *geckoName;
     279             :   const nsIID& iid;
     280             :   const dom::NativePropertyHooks* nativePropHooks;
     281             : };
     282             : 
     283             : #define DEFINE_SHIM_WITH_CUSTOM_INTERFACE(geckoName, domName) \
     284             :   { #geckoName, NS_GET_IID(geckoName), \
     285             :      mozilla::dom::domName ## Binding::sNativePropertyHooks }
     286             : #define DEFINE_SHIM(name) \
     287             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOM ## name, name)
     288             : 
     289             : /**
     290             :  * These shim entries allow us to make old XPIDL interfaces implementing DOM
     291             :  * APIs as non-scriptable in order to save some runtime memory on Firefox OS,
     292             :  * without breaking the entries under Components.interfaces which might both
     293             :  * be used by our code and add-ons.  Specifically, the shim entries provide
     294             :  * the following:
     295             :  *
     296             :  * * Components.interfaces.nsIFoo entries.  These entries basically work
     297             :  *   almost exactly as the usual ones that you would get through the
     298             :  *   XPIDL machinery.  Specifically, they have the right name, they reflect
     299             :  *   the right IID, and they will work properly when passed to QueryInterface.
     300             :  *
     301             :  * * Components.interfaces.nsIFoo.CONSTANT values.  These entries will have
     302             :  *   the right name and the right value for most integer types.  Note that
     303             :  *   support for non-numerical constants is untested and will probably not
     304             :  *   work out of the box.
     305             :  *
     306             :  * FAQ:
     307             :  * * When should I add an entry to the list here?
     308             :  *   Only if you're making an XPIDL interfaces which has a corresponding
     309             :  *   WebIDL interface non-scriptable.
     310             :  * * When should I remove an entry from this list?
     311             :  *   If you are completely removing an XPIDL interface from the code base.  If
     312             :  *   you forget to do so, the compiler will remind you.
     313             :  * * How should I add an entry to the list here?
     314             :  *   First, make sure that the XPIDL interface in question is non-scriptable
     315             :  *   and also has a corresponding WebIDL interface.  Then, add two include
     316             :  *   entries above, one for the XPIDL interface and one for the WebIDL
     317             :  *   interface, and add a shim entry below.  If the name of the XPIDL
     318             :  *   interface only has an "nsIDOM" prefix prepended to the WebIDL name, you
     319             :  *   can use the DEFINE_SHIM macro and pass in the name of the WebIDL
     320             :  *   interface.  Otherwise, use DEFINE_SHIM_WITH_CUSTOM_INTERFACE.
     321             :  */
     322             : 
     323             : const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
     324             : {
     325             :   DEFINE_SHIM(AnimationEvent),
     326             :   DEFINE_SHIM(Attr),
     327             :   DEFINE_SHIM(BeforeUnloadEvent),
     328             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIBrowserBoxObject, ContainerBoxObject),
     329             :   DEFINE_SHIM(CanvasRenderingContext2D),
     330             :   DEFINE_SHIM(CDATASection),
     331             :   DEFINE_SHIM(CharacterData),
     332             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRect, DOMRectReadOnly),
     333             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRectList, DOMRectList),
     334             :   DEFINE_SHIM(ClipboardEvent),
     335             :   DEFINE_SHIM(CommandEvent),
     336             :   DEFINE_SHIM(Comment),
     337             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIContainerBoxObject, ContainerBoxObject),
     338             :   DEFINE_SHIM(CSSPrimitiveValue),
     339             :   DEFINE_SHIM(CSSStyleDeclaration),
     340             :   DEFINE_SHIM(CSSStyleSheet),
     341             :   DEFINE_SHIM(CSSValue),
     342             :   DEFINE_SHIM(CSSValueList),
     343             :   DEFINE_SHIM(CustomEvent),
     344             : #ifdef MOZ_WEBRTC
     345             :   DEFINE_SHIM(DataChannel),
     346             : #endif
     347             :   DEFINE_SHIM(DataTransfer),
     348             :   DEFINE_SHIM(DOMCursor),
     349             :   DEFINE_SHIM(DOMException),
     350             :   DEFINE_SHIM(DOMRequest),
     351             :   DEFINE_SHIM(Document),
     352             :   DEFINE_SHIM(DocumentFragment),
     353             :   DEFINE_SHIM(DocumentType),
     354             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMDocumentXBL, Document),
     355             :   DEFINE_SHIM(DragEvent),
     356             :   DEFINE_SHIM(Element),
     357             :   DEFINE_SHIM(Event),
     358             :   DEFINE_SHIM(EventTarget),
     359             :   DEFINE_SHIM(FileList),
     360             :   DEFINE_SHIM(FocusEvent),
     361             :   DEFINE_SHIM(FormData),
     362             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMGeoPositionError, PositionError),
     363             :   DEFINE_SHIM(History),
     364             :   DEFINE_SHIM(HTMLAnchorElement),
     365             :   DEFINE_SHIM(HTMLAppletElement),
     366             :   DEFINE_SHIM(HTMLAreaElement),
     367             :   DEFINE_SHIM(HTMLBaseElement),
     368             :   DEFINE_SHIM(HTMLBodyElement),
     369             :   DEFINE_SHIM(HTMLButtonElement),
     370             :   DEFINE_SHIM(HTMLCanvasElement),
     371             :   DEFINE_SHIM(HTMLCollection),
     372             :   DEFINE_SHIM(HTMLDirectoryElement),
     373             :   DEFINE_SHIM(HTMLDocument),
     374             :   DEFINE_SHIM(HTMLElement),
     375             :   DEFINE_SHIM(HTMLEmbedElement),
     376             :   DEFINE_SHIM(HTMLFieldSetElement),
     377             :   DEFINE_SHIM(HTMLFormElement),
     378             :   DEFINE_SHIM(HTMLFrameElement),
     379             :   DEFINE_SHIM(HTMLFrameSetElement),
     380             :   DEFINE_SHIM(HTMLHRElement),
     381             :   DEFINE_SHIM(HTMLHeadElement),
     382             :   DEFINE_SHIM(HTMLHtmlElement),
     383             :   DEFINE_SHIM(HTMLIFrameElement),
     384             :   DEFINE_SHIM(HTMLImageElement),
     385             :   DEFINE_SHIM(HTMLInputElement),
     386             :   DEFINE_SHIM(HTMLLIElement),
     387             :   DEFINE_SHIM(HTMLLabelElement),
     388             :   DEFINE_SHIM(HTMLLinkElement),
     389             :   DEFINE_SHIM(HTMLMapElement),
     390             :   DEFINE_SHIM(HTMLMediaElement),
     391             :   DEFINE_SHIM(HTMLMenuElement),
     392             :   DEFINE_SHIM(HTMLMenuItemElement),
     393             :   DEFINE_SHIM(HTMLMetaElement),
     394             :   DEFINE_SHIM(HTMLOListElement),
     395             :   DEFINE_SHIM(HTMLObjectElement),
     396             :   DEFINE_SHIM(HTMLOptGroupElement),
     397             :   DEFINE_SHIM(HTMLOptionElement),
     398             :   DEFINE_SHIM(HTMLOptionsCollection),
     399             :   DEFINE_SHIM(HTMLParagraphElement),
     400             :   DEFINE_SHIM(HTMLPreElement),
     401             :   DEFINE_SHIM(HTMLQuoteElement),
     402             :   DEFINE_SHIM(HTMLScriptElement),
     403             :   DEFINE_SHIM(HTMLSelectElement),
     404             :   DEFINE_SHIM(HTMLSourceElement),
     405             :   DEFINE_SHIM(HTMLStyleElement),
     406             :   DEFINE_SHIM(HTMLTableCellElement),
     407             :   DEFINE_SHIM(HTMLTextAreaElement),
     408             :   DEFINE_SHIM(HTMLUListElement),
     409             :   DEFINE_SHIM(KeyEvent),
     410             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),
     411             :   DEFINE_SHIM(MediaList),
     412             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIMenuBoxObject, MenuBoxObject),
     413             :   DEFINE_SHIM(MouseEvent),
     414             :   DEFINE_SHIM(MouseScrollEvent),
     415             :   DEFINE_SHIM(MutationEvent),
     416             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMMozNamedAttrMap, NamedNodeMap),
     417             :   DEFINE_SHIM(NodeIterator),
     418             :   DEFINE_SHIM(Node),
     419             :   DEFINE_SHIM(NotifyPaintEvent),
     420             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMNSEvent, Event),
     421             :   DEFINE_SHIM(OfflineResourceList),
     422             :   DEFINE_SHIM(PaintRequest),
     423             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMParser, DOMParser),
     424             :   DEFINE_SHIM(ProcessingInstruction),
     425             :   DEFINE_SHIM(Range),
     426             :   DEFINE_SHIM(Rect),
     427             :   DEFINE_SHIM(Screen),
     428             :   DEFINE_SHIM(ScrollAreaEvent),
     429             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIScrollBoxObject, ScrollBoxObject),
     430             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMSerializer, XMLSerializer),
     431             :   DEFINE_SHIM(SimpleGestureEvent),
     432             :   DEFINE_SHIM(StyleSheet),
     433             :   DEFINE_SHIM(StyleSheetList),
     434             :   DEFINE_SHIM(SVGElement),
     435             :   DEFINE_SHIM(SVGLength),
     436             :   DEFINE_SHIM(Text),
     437             :   DEFINE_SHIM(TimeEvent),
     438             :   DEFINE_SHIM(TimeRanges),
     439             :   DEFINE_SHIM(TransitionEvent),
     440             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsITreeBoxObject, TreeBoxObject),
     441             :   DEFINE_SHIM(TreeWalker),
     442             :   DEFINE_SHIM(UIEvent),
     443             :   DEFINE_SHIM(ValidityState),
     444             :   DEFINE_SHIM(WheelEvent),
     445             :   DEFINE_SHIM(XMLDocument),
     446             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIXMLHttpRequestEventTarget, XMLHttpRequestEventTarget),
     447             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIXMLHttpRequestUpload, XMLHttpRequestUpload),
     448             :   DEFINE_SHIM(XPathEvaluator),
     449             :   DEFINE_SHIM(XPathResult),
     450             :   DEFINE_SHIM(XULCommandEvent),
     451             :   DEFINE_SHIM(XULDocument),
     452             :   DEFINE_SHIM(XULElement),
     453             :   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsISelection, Selection),
     454             : };
     455             : 
     456             : #undef DEFINE_SHIM
     457             : #undef DEFINE_SHIM_WITH_CUSTOM_INTERFACE
     458             : 
     459         288 : NS_IMPL_ISUPPORTS(ShimInterfaceInfo, nsISupports, nsIInterfaceInfo)
     460             : 
     461             : already_AddRefed<ShimInterfaceInfo>
     462         815 : ShimInterfaceInfo::MaybeConstruct(const char* aName, JSContext* cx)
     463             : {
     464        1630 :     RefPtr<ShimInterfaceInfo> info;
     465       97898 :     for (uint32_t i = 0; i < ArrayLength(kComponentsInterfaceShimMap); ++i) {
     466       97159 :         if (!strcmp(aName, kComponentsInterfaceShimMap[i].geckoName)) {
     467             :             const ComponentsInterfaceShimEntry& shimEntry =
     468          76 :                 kComponentsInterfaceShimMap[i];
     469             :             info = new ShimInterfaceInfo(shimEntry.iid,
     470          76 :                                          shimEntry.geckoName,
     471         152 :                                          shimEntry.nativePropHooks);
     472          76 :             break;
     473             :         }
     474             :     }
     475        1630 :     return info.forget();
     476             : }
     477             : 
     478          76 : ShimInterfaceInfo::ShimInterfaceInfo(const nsIID& aIID,
     479             :                                      const char* aName,
     480          76 :                                      const mozilla::dom::NativePropertyHooks* aNativePropHooks)
     481             :     : mIID(aIID)
     482             :     , mName(aName)
     483          76 :     , mNativePropHooks(aNativePropHooks)
     484             : {
     485          76 : }
     486             : 
     487             : NS_IMETHODIMP
     488           0 : ShimInterfaceInfo::GetName(char** aName)
     489             : {
     490           0 :     *aName = ToNewCString(mName);
     491           0 :     return NS_OK;
     492             : }
     493             : 
     494             : NS_IMETHODIMP
     495           0 : ShimInterfaceInfo::GetInterfaceIID(nsIID** aIID)
     496             : {
     497           0 :     *aIID = static_cast<nsIID*> (nsMemory::Clone(&mIID, sizeof(mIID)));
     498           0 :     return NS_OK;
     499             : }
     500             : 
     501             : NS_IMETHODIMP
     502          10 : ShimInterfaceInfo::IsScriptable(bool* aRetVal)
     503             : {
     504             :     // This class should pretend that the interface is scriptable because
     505             :     // that's what nsJSIID assumes.
     506          10 :     *aRetVal = true;
     507          10 :     return NS_OK;
     508             : }
     509             : 
     510             : NS_IMETHODIMP
     511           0 : ShimInterfaceInfo::IsBuiltinClass(bool* aRetVal)
     512             : {
     513           0 :     *aRetVal = true;
     514           0 :     return NS_OK;
     515             : }
     516             : 
     517             : NS_IMETHODIMP
     518           0 : ShimInterfaceInfo::IsMainProcessScriptableOnly(bool* aRetVal)
     519             : {
     520           0 :     *aRetVal = false;
     521           0 :     return NS_OK;
     522             : }
     523             : 
     524             : NS_IMETHODIMP
     525           0 : ShimInterfaceInfo::GetParent(nsIInterfaceInfo** aParent)
     526             : {
     527           0 :     *aParent = nullptr;
     528           0 :     return NS_OK;
     529             : }
     530             : 
     531             : NS_IMETHODIMP
     532           0 : ShimInterfaceInfo::GetMethodCount(uint16_t* aCount)
     533             : {
     534             :     // Pretend we don't have any methods.
     535           0 :     *aCount = 0;
     536           0 :     return NS_OK;
     537             : }
     538             : 
     539             : NS_IMETHODIMP
     540           0 : ShimInterfaceInfo::GetConstantCount(uint16_t* aCount)
     541             : {
     542             :     // We assume that we never have interfaces with more than UINT16_MAX
     543             :     // constants defined on them.
     544           0 :     uint16_t count = 0;
     545             : 
     546             :     // NOTE: The structure of this loop must be kept in sync with the loop
     547             :     // in GetConstant.
     548           0 :     const mozilla::dom::NativePropertyHooks* propHooks = mNativePropHooks;
     549           0 :     do {
     550             :         const mozilla::dom::NativeProperties* props[] = {
     551           0 :             propHooks->mNativeProperties.regular,
     552           0 :             propHooks->mNativeProperties.chromeOnly
     553           0 :         };
     554           0 :         for (size_t i = 0; i < ArrayLength(props); ++i) {
     555           0 :             auto prop = props[i];
     556           0 :             if (prop && prop->HasConstants()) {
     557           0 :                 for (auto cs = prop->Constants()->specs; cs->name; ++cs) {
     558             :                     // We have found one constant here.  We explicitly do not
     559             :                     // bother calling isEnabled() here because it's OK to define
     560             :                     // potentially extra constants on these shim interfaces.
     561           0 :                     ++count;
     562             :                 }
     563             :             }
     564             :         }
     565           0 :     } while ((propHooks = propHooks->mProtoHooks));
     566           0 :     *aCount = count;
     567           0 :     return NS_OK;
     568             : }
     569             : 
     570             : NS_IMETHODIMP
     571           0 : ShimInterfaceInfo::GetMethodInfo(uint16_t aIndex, const nsXPTMethodInfo** aInfo)
     572             : {
     573           0 :     MOZ_ASSERT(false, "This should never be called");
     574             :     return NS_ERROR_NOT_IMPLEMENTED;
     575             : }
     576             : 
     577             : NS_IMETHODIMP
     578           0 : ShimInterfaceInfo::GetMethodInfoForName(const char* aName, uint16_t* aIndex, const nsXPTMethodInfo** aInfo)
     579             : {
     580           0 :     MOZ_ASSERT(false, "This should never be called");
     581             :     return NS_ERROR_NOT_IMPLEMENTED;
     582             : }
     583             : 
     584             : NS_IMETHODIMP
     585           0 : ShimInterfaceInfo::GetConstant(uint16_t aIndex, JS::MutableHandleValue aConstant,
     586             :                                char** aName)
     587             : {
     588             :     // We assume that we never have interfaces with more than UINT16_MAX
     589             :     // constants defined on them.
     590           0 :     uint16_t index = 0;
     591             : 
     592             :     // NOTE: The structure of this loop must be kept in sync with the loop
     593             :     // in GetConstantCount.
     594           0 :     const mozilla::dom::NativePropertyHooks* propHooks = mNativePropHooks;
     595           0 :     do {
     596             :         const mozilla::dom::NativeProperties* props[] = {
     597           0 :             propHooks->mNativeProperties.regular,
     598           0 :             propHooks->mNativeProperties.chromeOnly
     599           0 :         };
     600           0 :         for (size_t i = 0; i < ArrayLength(props); ++i) {
     601           0 :             auto prop = props[i];
     602           0 :             if (prop && prop->HasConstants()) {
     603           0 :                 for (auto cs = prop->Constants()->specs; cs->name; ++cs) {
     604             :                     // We have found one constant here.  We explicitly do not
     605             :                     // bother calling isEnabled() here because it's OK to define
     606             :                     // potentially extra constants on these shim interfaces.
     607           0 :                     if (index == aIndex) {
     608           0 :                         aConstant.set(cs->value);
     609           0 :                         *aName = ToNewCString(nsDependentCString(cs->name));
     610           0 :                         return NS_OK;
     611             :                     }
     612           0 :                     ++index;
     613             :                 }
     614             :             }
     615             :         }
     616           0 :     } while ((propHooks = propHooks->mProtoHooks));
     617             : 
     618             :     // aIndex was bigger than the number of constants we have.
     619           0 :     return NS_ERROR_INVALID_ARG;
     620             : }
     621             : 
     622             : NS_IMETHODIMP
     623           0 : ShimInterfaceInfo::GetInfoForParam(uint16_t aIndex, const nsXPTParamInfo* aParam, nsIInterfaceInfo** aRetVal)
     624             : {
     625           0 :     MOZ_ASSERT(false, "This should never be called");
     626             :     return NS_ERROR_NOT_IMPLEMENTED;
     627             : }
     628             : 
     629             : NS_IMETHODIMP
     630           0 : ShimInterfaceInfo::GetIIDForParam(uint16_t aIndex, const nsXPTParamInfo* aParam, nsIID** aRetVal)
     631             : {
     632           0 :     MOZ_ASSERT(false, "This should never be called");
     633             :     return NS_ERROR_NOT_IMPLEMENTED;
     634             : }
     635             : 
     636             : NS_IMETHODIMP
     637           0 : ShimInterfaceInfo::GetTypeForParam(uint16_t aInex, const nsXPTParamInfo* aParam, uint16_t aDimension, nsXPTType* aRetVal)
     638             : {
     639           0 :     MOZ_ASSERT(false, "This should never be called");
     640             :     return NS_ERROR_NOT_IMPLEMENTED;
     641             : }
     642             : 
     643             : NS_IMETHODIMP
     644           0 : ShimInterfaceInfo::GetSizeIsArgNumberForParam(uint16_t aInex, const nsXPTParamInfo* aParam, uint16_t aDimension, uint8_t* aRetVal)
     645             : {
     646           0 :     MOZ_ASSERT(false, "This should never be called");
     647             :     return NS_ERROR_NOT_IMPLEMENTED;
     648             : }
     649             : 
     650             : NS_IMETHODIMP
     651           0 : ShimInterfaceInfo::GetInterfaceIsArgNumberForParam(uint16_t aInex, const nsXPTParamInfo* aParam, uint8_t* aRetVal)
     652             : {
     653           0 :     MOZ_ASSERT(false, "This should never be called");
     654             :     return NS_ERROR_NOT_IMPLEMENTED;
     655             : }
     656             : 
     657             : NS_IMETHODIMP
     658           0 : ShimInterfaceInfo::IsIID(const nsIID* aIID, bool* aRetVal)
     659             : {
     660           0 :     *aRetVal = mIID.Equals(*aIID);
     661           0 :     return NS_OK;
     662             : }
     663             : 
     664             : NS_IMETHODIMP
     665           0 : ShimInterfaceInfo::GetNameShared(const char** aName)
     666             : {
     667           0 :     *aName = mName.get();
     668           0 :     return NS_OK;
     669             : }
     670             : 
     671             : NS_IMETHODIMP
     672          70 : ShimInterfaceInfo::GetIIDShared(const nsIID** aIID)
     673             : {
     674          70 :     *aIID = &mIID;
     675          70 :     return NS_OK;
     676             : }
     677             : 
     678             : NS_IMETHODIMP
     679           0 : ShimInterfaceInfo::IsFunction(bool* aRetVal)
     680             : {
     681           0 :     *aRetVal = false;
     682           0 :     return NS_OK;
     683             : }
     684             : 
     685             : NS_IMETHODIMP
     686           0 : ShimInterfaceInfo::HasAncestor(const nsIID* aIID, bool* aRetVal)
     687             : {
     688           0 :     *aRetVal = false;
     689           0 :     return NS_OK;
     690             : }
     691             : 
     692             : NS_IMETHODIMP_(nsresult)
     693           0 : ShimInterfaceInfo::GetIIDForParamNoAlloc(uint16_t aIndex, const nsXPTParamInfo* aInfo, nsIID* aIID)
     694             : {
     695           0 :     MOZ_ASSERT(false, "This should never be called");
     696             :     return NS_ERROR_NOT_IMPLEMENTED;
     697             : }

Generated by: LCOV version 1.13