Changeset 53845 in webkit


Ignore:
Timestamp:
Jan 26, 2010 2:04:15 AM (14 years ago)
Author:
Simon Hausmann
Message:

REGRESSION(r53835): Fix editing/pasteboard/paste-noscript-xhtml.xhtml
https://bugs.webkit.org/show_bug.cgi?id=34157

Reviewed by Holger Freyther.

WebCore:

Pass the FragmentScriptingPermission correctly through to the DOM
and disallow scripting elements in parseEndElement(), similar to
the libxml tokenizer change in r53835.

  • dom/XMLTokenizerQt.cpp:

(WebCore::handleElementNamespaces):
(WebCore::handleElementAttributes):
(WebCore::XMLTokenizer::parseStartElement):
(WebCore::XMLTokenizer::parseEndElement):

LayoutTests:

Add Qt specific result for this test that differs from the cross-platform
result in only one character: In htmlcontent.html the href attribute value
is http://www.cnn.com, which somehow becomes http://www.cnn.com/ in the cross
platform result. With the Qt xml parser that attribute is somehow preserved
and so our result does not have the trailing slash.

  • platform/qt/editing/pasteboard/paste-noscript-xhtml-expected.txt: Added.
Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53844 r53845  
     12010-01-26  Simon Hausmann  <simon.hausmann@nokia.com>
     2
     3        Reviewed by Holger Freyther.
     4
     5        REGRESSION(r53835): Fix editing/pasteboard/paste-noscript-xhtml.xhtml
     6        https://bugs.webkit.org/show_bug.cgi?id=34157
     7
     8        Add Qt specific result for this test that differs from the cross-platform
     9        result in only one character: In htmlcontent.html the href attribute value
     10        is http://www.cnn.com, which somehow becomes http://www.cnn.com/ in the cross
     11        platform result. With the Qt xml parser that attribute is somehow preserved
     12        and so our result does not have the trailing slash.
     13
     14        * platform/qt/editing/pasteboard/paste-noscript-xhtml-expected.txt: Added.
     15
    1162010-01-26  Kent Tamura  <tkent@chromium.org>
    217
  • trunk/WebCore/ChangeLog

    r53843 r53845  
     12010-01-26  Simon Hausmann  <simon.hausmann@nokia.com>
     2
     3        Reviewed by Holger Freyther.
     4
     5        REGRESSION(r53835): Fix editing/pasteboard/paste-noscript-xhtml.xhtml
     6        https://bugs.webkit.org/show_bug.cgi?id=34157
     7
     8        Pass the FragmentScriptingPermission correctly through to the DOM
     9        and disallow scripting elements in parseEndElement(), similar to
     10        the libxml tokenizer change in r53835.
     11
     12        * dom/XMLTokenizerQt.cpp:
     13        (WebCore::handleElementNamespaces):
     14        (WebCore::handleElementAttributes):
     15        (WebCore::XMLTokenizer::parseStartElement):
     16        (WebCore::XMLTokenizer::parseEndElement):
     17
    1182010-01-26  Garret Kelly  <gdk@chromium.org>
    219
  • trunk/WebCore/dom/XMLTokenizerQt.cpp

    r53842 r53845  
    325325
    326326static inline void handleElementNamespaces(Element* newElement, const QXmlStreamNamespaceDeclarations &ns,
    327                                            ExceptionCode& ec)
     327                                           ExceptionCode& ec, FragmentScriptingPermission scriptingPermission)
    328328{
    329329    for (int i = 0; i < ns.count(); ++i) {
     
    331331        String namespaceURI = decl.namespaceUri();
    332332        String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + decl.prefix();
    333         newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec);
     333        newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec, scriptingPermission);
    334334        if (ec) // exception setting attributes
    335335            return;
     
    337337}
    338338
    339 static inline void handleElementAttributes(Element* newElement, const QXmlStreamAttributes &attrs, ExceptionCode& ec)
     339static inline void handleElementAttributes(Element* newElement, const QXmlStreamAttributes &attrs, ExceptionCode& ec,
     340                                           FragmentScriptingPermission scriptingPermission)
    340341{
    341342    for (int i = 0; i < attrs.count(); ++i) {
     
    345346        String attrURI       = attr.namespaceUri().isEmpty() ? String() : String(attr.namespaceUri());
    346347        String attrQName     = attr.qualifiedName();
    347         newElement->setAttributeNS(attrURI, attrQName, attrValue, ec);
     348        newElement->setAttributeNS(attrURI, attrQName, attrValue, ec, scriptingPermission);
    348349        if (ec) // exception setting attributes
    349350            return;
     
    505506
    506507    ExceptionCode ec = 0;
    507     handleElementNamespaces(newElement.get(), m_stream.namespaceDeclarations(), ec);
     508    handleElementNamespaces(newElement.get(), m_stream.namespaceDeclarations(), ec, m_scriptingPermission);
    508509    if (ec) {
    509510        stopParsing();
     
    511512    }
    512513
    513     handleElementAttributes(newElement.get(), m_stream.attributes(), ec);
     514    handleElementAttributes(newElement.get(), m_stream.attributes(), ec, m_scriptingPermission);
    514515    if (ec) {
    515516        stopParsing();
     
    540541    Node* n = m_currentNode;
    541542    n->finishParsingChildren();
     543
     544    if (m_scriptingPermission == FragmentScriptingNotAllowed && n->isElementNode() && toScriptElement(static_cast<Element*>(n))) {
     545        popCurrentNode();
     546        ExceptionCode ec;
     547        n->remove(ec);
     548        return;
     549    }
    542550
    543551    if (!n->isElementNode() || !m_view) {
Note: See TracChangeset for help on using the changeset viewer.