зеркало из https://github.com/mozilla/gecko-dev.git
Bug 766798. Throw SYNTAX_ERR, not NAMESPACE_ERR, from querySelector(All) on unknown namespaces. r=dbaron
This commit is contained in:
Родитель
e440dca789
Коммит
4214241dca
|
@ -494,7 +494,6 @@
|
|||
return root[select](q, resolver);
|
||||
} catch(e){
|
||||
if ( e.message.indexOf("ERR") > -1 ||
|
||||
(e.name == "NamespaceError" && e.code == DOMException.NAMESPACE_ERR) ||
|
||||
(e.name == "SyntaxError" && e.code == DOMException.SYNTAX_ERR) )
|
||||
throw e;
|
||||
}
|
||||
|
@ -549,7 +548,7 @@
|
|||
results = query(q, resolver);
|
||||
} catch(e) {
|
||||
pass = (e.message === "bad ERROR" ||
|
||||
(e.name == "NamespaceError" && e.code == DOMException.NAMESPACE_ERR));
|
||||
(e.name == "SyntaxError" && e.code == DOMException.SYNTAX_ERR));
|
||||
}
|
||||
|
||||
assert( pass, type + ": " + name + " Bad Resolver #" + (i+1) + " (" + nq + ")" +
|
||||
|
|
|
@ -592,7 +592,7 @@ protected:
|
|||
|
||||
/* Find and return the namespace ID associated with aPrefix.
|
||||
If aPrefix has not been declared in an @namespace rule, returns
|
||||
kNameSpaceID_Unknown and sets mFoundUnresolvablePrefix to true. */
|
||||
kNameSpaceID_Unknown. */
|
||||
PRInt32 GetNamespaceIdForPrefix(const nsString& aPrefix);
|
||||
|
||||
/* Find the correct default namespace, and set it on aSelector. */
|
||||
|
@ -652,10 +652,6 @@ protected:
|
|||
// some quirks during shorthand parsing
|
||||
bool mParsingCompoundProperty : 1;
|
||||
|
||||
// GetNamespaceIdForPrefix will set mFoundUnresolvablePrefix to true
|
||||
// when it encounters a prefix that is not mapped to a namespace.
|
||||
bool mFoundUnresolvablePrefix : 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool mScannerInited : 1;
|
||||
#endif
|
||||
|
@ -740,8 +736,7 @@ CSSParserImpl::CSSParserImpl()
|
|||
mNavQuirkMode(false),
|
||||
mUnsafeRulesEnabled(false),
|
||||
mHTMLMediaMode(false),
|
||||
mParsingCompoundProperty(false),
|
||||
mFoundUnresolvablePrefix(false)
|
||||
mParsingCompoundProperty(false)
|
||||
#ifdef DEBUG
|
||||
, mScannerInited(false)
|
||||
#endif
|
||||
|
@ -1193,12 +1188,7 @@ CSSParserImpl::ParseSelectorString(const nsSubstring& aSelectorString,
|
|||
|
||||
AssertInitialState();
|
||||
|
||||
// This is the only place that cares about mFoundUnresolvablePrefix,
|
||||
// so this is the only place that bothers clearing it.
|
||||
mFoundUnresolvablePrefix = false;
|
||||
|
||||
bool success = ParseSelectorList(*aSelectorList, PRUnichar(0));
|
||||
bool prefixErr = mFoundUnresolvablePrefix;
|
||||
|
||||
// We deliberately do not call OUTPUT_ERROR here, because all our
|
||||
// callers map a failure return to a JS exception, and if that JS
|
||||
|
@ -1217,8 +1207,6 @@ CSSParserImpl::ParseSelectorString(const nsSubstring& aSelectorString,
|
|||
}
|
||||
|
||||
NS_ASSERTION(!*aSelectorList, "Shouldn't have list!");
|
||||
if (prefixErr)
|
||||
return NS_ERROR_DOM_NAMESPACE_ERR;
|
||||
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
|
@ -9250,7 +9238,6 @@ CSSParserImpl::GetNamespaceIdForPrefix(const nsString& aPrefix)
|
|||
aPrefix.get()
|
||||
};
|
||||
REPORT_UNEXPECTED_P(PEUnknownNamespacePrefix, params);
|
||||
mFoundUnresolvablePrefix = true;
|
||||
}
|
||||
|
||||
return nameSpaceID;
|
||||
|
|
Загрузка…
Ссылка в новой задаче