Changeset 55674 in webkit


Ignore:
Timestamp:
Mar 8, 2010 11:40:49 AM (14 years ago)
Author:
eric@webkit.org
Message:

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

Reviewed by Nate Chapin.

[V8] Block popups from inline script
https://bugs.webkit.org/show_bug.cgi?id=35474

Test that we block popups generated from <script>window.open(...)</script>.

  • http/tests/security/popup-blocked-from-window-open-expected.txt: Added.
  • http/tests/security/popup-blocked-from-window-open.html: Added.

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

Reviewed by Nate Chapin.

[V8] Block popups from inline script
https://bugs.webkit.org/show_bug.cgi?id=35474

Apparently, we're supposed to look at the sourceURL to figure out
whether we're running a script tag or a hyperlink. This logic is
copied from the JSC version.

Test: http/tests/security/popup-blocked-from-window-open.html

  • bindings/v8/ScriptController.cpp: (WebCore::ScriptController::processingUserGesture): (WebCore::ScriptController::evaluate):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55672 r55674  
     12010-03-08  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Nate Chapin.
     4
     5        [V8] Block popups from inline script
     6        https://bugs.webkit.org/show_bug.cgi?id=35474
     7
     8        Test that we block popups generated from <script>window.open(...)</script>.
     9
     10        * http/tests/security/popup-blocked-from-window-open-expected.txt: Added.
     11        * http/tests/security/popup-blocked-from-window-open.html: Added.
     12
    1132010-03-08  Brady Eidson  <beidson@apple.com>
    214
  • trunk/WebCore/ChangeLog

    r55673 r55674  
     12010-03-08  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Nate Chapin.
     4
     5        [V8] Block popups from inline script
     6        https://bugs.webkit.org/show_bug.cgi?id=35474
     7
     8        Apparently, we're supposed to look at the sourceURL to figure out
     9        whether we're running a script tag or a hyperlink.  This logic is
     10        copied from the JSC version.
     11
     12        Test: http/tests/security/popup-blocked-from-window-open.html
     13
     14        * bindings/v8/ScriptController.cpp:
     15        (WebCore::ScriptController::processingUserGesture):
     16        (WebCore::ScriptController::evaluate):
     17
    1182010-03-08  Stuart Morgan  <stuartmorgan@chromium.org>
    219
  • trunk/WebCore/bindings/v8/ScriptController.cpp

    r55207 r55674  
    191191        if (eventOk)
    192192            return true;
    193     } else if (activeProxy->inlineCode() && !activeProxy->timerCallback()) {
     193    } else if (m_sourceURL && m_sourceURL->isNull() && !activeProxy->timerCallback()) {
    194194        // This is the <a href="javascript:window.open('...')> case -> we let it through.
    195195        return true;
     
    220220{
    221221    String sourceURL = sourceCode.url();
    222    
     222    const String* savedSourceURL = m_sourceURL;
     223    m_sourceURL = &sourceURL;
     224
    223225    if (!m_XSSAuditor->canEvaluate(sourceCode.source())) {
    224226        // This script is not safe to be evaluated.
     
    238240
    239241    // Evaluating the JavaScript could cause the frame to be deallocated
    240     // so we starot the keep alive timer here.
     242    // so we start the keep alive timer here.
    241243    m_frame->keepAlive();
     244
     245    m_sourceURL = savedSourceURL;
    242246
    243247    if (object.IsEmpty() || object->IsUndefined())
Note: See TracChangeset for help on using the changeset viewer.