Bug 1143271 - use [ChromeOnly] on MutationObserverInit, r=bz
This commit is contained in:
@@ -629,15 +629,11 @@ nsDOMMutationObserver::Observe(nsINode& aTarget,
|
||||
bool attributeOldValue =
|
||||
aOptions.mAttributeOldValue.WasPassed() &&
|
||||
aOptions.mAttributeOldValue.Value();
|
||||
bool nativeAnonymousChildList = aOptions.mNativeAnonymousChildList &&
|
||||
nsContentUtils::ThreadsafeIsCallerChrome();
|
||||
bool nativeAnonymousChildList = aOptions.mNativeAnonymousChildList;
|
||||
bool characterDataOldValue =
|
||||
aOptions.mCharacterDataOldValue.WasPassed() &&
|
||||
aOptions.mCharacterDataOldValue.Value();
|
||||
bool animations =
|
||||
aOptions.mAnimations.WasPassed() &&
|
||||
aOptions.mAnimations.Value() &&
|
||||
nsContentUtils::ThreadsafeIsCallerChrome();
|
||||
bool animations = aOptions.mAnimations;
|
||||
|
||||
if (!aOptions.mAttributes.WasPassed() &&
|
||||
(aOptions.mAttributeOldValue.WasPassed() ||
|
||||
@@ -763,7 +759,7 @@ nsDOMMutationObserver::GetObservingInfo(
|
||||
info.mAttributeOldValue.Construct(mr->AttributeOldValue());
|
||||
info.mCharacterDataOldValue.Construct(mr->CharacterDataOldValue());
|
||||
info.mNativeAnonymousChildList = mr->NativeAnonymousChildList();
|
||||
info.mAnimations.Construct(mr->Animations());
|
||||
info.mAnimations = mr->Animations();
|
||||
nsCOMArray<nsIAtom>& filters = mr->AttributeFilter();
|
||||
if (filters.Count()) {
|
||||
info.mAttributeFilter.Construct();
|
||||
|
||||
@@ -233,12 +233,32 @@ function testSubtree() {
|
||||
is(records[1].removedNodes.length, 0, "Shouldn't have got removedNodes");
|
||||
|
||||
observer.disconnect();
|
||||
SimpleTest.finish();
|
||||
testDictionaryWithoutChromePriv();
|
||||
});
|
||||
SpecialPowers.observeMutationEvents(m, document, true, true);
|
||||
parent.style.display = "block";
|
||||
}
|
||||
|
||||
function testDictionaryWithoutChromePriv()
|
||||
{
|
||||
var m = new MutationObserver(function() {});
|
||||
try {
|
||||
m.observe(document, { childList: true, get nativeAnonymousChildList() { throw "Foo1"; } } );
|
||||
ok(true, "Shouldn't throw!");
|
||||
} catch(ex) {
|
||||
ok(false, "Did throw " + ex);
|
||||
}
|
||||
|
||||
try {
|
||||
m.observe(document, { childList: true, get animations() { throw "Foo2"; } } );
|
||||
ok(true, "Shouldn't throw!");
|
||||
} catch(ex) {
|
||||
ok(false, "Did throw " + ex);
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
@@ -61,10 +61,10 @@ dictionary MutationObserverInit {
|
||||
boolean subtree = false;
|
||||
boolean attributeOldValue;
|
||||
boolean characterDataOldValue;
|
||||
// [ChromeOnly]
|
||||
[ChromeOnly]
|
||||
boolean nativeAnonymousChildList = false;
|
||||
// [ChromeOnly]
|
||||
boolean animations;
|
||||
[ChromeOnly]
|
||||
boolean animations = false;
|
||||
sequence<DOMString> attributeFilter;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user