#include "JSDictionary.h"
#include "JSMutationCallback.h"
#include "JSNode.h"
-#include "MutationObserverOptions.h"
#include "Node.h"
#include "WebKitMutationObserver.h"
#include <runtime/Error.h>
}
JSDictionary dictionary(exec, optionsObject);
+ MutationObserverOptions options = 0;
+ // FIXME: Add support for parsing of the attributeFilter option.
+ bool option;
+ if (dictionary.tryGetProperty("childList", option) && option)
+ options |= WebKitMutationObserver::ChildList;
+ if (dictionary.tryGetProperty("attributes", option) && option)
+ options |= WebKitMutationObserver::Attributes;
+ if (dictionary.tryGetProperty("subtree", option) && option)
+ options |= WebKitMutationObserver::Subtree;
+ if (dictionary.tryGetProperty("attributeOldValue", option) && option)
+ options |= WebKitMutationObserver::AttributeOldValue;
+ if (dictionary.tryGetProperty("characterDataOldValue", option) && option)
+ options |= WebKitMutationObserver::CharacterDataOldValue;
- RefPtr<MutationObserverOptions> options = MutationObserverOptions::create();
- if (!dictionary.tryGetProperty("childList", *options, &MutationObserverOptions::setChildList)
- || !dictionary.tryGetProperty("attributes", *options, &MutationObserverOptions::setAttributes)
- || !dictionary.tryGetProperty("characterData", *options, &MutationObserverOptions::setCharacterData)
- || !dictionary.tryGetProperty("subtree", *options, &MutationObserverOptions::setSubtree)
- || !dictionary.tryGetProperty("attributeOldValue", *options, &MutationObserverOptions::setAttributeOldValue)
- || !dictionary.tryGetProperty("characterDataOldValue", *options, &MutationObserverOptions::setCharacterDataOldValue))
+ if (exec->hadException())
return jsUndefined();
- impl()->observe(target, options.get());
+ ExceptionCode ec = 0;
+ impl()->observe(target, options, ec);
+ if (ec)
+ setDOMException(exec, ec);
return jsUndefined();
}