Changeset 56046 in webkit


Ignore:
Timestamp:
Mar 16, 2010 12:27:24 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-16 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

noscript tag should render when @sandbox disables JavaScript
https://bugs.webkit.org/show_bug.cgi?id=36092

Test that the noscript element renders when @sandbox disables
JavaScript.

  • fast/frames/sandboxed-iframe-noscript-expected.txt: Added.
  • fast/frames/sandboxed-iframe-noscript.html: Added.

2010-03-16 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

noscript tag should render when @sandbox disables JavaScript
https://bugs.webkit.org/show_bug.cgi?id=36092

Instead of talking to Settings directly to figure out if JavaScript is
enabled in a frame, we need to talk to the ScriptController. The
ScriptController is better at answering that question because it knows
about @sandbox.

Test: fast/frames/sandboxed-iframe-noscript.html

  • dom/Document.cpp: (WebCore::Document::Document):
  • html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::createRenderer):
  • html/HTMLElement.cpp: (WebCore::HTMLElement::rendererIsNeeded):
  • html/HTMLParser.cpp: (WebCore::HTMLParser::noscriptCreateErrorCheck): (WebCore::HTMLParser::isInline):
  • plugins/PluginView.cpp: (WebCore::PluginView::load):
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r56041 r56046  
     12010-03-16  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        noscript tag should render when @sandbox disables JavaScript
     6        https://bugs.webkit.org/show_bug.cgi?id=36092
     7
     8        Test that the noscript element renders when @sandbox disables
     9        JavaScript.
     10
     11        * fast/frames/sandboxed-iframe-noscript-expected.txt: Added.
     12        * fast/frames/sandboxed-iframe-noscript.html: Added.
     13
    1142010-03-15  Kent Tamura  <tkent@chromium.org>
    215
  • trunk/WebCore/ChangeLog

    r56043 r56046  
     12010-03-16  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        noscript tag should render when @sandbox disables JavaScript
     6        https://bugs.webkit.org/show_bug.cgi?id=36092
     7
     8        Instead of talking to Settings directly to figure out if JavaScript is
     9        enabled in a frame, we need to talk to the ScriptController.  The
     10        ScriptController is better at answering that question because it knows
     11        about @sandbox.
     12
     13        Test: fast/frames/sandboxed-iframe-noscript.html
     14
     15        * dom/Document.cpp:
     16        (WebCore::Document::Document):
     17        * html/HTMLCanvasElement.cpp:
     18        (WebCore::HTMLCanvasElement::createRenderer):
     19        * html/HTMLElement.cpp:
     20        (WebCore::HTMLElement::rendererIsNeeded):
     21        * html/HTMLParser.cpp:
     22        (WebCore::HTMLParser::noscriptCreateErrorCheck):
     23        (WebCore::HTMLParser::isInline):
     24        * plugins/PluginView.cpp:
     25        (WebCore::PluginView::load):
     26
    1272010-03-15  John Gregg  <johnnyg@google.com>
    228
  • trunk/WebCore/dom/Document.cpp

    r55816 r56046  
    452452    m_docID = docID++;
    453453#if ENABLE(XHTMLMP)
    454     m_shouldProcessNoScriptElement = settings() && !settings()->isJavaScriptEnabled();
     454    m_shouldProcessNoScriptElement = m_frame->script()->canExecuteScripts(NotAboutToExecuteScript);
    455455#endif
    456456}
  • trunk/WebCore/html/HTMLCanvasElement.cpp

    r55685 r56046  
    114114RenderObject* HTMLCanvasElement::createRenderer(RenderArena* arena, RenderStyle* style)
    115115{
    116     Settings* settings = document()->settings();
    117     if (settings && settings->isJavaScriptEnabled()) {
     116    Frame* frame = document()->frame();
     117    if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) {
    118118        m_rendererIsCanvas = true;
    119119        return new (arena) RenderHTMLCanvas(this);
  • trunk/WebCore/html/HTMLElement.cpp

    r55980 r56046  
    977977#if !ENABLE(XHTMLMP)
    978978    if (hasLocalName(noscriptTag)) {
    979         Settings* settings = document()->settings();
    980         if (settings && settings->isJavaScriptEnabled())
     979        Frame* frame = document()->frame();
     980        if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript))
    981981            return false;
    982982    }
  • trunk/WebCore/html/HTMLParser.cpp

    r55710 r56046  
    876876{
    877877    if (!m_isParsingFragment) {
    878         Settings* settings = m_document->settings();
    879         if (settings && settings->isJavaScriptEnabled())
     878        Frame* frame = m_document->frame();
     879        if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript))
    880880            setSkipMode(noscriptTag);
    881881    }
     
    10621062#if !ENABLE(XHTMLMP)
    10631063        if (e->hasLocalName(noscriptTag) && !m_isParsingFragment) {
    1064             Settings* settings = m_document->settings();
    1065             if (settings && settings->isJavaScriptEnabled())
     1064            Frame* frame = m_document->frame();
     1065            if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript))
    10661066                return true;
    10671067        }
  • trunk/WebCore/page/Settings.h

    r55976 r56046  
    106106
    107107        void setJavaScriptEnabled(bool);
     108        // Instead of calling isJavaScriptEnabled directly, please consider calling
     109        // ScriptController::canExecuteScripts, which takes things like the
     110        // HTML sandbox attribute into account.
    108111        bool isJavaScriptEnabled() const { return m_isJavaScriptEnabled; }
    109112
  • trunk/WebCore/plugins/PluginView.cpp

    r55433 r56046  
    534534
    535535    if (!jsString.isNull()) {
    536         Settings* settings = m_parentFrame->settings();
    537 
    538536        // Return NPERR_GENERIC_ERROR if JS is disabled. This is what Mozilla does.
    539         if (!settings || !settings->isJavaScriptEnabled())
     537        if (m_parentFrame->script()->canExecuteScripts(NotAboutToExecuteScript))
    540538            return NPERR_GENERIC_ERROR;
    541        
     539
    542540        // For security reasons, only allow JS requests to be made on the frame that contains the plug-in.
    543541        if (!targetFrameName.isNull() && m_parentFrame->tree()->find(targetFrameName) != m_parentFrame)
Note: See TracChangeset for help on using the changeset viewer.