Bug 826703 part 4. Convert ProcessingInstruction to WebIDL. r=peterv

This commit is contained in:
Boris Zbarsky 2013-01-08 15:45:06 -05:00
parent df66ecbe66
commit e7357142bb
6 changed files with 22 additions and 16 deletions

View File

@ -6,6 +6,7 @@
#include "nsGkAtoms.h"
#include "nsUnicharUtils.h"
#include "mozilla/dom/ProcessingInstruction.h"
#include "mozilla/dom/ProcessingInstructionBinding.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
@ -63,6 +64,8 @@ ProcessingInstruction::ProcessingInstruction(already_AddRefed<nsINodeInfo> aNode
SetTextInternal(0, mText.GetLength(),
aData.BeginReading(), aData.Length(),
false); // Don't notify (bug 420429).
SetIsDOMBinding();
}
ProcessingInstruction::~ProcessingInstruction()
@ -85,6 +88,11 @@ NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
NS_IMPL_ADDREF_INHERITED(ProcessingInstruction, nsGenericDOMDataNode)
NS_IMPL_RELEASE_INHERITED(ProcessingInstruction, nsGenericDOMDataNode)
JSObject*
ProcessingInstruction::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return ProcessingInstructionBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
NS_IMETHODIMP
ProcessingInstruction::GetTarget(nsAString& aTarget)

View File

@ -47,6 +47,12 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL API
void GetTarget(nsString& aTarget)
{
aTarget = NodeName();
}
protected:
/**
* This will parse the content of the PI, to extract the value of the pseudo
@ -59,6 +65,9 @@ protected:
* aAttribute. Empty if the attribute isn't present.
*/
bool GetAttrValue(nsIAtom *aName, nsAString& aValue);
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;
};
} // namespace dom

View File

@ -148,7 +148,6 @@ DOMInterfaces = {
'CharacterData': {
'nativeType': 'nsGenericDOMDataNode',
'hasXPConnectImpls': True,
'hasInstanceInterface': 'nsIDOMCharacterData',
'concrete': False
},
@ -566,6 +565,10 @@ DOMInterfaces = {
'headerFile': 'nsPerformance.h'
},
'ProcessingInstruction': {
'hasInstanceInterface': 'nsIDOMProcessingInstruction',
},
'PropertyNodeList': {
'headerFile': 'HTMLPropertiesCollection.h',
'resultNotAddRefed': [ 'item' ]
@ -1186,7 +1189,6 @@ addExternalIface('OutputStream', nativeType='nsIOutputStream',
notflattened=True)
addExternalIface('Principal', nativeType='nsIPrincipal',
headerFile='nsIPrincipal.h', notflattened=True)
addExternalIface('ProcessingInstruction', nativeType='mozilla::dom::ProcessingInstruction')
addExternalIface('Range', nativeType='nsRange')
addExternalIface('Selection', nativeType='nsISelection')
addExternalIface('StyleSheetList')

View File

@ -93,20 +93,7 @@
"Stringification of document.querySelector(\"[id]\").attributes[0]": "debug",
"CharacterData interface: operation remove()": true,
"CharacterData interface: document.createTextNode(\"abc\") must inherit property \"remove\" with the proper type (7)": true,
"ProcessingInstruction interface: existence and properties of interface object": true,
"ProcessingInstruction interface: existence and properties of interface prototype object": true,
"ProcessingInstruction interface: existence and properties of interface prototype object's \"constructor\" property": true,
"ProcessingInstruction interface: attribute target": true,
"Stringification of xmlDoc.createProcessingInstruction(\"abc\", \"def\")": "debug",
"CharacterData interface: calling substringData(unsigned long,unsigned long) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"CharacterData interface: calling appendData(DOMString) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"CharacterData interface: calling insertData(unsigned long,DOMString) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"CharacterData interface: calling deleteData(unsigned long,unsigned long) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"CharacterData interface: calling replaceData(unsigned long,unsigned long,DOMString) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"remove\" with the proper type (7)": true,
"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,
"CharacterData interface: document.createComment(\"abc\") must inherit property \"remove\" with the proper type (7)": true,
"Range interface: existence and properties of interface object": true,
"Range interface: existence and properties of interface prototype object": true,

View File

@ -18,7 +18,6 @@
interface Attr;
interface Comment;
interface NodeIterator;
interface ProcessingInstruction;
interface Range;
interface StyleSheetList;
interface Touch;

View File

@ -94,6 +94,7 @@ webidl_files = \
Performance.webidl \
PerformanceNavigation.webidl \
PerformanceTiming.webidl \
ProcessingInstruction.webidl \
Rect.webidl \
RGBColor.webidl \
Screen.webidl \