-
rniwa@webkit.org authored
https://bugs.webkit.org/show_bug.cgi?id=87454 Reviewed by Darin Adler. Source/WebCore: Before this patch, createContextualFragment threw NOT_SUPPORTED_ERR and insertAdjacentHTML didn't throw any errors. Make them throw SYNTAX_ERR to be consistent with the spec and Firefox: http://html5.org/specs/dom-parsing.html#parsing http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-fragment-parsing-algorithm Also reduced the code duplication. Test: fast/dom/xhtml-fragment-parsing-exceptions.xhtml * dom/Range.cpp: (WebCore::Range::createContextualFragment): * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::setInnerHTML): Explicitly pass AllowScriptingContent. * editing/markup.cpp: (WebCore::createFragmentFromMarkup): (WebCore::createFragmentForInnerOuterHTML): Takes ExceptionCode now. (WebCore::createContextualFragment): Share code with createFragmentForInnerOuterHTML and propagate the exception code. * editing/markup.h: * html/HTMLElement.cpp: (WebCore::HTMLElement::setInnerHTML): Explicitly pass AllowScriptingContent. (WebCore::HTMLElement::setOuterHTML): Ditto. (WebCore::HTMLElement::insertAdjacentHTML): Ditto; also rename ignoredEc to ignoredEC per Darin's comment on the bug 87339. Source/WebKit/qt: Pass an ExceptionCode to createContextualFragment. * Api/qwebelement.cpp: (QWebElement::appendInside): (QWebElement::prependInside): (QWebElement::prependOutside): (QWebElement::appendOutside): (QWebElement::encloseContentsWith): (QWebElement::encloseWith): LayoutTests: Add a regression test, and rebaselined the existing tests since we throw DOMException.SYNTAX_ERR instead of DOMException.INVALID_STATE_ERR. * fast/dom/xhtml-fragment-parsing-exceptions-expected.txt: Added. * fast/dom/xhtml-fragment-parsing-exceptions.xhtml: Added. * fast/innerHTML/innerHTML-changing-document-properties-expected.txt: * fast/parser/xhtml-innerhtml-null-byte-first.xhtml: * fast/parser/xhtml-innerhtml-null-byte.xhtml: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118570 268f45cc-cd09-0410-ab3c-d52691b4dbfc
77fea98c