mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 750556 - crash in mozilla::dom::Element::ClearStyleStateLocks; r=bz
This commit is contained in:
parent
8b7988e945
commit
90bc12cbe0
@ -398,14 +398,14 @@ NS_IMETHODIMP
|
||||
inDOMUtils::AddPseudoClassLock(nsIDOMElement *aElement,
|
||||
const nsAString &aPseudoClass)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
|
||||
nsEventStates state = GetStatesForPseudoClass(aPseudoClass);
|
||||
if (state.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
|
||||
element->LockStyleStates(state);
|
||||
|
||||
return NS_OK;
|
||||
@ -415,14 +415,14 @@ NS_IMETHODIMP
|
||||
inDOMUtils::RemovePseudoClassLock(nsIDOMElement *aElement,
|
||||
const nsAString &aPseudoClass)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
|
||||
nsEventStates state = GetStatesForPseudoClass(aPseudoClass);
|
||||
if (state.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
|
||||
element->UnlockStyleStates(state);
|
||||
|
||||
return NS_OK;
|
||||
@ -433,8 +433,6 @@ inDOMUtils::HasPseudoClassLock(nsIDOMElement *aElement,
|
||||
const nsAString &aPseudoClass,
|
||||
bool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
|
||||
nsEventStates state = GetStatesForPseudoClass(aPseudoClass);
|
||||
if (state.IsEmpty()) {
|
||||
*_retval = false;
|
||||
@ -442,6 +440,8 @@ inDOMUtils::HasPseudoClassLock(nsIDOMElement *aElement,
|
||||
}
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
|
||||
nsEventStates locks = element->LockedStyleStates();
|
||||
|
||||
*_retval = locks.HasAllStates(state);
|
||||
@ -451,9 +451,9 @@ inDOMUtils::HasPseudoClassLock(nsIDOMElement *aElement,
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::ClearPseudoClassLocks(nsIDOMElement *aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
|
||||
element->ClearStyleStateLocks();
|
||||
|
||||
return NS_OK;
|
||||
|
@ -28,6 +28,7 @@ function RunTests() {
|
||||
testVisited();
|
||||
testMultiple();
|
||||
testInvalid();
|
||||
testNotElement();
|
||||
}
|
||||
|
||||
function testLockEnabled() {
|
||||
@ -256,7 +257,19 @@ function testInvalid() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function testNotElement() {
|
||||
var values = [null, undefined, {}];
|
||||
try {
|
||||
for each (value in values); {
|
||||
DOMUtils.hasPseudoClassLock(value, ":hover");
|
||||
DOMUtils.addPseudoClassLock(value, ":hover");
|
||||
DOMUtils.removePseudoClassLock(value, ":hover");
|
||||
DOMUtils.clearPseudoClassLocks(value);
|
||||
}
|
||||
} catch(e) {
|
||||
// just make sure we don't crash on non-elements
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user