mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:54:05 +00:00
mshtml: Return proper error for invalid selectors in IE8 mode.
More importantly it gets rid of the ERR since such failures are normal. Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
parent
be8bd0e6b0
commit
b99c89f383
|
@ -4742,8 +4742,8 @@ static HRESULT WINAPI DocumentSelector_querySelector(IDocumentSelector *iface, B
|
|||
nsres = nsIDOMDocument_QuerySelector(This->dom_document, &nsstr, &nselem);
|
||||
nsAString_Finish(&nsstr);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("QuerySelector failed: %08lx\n", nsres);
|
||||
return E_FAIL;
|
||||
WARN("QuerySelector failed: %08lx\n", nsres);
|
||||
return map_nsresult(nsres);
|
||||
}
|
||||
|
||||
if(!nselem) {
|
||||
|
@ -4765,16 +4765,17 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface
|
|||
HTMLDocumentNode *This = impl_from_IDocumentSelector(iface);
|
||||
nsIDOMNodeList *node_list;
|
||||
nsAString nsstr;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
|
||||
|
||||
nsAString_InitDepend(&nsstr, v);
|
||||
hres = map_nsresult(nsIDOMDocument_QuerySelectorAll(This->dom_document, &nsstr, &node_list));
|
||||
nsres = nsIDOMDocument_QuerySelectorAll(This->dom_document, &nsstr, &node_list);
|
||||
nsAString_Finish(&nsstr);
|
||||
if(FAILED(hres)) {
|
||||
ERR("QuerySelectorAll failed: %08lx\n", hres);
|
||||
return hres;
|
||||
if(NS_FAILED(nsres)) {
|
||||
WARN("QuerySelectorAll failed: %08lx\n", nsres);
|
||||
return map_nsresult(nsres);
|
||||
}
|
||||
|
||||
hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel);
|
||||
|
|
|
@ -6344,8 +6344,8 @@ static HRESULT WINAPI ElementSelector_querySelector(IElementSelector *iface, BST
|
|||
nsres = nsIDOMElement_QuerySelector(This->dom_element, &nsstr, &nselem);
|
||||
nsAString_Finish(&nsstr);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("QuerySelector failed: %08lx\n", nsres);
|
||||
return E_FAIL;
|
||||
WARN("QuerySelector failed: %08lx\n", nsres);
|
||||
return map_nsresult(nsres);
|
||||
}
|
||||
|
||||
if(!nselem) {
|
||||
|
@ -6367,6 +6367,7 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface,
|
|||
HTMLElement *This = impl_from_IElementSelector(iface);
|
||||
nsIDOMNodeList *node_list;
|
||||
nsAString nsstr;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
|
||||
|
@ -6377,11 +6378,11 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface,
|
|||
}
|
||||
|
||||
nsAString_InitDepend(&nsstr, v);
|
||||
hres = map_nsresult(nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list));
|
||||
nsres = nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list);
|
||||
nsAString_Finish(&nsstr);
|
||||
if(FAILED(hres)) {
|
||||
ERR("QuerySelectorAll failed: %08lx\n", hres);
|
||||
return hres;
|
||||
if(NS_FAILED(nsres)) {
|
||||
WARN("QuerySelectorAll failed: %08lx\n", nsres);
|
||||
return map_nsresult(nsres);
|
||||
}
|
||||
|
||||
hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel);
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
|
||||
#define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
|
||||
#define NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ((nsresult)0x80530007)
|
||||
#define NS_ERROR_DOM_SYNTAX_ERR ((nsresult)0x8053000c)
|
||||
|
||||
#define NS_ERROR_MODULE_NETWORK 6
|
||||
|
||||
|
|
|
@ -911,6 +911,8 @@ HRESULT map_nsresult(nsresult nsres)
|
|||
return E_UNEXPECTED;
|
||||
case NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR:
|
||||
return 0x80700007; /* according to tests */
|
||||
case NS_ERROR_DOM_SYNTAX_ERR:
|
||||
return E_INVALIDARG; /* FIXME: Throw SyntaxError for IE9+ modes */
|
||||
case NS_BINDING_ABORTED:
|
||||
return E_ABORT;
|
||||
}
|
||||
|
|
|
@ -2200,6 +2200,64 @@ sync_test("nullDisp", function() {
|
|||
}
|
||||
});
|
||||
|
||||
sync_test("invalid selectors", function() {
|
||||
var v = document.documentMode, body = document.body, i;
|
||||
if(v < 8)
|
||||
return;
|
||||
|
||||
var selectors = [
|
||||
"[s!='']",
|
||||
"*,:x",
|
||||
"*,##",
|
||||
":x",
|
||||
"##",
|
||||
"*,",
|
||||
","
|
||||
];
|
||||
|
||||
for(i = 0; i < selectors.length; i++) {
|
||||
try {
|
||||
body.querySelector(selectors[i]);
|
||||
ok(false, "body.querySelector(\"" + selectors[i] + "\" did not throw exception");
|
||||
}catch(e) {
|
||||
if(v < 9)
|
||||
ok(e.number === 0x70057 - 0x80000000, "body.querySelector(\"" + selectors[i] + "\" threw " + e.number);
|
||||
else {
|
||||
todo_wine.
|
||||
ok(e.name === (v < 10 ? undefined : "SyntaxError"), "body.querySelector(\"" + selectors[i] + "\" threw " + e.name);
|
||||
}
|
||||
}
|
||||
try {
|
||||
body.querySelectorAll(selectors[i]);
|
||||
ok(false, "body.querySelectorAll(\"" + selectors[i] + "\" did not throw exception");
|
||||
}catch(e) {
|
||||
if(v < 9)
|
||||
ok(e.number === 0x70057 - 0x80000000, "body.querySelectorAll(\"" + selectors[i] + "\" threw " + e.number);
|
||||
else {
|
||||
todo_wine.
|
||||
ok(e.name === (v < 10 ? undefined : "SyntaxError"), "body.querySelectorAll(\"" + selectors[i] + "\" threw " + e.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!body.msMatchesSelector)
|
||||
return;
|
||||
|
||||
for(i = 0; i < selectors.length; i++) {
|
||||
try {
|
||||
body.msMatchesSelector(selectors[i]);
|
||||
ok(false, "body.msMatchesSelector(\"" + selectors[i] + "\" did not throw exception");
|
||||
}catch(e) {
|
||||
if(v < 9)
|
||||
ok(e.number === 0x70057 - 0x80000000, "body.msMatchesSelector(\"" + selectors[i] + "\" threw " + e.number);
|
||||
else {
|
||||
todo_wine.
|
||||
ok(e.name === (v < 10 ? undefined : "SyntaxError"), "body.msMatchesSelector(\"" + selectors[i] + "\" threw " + e.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sync_test("__proto__", function() {
|
||||
var v = document.documentMode;
|
||||
var r, x = 42;
|
||||
|
|
Loading…
Reference in a new issue