Changeset 147018 in webkit


Ignore:
Timestamp:
Mar 27, 2013 4:45:11 PM (11 years ago)
Author:
ggaren@apple.com
Message:

Honor the setting for whether JavaScript markup is enabled
https://bugs.webkit.org/show_bug.cgi?id=113122

Reviewed by Ryosuke Niwa.

Source/WebCore:

  • dom/ScriptableDocumentParser.cpp:

(WebCore::ScriptableDocumentParser::ScriptableDocumentParser): Applied the
setting here, so all document parsing would be covered. This is similar
to what we do for plug-in stripping.

  • html/parser/HTMLConstructionSite.cpp:

(WebCore::HTMLConstructionSite::insertForeignElement): Fixed a bug where
we would insert an SVG script element into the document even in script
markup disabled mode.

(This bug has existed for copy/paste for a long time, but other bugs and
quirks in SVG copy/paste papered over it. It's a serious issue now
that non-paste clients will rely on this mode.)

  • html/parser/HTMLTreeBuilder.cpp:

(WebCore::HTMLTreeBuilder::processTokenInForeignContent): Fixed the same
bug -- this time in the part of the parser that executes scripts as they
parse.

I adopted the toScriptElement() convention for testing for a script
element to match the XML parser.

LayoutTests:

  • editing/unsupported-content/script-markup-enabled-setting-expected.txt: Added.
  • editing/unsupported-content/script-markup-enabled-setting.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r147002 r147018  
     12013-03-22  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Honor the setting for whether JavaScript markup is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=113122
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * editing/unsupported-content/script-markup-enabled-setting-expected.txt: Added.
     9        * editing/unsupported-content/script-markup-enabled-setting.html: Added.
     10
    1112013-03-27  Zan Dobersek  <zdobersek@igalia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r147012 r147018  
     12013-03-22  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Honor the setting for whether JavaScript markup is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=113122
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * dom/ScriptableDocumentParser.cpp:
     9        (WebCore::ScriptableDocumentParser::ScriptableDocumentParser): Applied the
     10        setting here, so all document parsing would be covered. This is similar
     11        to what we do for plug-in stripping.
     12
     13        * html/parser/HTMLConstructionSite.cpp:
     14        (WebCore::HTMLConstructionSite::insertForeignElement): Fixed a bug where
     15        we would insert an SVG script element into the document even in script
     16        markup disabled mode.
     17
     18        (This bug has existed for copy/paste for a long time, but other bugs and
     19        quirks in SVG copy/paste papered over it. It's a serious issue now
     20        that non-paste clients will rely on this mode.)
     21
     22        * html/parser/HTMLTreeBuilder.cpp:
     23        (WebCore::HTMLTreeBuilder::processTokenInForeignContent): Fixed the same
     24        bug -- this time in the part of the parser that executes scripts as they
     25        parse.
     26
     27        I adopted the toScriptElement() convention for testing for a script
     28        element to match the XML parser.
     29
    1302013-03-27  Dean Jackson  <dino@apple.com>
    231
  • trunk/Source/WebCore/dom/ScriptableDocumentParser.cpp

    r146264 r147018  
    4141    if (!pluginContentIsAllowed(m_parserContentPolicy) && (!document->settings() || document->settings()->unsafePluginPastingEnabled()))
    4242        m_parserContentPolicy = allowPluginContent(m_parserContentPolicy);
     43
     44    if (scriptingContentIsAllowed(m_parserContentPolicy) && (document->settings() && !document->settings()->scriptMarkupEnabled()))
     45        m_parserContentPolicy = disallowScriptingContent(m_parserContentPolicy);
    4346}
    4447
  • trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp

    r146264 r147018  
    4242#include "HTMLNames.h"
    4343#include "HTMLParserIdioms.h"
     44#include "HTMLPlugInElement.h"
    4445#include "HTMLScriptElement.h"
    4546#include "HTMLStackItem.h"
     
    107108void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> prpChild, bool selfClosing)
    108109{
     110    ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || !toElement(prpChild.get()) || !toScriptElement(toElement(prpChild.get())));
     111    ASSERT(pluginContentIsAllowed(m_parserContentPolicy) || !prpChild->isPluginElement());
     112
    109113    HTMLConstructionSiteTask task;
    110114    task.parent = parent;
     
    463467
    464468    RefPtr<Element> element = createElement(token, namespaceURI);
    465     attachLater(currentNode(), element, token->selfClosing());
     469    if (scriptingContentIsAllowed(m_parserContentPolicy) || !toScriptElement(element.get()))
     470        attachLater(currentNode(), element, token->selfClosing());
    466471    if (!token->selfClosing())
    467472        m_openElements.push(HTMLStackItem::create(element.release(), token, namespaceURI));
  • trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp

    r146264 r147018  
    28692869
    28702870        if (token->name() == SVGNames::scriptTag && m_tree.currentStackItem()->hasTagName(SVGNames::scriptTag)) {
    2871             m_scriptToProcess = m_tree.currentElement();
     2871            if (scriptingContentIsAllowed(m_tree.parserContentPolicy()))
     2872                m_scriptToProcess = m_tree.currentElement();
    28722873            m_tree.openElements()->pop();
    28732874            return;
Note: See TracChangeset for help on using the changeset viewer.