Test cases added:
* layout-tests/dom/html/level2/html/HTMLSelectElement20-expected.txt:
This passes now.
* khtml/ecma/kjs_html.cpp:
(KJS::KJS::HTMLElementFunction::callAsFunction):
(KJS::KJS::HTMLSelectCollection::put):
Handle exceptions.
* khtml/html/html_formimpl.cpp:
(DOM::HTMLSelectElementImpl::add):
* khtml/html/html_formimpl.h:
Make ::add raise an exception if before isn't a descendant
of the select element.
* kwq/DOMHTML.mm:
(-[DOMHTMLSelectElement add::]):
Handle the exception.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@10173
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
-Test: http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement20
-Status: failure
-Detail: throw_NOT_FOUND_ERR: assertTrue failed
+Test: http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLSelectElement20
+Status: Success
+2005-08-14 Anders Carlsson <andersca@mac.com>
+
+ Reviewed and landed by Darin.
+
+ Test cases added:
+ * layout-tests/dom/html/level2/html/HTMLSelectElement20-expected.txt:
+ This passes now.
+
+ * khtml/ecma/kjs_html.cpp:
+ (KJS::KJS::HTMLElementFunction::callAsFunction):
+ (KJS::KJS::HTMLSelectCollection::put):
+ Handle exceptions.
+
+ * khtml/html/html_formimpl.cpp:
+ (DOM::HTMLSelectElementImpl::add):
+ * khtml/html/html_formimpl.h:
+ Make ::add raise an exception if before isn't a descendant
+ of the select element.
+
+ * kwq/DOMHTML.mm:
+ (-[DOMHTMLSelectElement add::]):
+ Handle the exception.
+
2005-08-12 Geoffrey Garen <ggaren@apple.com>
Reviewed by adele.
all-am:
defaults write com.apple.Xcode PBXProductDirectory "$(SYMROOTS)"
defaults write com.apple.Xcode PBXIntermediatesDirectory "$(SYMROOTS)"
+ ../WebKitTools/Scripts/set-webkit-configuration --$(BUILDSTYLE)
xcodebuild -configuration $(BUILDSTYLE)
clean-am:
defaults write com.apple.Xcode PBXProductDirectory "$(SYMROOTS)"
defaults write com.apple.Xcode PBXIntermediatesDirectory "$(SYMROOTS)"
- xcodebuild clean -configuration ${BUILDSTYLE}
+ ../WebKitTools/Scripts/set-webkit-configuration --$(BUILDSTYLE)
+ xcodebuild clean -configuration $(BUILDSTYLE)
else if (element.hasLocalName(selectTag)) {
HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
if (id == KJS::HTMLElement::SelectAdd) {
- select.add(toHTMLElement(args[0]), toHTMLElement(args[1]));
+ select.add(toHTMLElement(args[0]), toHTMLElement(args[1]), exception);
return Undefined();
}
else if (id == KJS::HTMLElement::SelectRemove) {
if (diff < 0) { // add dummy elements
do {
ElementImpl *option = m_element->ownerDocument()->createElement("option", exception);
- m_element->add(static_cast<HTMLElementImpl *>(option), 0);
+ if (exception)
+ break;
+ m_element->add(static_cast<HTMLElementImpl *>(option), 0, exception);
if (exception)
break;
} while (++diff);
while (diff--) {
ElementImpl *dummyOption = m_element->ownerDocument()->createElement("option", exception);
if (!dummyOption)
- break;
- m_element->add(static_cast<HTMLElementImpl *>(dummyOption), 0);
+ break;
+ m_element->add(static_cast<HTMLElementImpl *>(dummyOption), 0, exception);
+ if (exception)
+ break;
}
// replace an existing entry ?
} else if (diff < 0) {
}
// finally add the new element
if (exception == 0)
- m_element->add(static_cast<HTMLOptionElementImpl *>(option), before);
+ m_element->add(static_cast<HTMLOptionElementImpl *>(option), before, exception);
setDOMException(exec, exception);
}
return len;
}
-void HTMLSelectElementImpl::add( HTMLElementImpl *element, HTMLElementImpl *before )
+void HTMLSelectElementImpl::add( HTMLElementImpl *element, HTMLElementImpl *before, int &exceptioncode )
{
+ SharedPtr<HTMLElementImpl> protectNewChild(element); // make sure the element is ref'd and deref'd so we don't leak it
+
if (!element || !element->hasLocalName(optionTag))
return;
- int exceptioncode = 0;
insertBefore(element, before, exceptioncode);
if (!exceptioncode)
setRecalcListItems();
bool multiple() const { return m_multiple; }
- void add ( HTMLElementImpl *element, HTMLElementImpl *before );
+ void add ( HTMLElementImpl *element, HTMLElementImpl *before, int &exceptioncode );
void remove ( long index );
void blur();
void focus();
- (void)add:(DOMHTMLElement *)element :(DOMHTMLElement *)before
{
- [self _selectElementImpl]->add([element _HTMLElementImpl], [before _HTMLElementImpl]);
+ int exceptionCode = 0;
+ [self _selectElementImpl]->add([element _HTMLElementImpl], [before _HTMLElementImpl], exceptionCode);
+ raiseOnDOMError(exceptionCode);
}
- (void)remove:(long)index