Changeset 57313 in webkit


Ignore:
Timestamp:
Apr 8, 2010 11:43:19 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-04-08 Chris Evans <cevans@chromium.org>

Reviewed by Sam Weinig.

Add test for POST & _blank popup blocker bypass.
https://bugs.webkit.org/show_bug.cgi?id=34541

  • fast/events/popup-blocked-to-post-blank.html: added
  • fast/events/popup-blocked-to-post-blank-expected.txt: added

2010-04-08 Chris Evans <cevans@chromium.org>

Reviewed by Sam Weinig.

Use the new UserGestureIndictor for _blank POST requests.

https://bugs.webkit.org/show_bug.cgi?id=34541

Test: fast/events/popup-blocked-to-post-blank.html

  • bindings/v8/ScriptController.cpp: (WebCore::ScriptController::processingUserGesture): Use UserGestureIndicator in more cases.
  • page/EventHandler.cpp: (WebCore::EventHandler): Impact from UserGestureIndicator API change. (WebCore::FrameLoader::submitForm): Block the load immediately if popups are not allowed and it would open a new window.
  • loader/RedirectScheduler.cpp: (WebCore::ScheduledFormSubmission::ScheduledFormSubmission): Note the UserGestureIndicator status at the time of submission. (WebCore::ScheduledFormSubmission::fire): Use the stored UserGestureIndicator status in the asynchronous callback.
  • dom/UserGestureIndicator.h:
  • dom/UserGestureIndicator.cpp: (WebCore::UserGestureIndicator::UserGestureIndicator): Add ability to store a negative indication.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r57305 r57313  
     12010-04-08  Chris Evans  <cevans@chromium.org>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Add test for POST & _blank popup blocker bypass.
     6        https://bugs.webkit.org/show_bug.cgi?id=34541
     7
     8        * fast/events/popup-blocked-to-post-blank.html: added
     9        * fast/events/popup-blocked-to-post-blank-expected.txt: added
     10
    1112010-04-08  Ojan Vafai  <ojan@chromium.org>
    212
  • trunk/WebCore/ChangeLog

    r57304 r57313  
     12010-04-08  Chris Evans  <cevans@chromium.org>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Use the new UserGestureIndictor for _blank POST requests.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=34541
     8
     9        Test: fast/events/popup-blocked-to-post-blank.html
     10
     11        * bindings/v8/ScriptController.cpp:
     12        (WebCore::ScriptController::processingUserGesture):
     13          Use UserGestureIndicator in more cases.
     14        * page/EventHandler.cpp:
     15        (WebCore::EventHandler):
     16          Impact from UserGestureIndicator API change.
     17        (WebCore::FrameLoader::submitForm):
     18          Block the load immediately if popups are not allowed and it would
     19          open a new window.
     20        * loader/RedirectScheduler.cpp:
     21        (WebCore::ScheduledFormSubmission::ScheduledFormSubmission):
     22          Note the UserGestureIndicator status at the time of submission.
     23        (WebCore::ScheduledFormSubmission::fire):
     24          Use the stored UserGestureIndicator status in the asynchronous
     25          callback.
     26        * dom/UserGestureIndicator.h:
     27        * dom/UserGestureIndicator.cpp:
     28        (WebCore::UserGestureIndicator::UserGestureIndicator):
     29          Add ability to store a negative indication.
     30
    1312010-03-29  Antonio Gomes  <tonikitoo@webkit.org>
    232
  • trunk/WebCore/bindings/v8/ScriptController.cpp

    r57243 r57313  
    155155{
    156156    Frame* activeFrame = V8Proxy::retrieveFrameForEnteredContext();
    157     // No script is running, so it must be run by users.
     157    // No script is running, so it is user-initiated unless the gesture stack
     158    // explicitly says it is not.
    158159    if (!activeFrame)
    159         return true;
     160        return UserGestureIndicator::processingUserGesture();
    160161
    161162    V8Proxy* activeProxy = activeFrame->script()->proxy();
  • trunk/WebCore/dom/UserGestureIndicator.cpp

    r57159 r57313  
    3131bool UserGestureIndicator::s_processingUserGesture = false;
    3232
    33 UserGestureIndicator::UserGestureIndicator()
     33UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
    3434    : m_previousValue(s_processingUserGesture)
    3535{
    36     s_processingUserGesture = true;
     36    if (state == DefinitelyProcessingUserGesture)
     37        s_processingUserGesture = true;
    3738}
    3839
  • trunk/WebCore/dom/UserGestureIndicator.h

    r57159 r57313  
    3131namespace WebCore {
    3232
     33enum ProcessingUserGestureState {
     34    DefinitelyProcessingUserGesture,
     35    PossiblyProcessingUserGesture
     36};
     37
    3338class UserGestureIndicator : public Noncopyable {
    3439public:
    3540    static bool processingUserGesture() { return s_processingUserGesture; }
    36    
    37     UserGestureIndicator();
     41
     42    explicit UserGestureIndicator(ProcessingUserGestureState);
    3843    ~UserGestureIndicator();
    39    
     44
    4045private:
    4146    static bool s_processingUserGesture;
  • trunk/WebCore/loader/FrameLoader.cpp

    r57095 r57313  
    477477        return;
    478478    if (!targetFrame) {
     479        if (!DOMWindow::allowPopUp(m_frame) && !isProcessingUserGesture())
     480            return;
     481
    479482        targetFrame = m_frame;
    480483        frameRequest.setFrameName(targetOrBaseTarget);
  • trunk/WebCore/loader/RedirectScheduler.cpp

    r56875 r57313  
    4444#include "HTMLFrameOwnerElement.h"
    4545#include "Page.h"
     46#include "UserGestureIndicator.h"
    4647#include <wtf/CurrentTime.h>
    4748
     
    176177        , m_event(event)
    177178        , m_formState(formState)
     179        , m_wasProcessingUserGesture(UserGestureIndicator::processingUserGesture())
    178180    {
    179181        ASSERT(!frameRequest.isEmpty());
     
    183185    virtual void fire(Frame* frame)
    184186    {
     187        UserGestureIndicator gestureIndicator(m_wasProcessingUserGesture ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture);
     188
    185189        // The submitForm function will find a target frame before using the redirection timer.
    186190        // Now that the timer has fired, we need to repeat the security check which normally is done when
     
    201205    const RefPtr<Event> m_event;
    202206    const RefPtr<FormState> m_formState;
     207    bool m_wasProcessingUserGesture;
    203208};
    204209
  • trunk/WebCore/page/EventHandler.cpp

    r57045 r57313  
    11671167{
    11681168    RefPtr<FrameView> protector(m_frame->view());
    1169    
    1170     UserGestureIndicator gestureIndicator;
    1171    
     1169
     1170    UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
     1171
    11721172    cancelFakeMouseMoveEvent();
    11731173    m_mousePressed = true;
     
    12981298{
    12991299    RefPtr<FrameView> protector(m_frame->view());
    1300    
    1301     UserGestureIndicator gestureIndicator;
     1300
     1301    UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
    13021302
    13031303    // We get this instead of a second mouse-up
     
    14681468    RefPtr<FrameView> protector(m_frame->view());
    14691469   
    1470     UserGestureIndicator gestureIndicator;
     1470    UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
    14711471
    14721472#if ENABLE(PAN_SCROLLING)
     
    21282128    if (!node)
    21292129        return false;
    2130    
    2131     UserGestureIndicator gestureIndicator;
     2130
     2131    UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
    21322132
    21332133    if (FrameView* view = m_frame->view())
     
    26972697    const Vector<PlatformTouchPoint>& points = event.touchPoints();
    26982698    AtomicString* eventName = 0;
    2699    
    2700     UserGestureIndicator gestureIndicator;
     2699
     2700    UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
    27012701
    27022702    for (unsigned i = 0; i < points.size(); ++i) {
Note: See TracChangeset for help on using the changeset viewer.