Bug 816387 part 2. Hook up the Document WebIDL API to quickstubs. r=peterv

This commit is contained in:
Boris Zbarsky 2012-12-23 14:34:22 -08:00
parent b3efacb80d
commit df1030e8d7
6 changed files with 15 additions and 122 deletions

View File

@ -75,20 +75,6 @@
"XMLDocument interface: existence and properties of interface prototype object": true,
"XMLDocument interface: existence and properties of interface prototype object's \"constructor\" property": true,
"Stringification of xmlDoc": "debug",
"Document interface: calling getElementsByTagName(DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling getElementsByTagNameNS(DOMString,DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling getElementsByClassName(DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling getElementById(DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling createElement(DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling createElementNS(DOMString,DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling createTextNode(DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling createComment(DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling createProcessingInstruction(DOMString,DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling importNode(Node,boolean) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling adoptNode(Node) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling createEvent(DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling createNodeIterator(Node,unsigned long,NodeFilter) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling createTreeWalker(Node,unsigned long,NodeFilter) on xmlDoc with too few arguments must throw TypeError": true,
"EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on xmlDoc with too few arguments must throw TypeError": true,
"EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on xmlDoc with too few arguments must throw TypeError": true,
"EventTarget interface: calling dispatchEvent(Event) on xmlDoc with too few arguments must throw TypeError": true,

View File

@ -53,7 +53,7 @@ interface nsIDOMDocument : nsIDOMNode
raises(DOMException);
// Introduced in DOM Level 2:
nsIDOMElement createElementNS(in DOMString namespaceURI,
in DOMString qualifiedName)
[Null(Stringify)] in DOMString qualifiedName)
raises(DOMException);
// Introduced in DOM Level 2:
nsIDOMAttr createAttributeNS(in DOMString namespaceURI,

View File

@ -30,10 +30,10 @@ var allNSTests =
[
{ args: [undefined, undefined] },
{ args: [null, undefined] },
{ args: [undefined, null], code: 5 },
{ args: [null, null], code: 5 },
{ args: [undefined, null] },
{ args: [null, null] },
{ args: [null, ""], code: 5 },
{ args: ["", null], code: 5 },
{ args: ["", null] },
{ args: ["", ""], code: 5 },
{ args: [null, "<div>"], code: 5 },
{ args: [null, "0div"], code: 5 },

View File

@ -411,6 +411,8 @@ partial interface Document {
// nsIDOMDocumentTouch
// XXXbz I can't find the sane spec for this stuff, so just cribbing
// from our xpidl for now.
// XXXbz commented out for now because quickstubs can't do pref-ability
/*
[SetterThrows, Pref="dom.w3c_touch_events.expose"]
attribute EventHandler ontouchstart;
[SetterThrows, Pref="dom.w3c_touch_events.expose"]
@ -445,6 +447,7 @@ partial interface Document {
TouchList createTouchList(Touch touch);
[Creator, Pref="dom.w3c_touch_events.expose"]
TouchList createTouchList(sequence<Touch> touches);
*/
};
Document implements XPathEvaluator;

View File

@ -65,36 +65,6 @@ members = [
# dom/interfaces/core
'nsIDOMCharacterData.data',
'nsIDOMCharacterData.length',
'nsIDOMDocument.documentElement',
'nsIDOMDocument.implementation',
'nsIDOMDocument.getElementsByTagName',
'nsIDOMDocument.doctype',
'nsIDOMDocument.getElementsByTagNameNS',
'nsIDOMDocument.getElementById',
'nsIDOMDocument.createDocumentFragment',
'nsIDOMDocument.createElement',
'nsIDOMDocument.createElementNS',
'nsIDOMDocument.importNode',
'nsIDOMDocument.createTextNode',
'nsIDOMDocument.documentURI',
'nsIDOMDocument.adoptNode',
'nsIDOMDocument.defaultView',
'nsIDOMDocument.createNodeIterator',
'nsIDOMDocument.createEvent',
'nsIDOMDocument.getElementsByClassName',
'nsIDOMDocument.title',
'nsIDOMDocument.referrer',
'nsIDOMDocument.hasFocus',
# This property is treated specially in nsDOMClassInfo in a way that
# would shadow any quick stub. Also, document.location is a special
# case for security.
#'nsIDOMDocument.location',
'nsIDOMDocument.elementFromPoint',
'nsIDOMDocument.activeElement',
'nsIDOMDocument.onreadystatechange',
'nsIDOMDocument.onmouseenter',
'nsIDOMDocument.onmouseleave',
'nsIDOMDocument.URL',
'nsIDOMNamedNodeMap.item',
'nsIDOMNamedNodeMap.length',
'nsIDOMNodeSelector.querySelector',
@ -315,9 +285,6 @@ members = [
# dom/interfaces/xbl - None.
# dom/interfaces/xpath
'nsIDOMXPathEvaluator.evaluate',
'nsIDOMXPathEvaluator.createExpression',
'nsIDOMXPathEvaluator.createNSResolver',
'nsIDOMXPathExpression.evaluate',
'nsIDOMXPathNSResolver.lookupNamespaceURI',
'nsIDOMXPathResult.snapshotItem',
@ -419,7 +386,8 @@ customIncludes = [
'nsICSSDeclaration.h',
'mozilla/dom/NodeBinding.h',
'mozilla/dom/ElementBinding.h',
'mozilla/dom/HTMLElementBinding.h'
'mozilla/dom/HTMLElementBinding.h',
'mozilla/dom/DocumentBinding.h'
]
customReturnInterfaces = [
@ -506,73 +474,6 @@ customMethodCalls = {
'code': ' nsICSSDeclaration* result = '
'self->GetStyle(&rv);'
},
'nsIDOMDocument_': {
'thisType': 'nsDocument'
},
'nsIDOMDocument_GetElementById': {
'thisType': 'nsDocument',
'code': ' mozilla::dom::Element *result = self->GetElementById(arg0);',
'canFail': False
},
'nsIDOMDocument_GetElementsByTagName': {
'thisType': 'nsDocument',
'code': ' nsRefPtr<nsContentList> result ='
'self->GetElementsByTagName(arg0);',
'canFail': False
},
'nsIDOMDocument_GetElementsByTagNameNS': {
'thisType': 'nsDocument',
'code': ' nsRefPtr<nsContentList> result ='
'self->nsIDocument::GetElementsByTagNameNS(arg0, arg1);',
'canFail': False
},
'nsIDOMDocument_CreateElement': {
'thisType': 'nsDocument',
'code': ' mozilla::ErrorResult error;\n'
' nsCOMPtr<mozilla::dom::Element> result = self->nsIDocument::CreateElement(arg0, error);\n'
' rv = error.ErrorCode();'
},
'nsIDOMDocument_CreateElementNS': {
'thisType': 'nsDocument',
'code': ' mozilla::ErrorResult error;\n'
' nsCOMPtr<mozilla::dom::Element> result = self->nsIDocument::CreateElementNS(arg0, arg1, error);\n'
' rv = error.ErrorCode();'
},
'nsIDOMDocument_CreateTextNode': {
'thisType': 'nsDocument',
'code': ' nsCOMPtr<nsIContent> result;\n'
' rv = self->CreateTextNode(arg0, getter_AddRefs(result));'
},
'nsIDOMDocument_GetOnreadystatechange' : {
'thisType' : 'nsDocument',
'unwrapThisFailureFatal' : False
},
'nsIDOMDocument_SetOnreadystatechange' : {
'thisType' : 'nsDocument',
'unwrapThisFailureFatal' : False
},
'nsIDOMDocument_GetOnmouseenter' : {
'thisType' : 'nsDocument',
'unwrapThisFailureFatal' : False
},
'nsIDOMDocument_SetOnmouseenter' : {
'thisType' : 'nsDocument',
'unwrapThisFailureFatal' : False
},
'nsIDOMDocument_GetOnmouseleave' : {
'thisType' : 'nsDocument',
'unwrapThisFailureFatal' : False
},
'nsIDOMDocument_SetOnmouseleave' : {
'thisType' : 'nsDocument',
'unwrapThisFailureFatal' : False
},
'nsIDOMDocument_GetTitle' : {
'thisType' : 'nsDocument',
'code': ' nsString result;\n'
' self->GetTitle(result);',
'canFail': False
},
'nsIDOMWindow_GetOnmouseenter' : {
'thisType' : 'nsIDOMWindow',
'unwrapThisFailureFatal' : False
@ -594,5 +495,6 @@ customMethodCalls = {
newBindingProperties = {
'nsIDOMNode': 'mozilla::dom::NodeBinding::sNativePropertyHooks.mNativeProperties.regular',
'nsIDOMElement': 'mozilla::dom::ElementBinding::sNativePropertyHooks.mNativeProperties.regular',
'nsIDOMHTMLElement': 'mozilla::dom::HTMLElementBinding::sNativePropertyHooks.mNativeProperties.regular'
'nsIDOMHTMLElement': 'mozilla::dom::HTMLElementBinding::sNativePropertyHooks.mNativeProperties.regular',
'nsIDOMDocument': 'mozilla::dom::DocumentBinding::sNativePropertyHooks.mNativeProperties.regular'
}

View File

@ -26,8 +26,10 @@ function go() {
document.createTreeWalker(ifr.contentDocument, 0, null, false);
ok(false, "should have thrown a security exception");
} catch (e) {
ok(/NS_ERROR_XPC_SECURITY_MANAGER_VETO/.test(e),
"threw a security exception instead of an invalid child exception");
ok(/NS_ERROR_XPC_SECURITY_MANAGER_VETO/.test(e) ||
/TypeError: Value does not implement interface Node/.test(e),
"threw a security exception or binding exception instead of an " +
"invalid child exception");
}
SimpleTest.finish();