Bug 824823 part 9. Convert Comment to WebIDL. r=peterv

This commit is contained in:
Boris Zbarsky 2013-01-04 12:02:14 -05:00
parent f1feb59fc3
commit 5b99ae3585
6 changed files with 29 additions and 23 deletions

View File

@ -9,7 +9,8 @@
#include "nsCOMPtr.h"
#include "mozilla/dom/Element.h" // DOMCI_NODE_DATA
#include "Comment.h"
#include "mozilla/dom/Comment.h"
#include "mozilla/dom/CommentBinding.h"
using namespace mozilla;
using namespace dom;
@ -41,13 +42,6 @@ NS_NewCommentNode(nsIContent** aInstancePtrResult,
namespace mozilla {
namespace dom {
Comment::Comment(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
"Bad NodeType in aNodeInfo");
}
Comment::~Comment()
{
}
@ -99,5 +93,11 @@ Comment::List(FILE* out, int32_t aIndent) const
}
#endif
JSObject*
Comment::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return CommentBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla

View File

@ -3,6 +3,9 @@
* 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/. */
#ifndef mozilla_dom_Comment_h
#define mozilla_dom_Comment_h
#include "nsIDOMComment.h"
#include "nsGenericDOMDataNode.h"
@ -13,7 +16,13 @@ class Comment : public nsGenericDOMDataNode,
public nsIDOMComment
{
public:
Comment(already_AddRefed<nsINodeInfo> aNodeInfo);
Comment(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
"Bad NodeType in aNodeInfo");
SetIsDOMBinding();
}
virtual ~Comment();
// nsISupports
@ -45,8 +54,13 @@ public:
return;
}
#endif
protected:
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_Comment_h

View File

@ -155,6 +155,10 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'item' ]
},
'Comment': {
'hasInstanceInterface': 'nsIDOMComment',
},
'CSS': {
'concrete': False,
},
@ -1072,7 +1076,6 @@ addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h'
addExternalIface('CanvasPattern', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('CDATASection')
addExternalIface('ClientRect')
addExternalIface('Comment', nativeType='mozilla::dom::Comment')
addExternalIface("Counter")
addExternalIface('CSSRule')
addExternalIface('DOMRequest')

View File

@ -107,19 +107,7 @@
"EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"EventTarget interface: calling dispatchEvent(Event) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"Comment interface: existence and properties of interface object": true,
"Comment interface: existence and properties of interface prototype object": true,
"Comment interface: existence and properties of interface prototype object's \"constructor\" property": true,
"Stringification of document.createComment(\"abc\")": "debug",
"CharacterData interface: calling substringData(unsigned long,unsigned long) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: calling appendData(DOMString) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: calling insertData(unsigned long,DOMString) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: calling deleteData(unsigned long,unsigned long) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: calling replaceData(unsigned long,unsigned long,DOMString) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: document.createComment(\"abc\") must inherit property \"remove\" with the proper type (7)": true,
"EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"EventTarget interface: calling dispatchEvent(Event) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"Range interface: existence and properties of interface object": true,
"Range interface: existence and properties of interface prototype object": true,
"Range interface: existence and properties of interface prototype object's \"constructor\" property": true,

View File

@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.w3.org/TR/2012/WD-dom-20120105/
* http://dom.spec.whatwg.org/#comment
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.

View File

@ -23,6 +23,7 @@ webidl_files = \
CaretPosition.webidl \
CharacterData.webidl \
ClientRectList.webidl \
Comment.webidl \
CSS.webidl \
CSSPrimitiveValue.webidl \
CSSStyleDeclaration.webidl \