Changeset 39377 in webkit


Ignore:
Timestamp:
Dec 18, 2008 10:19:06 AM (15 years ago)
Author:
cwzwarich@webkit.org
Message:

2008-12-18 Cameron Zwarich <zwarich@apple.com>

Reviewed by Geoff Garen.

Bug 21855: REGRESSION (r37323): Gmail complains about popup blocking when opening a link
<https://bugs.webkit.org/show_bug.cgi?id=21855>
<rdar://problem/6278244>

If JavaScript is not currently executing, the handleEvent member function
of JSAbstractEventListener should set the dynamic global object to the
global object of the context in which the event occurred.


If this is not set, then JavaScriptCore will simply take the global object
of the context where the event handler function was created, which may be
a different frame. This will cause the popup blocker to incorrectly block
windows opened from onclick events inside of an iframe whose handler was
created in the outer frame, as it will check the outer frame and see that
it is not processing any events.

JavaScriptCore:

  • interpreter/Interpreter.cpp:
  • runtime/JSGlobalObject.h: (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):

WebCore:

  • bindings/js/JSEventListener.cpp: (WebCore::JSAbstractEventListener::handleEvent):

WebKitTools:

  • DumpRenderTree/mac/EventSendingController.h:
  • DumpRenderTree/mac/EventSendingController.mm: (+[EventSendingController isSelectorExcludedFromWebScript:]): Expose scheduleAsynchronousClick to JavaScript. (-[EventSendingController scheduleAsynchronousClick]): Add.

LayoutTests:

  • fast/events/popup-blocking-click-in-iframe-expected.txt: Added.
  • fast/events/popup-blocking-click-in-iframe.html: Added.
  • fast/events/resources/popup-blocking-click-in-iframe-otherFrame.html: Added.
  • platform/gtk/Skipped:
  • platform/qt/Skipped:
  • platform/win/Skipped:
Location:
trunk
Files:
3 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r39374 r39377  
     12008-12-18  Cameron Zwarich  <zwarich@apple.com>
     2
     3        Reviewed by Geoff Garen.
     4
     5        Bug 21855: REGRESSION (r37323): Gmail complains about popup blocking when opening a link
     6        <https://bugs.webkit.org/show_bug.cgi?id=21855>
     7        <rdar://problem/6278244>
     8
     9        Move DynamicGlobalObjectScope to JSGlobalObject.h so that it can be used
     10        from WebCore.
     11
     12        * interpreter/Interpreter.cpp:
     13        * runtime/JSGlobalObject.h:
     14        (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
     15        (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
     16
    1172008-12-17  Geoffrey Garen  <ggaren@apple.com>
    218
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r39374 r39377  
    865865}
    866866
    867 class DynamicGlobalObjectScope : Noncopyable {
    868 public:
    869     DynamicGlobalObjectScope(CallFrame* callFrame, JSGlobalObject* dynamicGlobalObject)
    870         : m_dynamicGlobalObjectSlot(callFrame->globalData().dynamicGlobalObject)
    871         , m_savedDynamicGlobalObject(m_dynamicGlobalObjectSlot)
    872     {
    873         m_dynamicGlobalObjectSlot = dynamicGlobalObject;
    874     }
    875 
    876     ~DynamicGlobalObjectScope()
    877     {
    878         m_dynamicGlobalObjectSlot = m_savedDynamicGlobalObject;
    879     }
    880 
    881 private:
    882     JSGlobalObject*& m_dynamicGlobalObjectSlot;
    883     JSGlobalObject* m_savedDynamicGlobalObject;
    884 };
    885 
    886867JSValue* Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValue** exception)
    887868{
  • trunk/JavaScriptCore/runtime/JSGlobalObject.h

    r39320 r39377  
    356356        return globalData().dynamicGlobalObject;
    357357    }
    358    
     358
     359    class DynamicGlobalObjectScope : Noncopyable {
     360    public:
     361        DynamicGlobalObjectScope(CallFrame* callFrame, JSGlobalObject* dynamicGlobalObject)
     362            : m_dynamicGlobalObjectSlot(callFrame->globalData().dynamicGlobalObject)
     363            , m_savedDynamicGlobalObject(m_dynamicGlobalObjectSlot)
     364        {
     365            m_dynamicGlobalObjectSlot = dynamicGlobalObject;
     366        }
     367
     368        ~DynamicGlobalObjectScope()
     369        {
     370            m_dynamicGlobalObjectSlot = m_savedDynamicGlobalObject;
     371        }
     372
     373    private:
     374        JSGlobalObject*& m_dynamicGlobalObjectSlot;
     375        JSGlobalObject* m_savedDynamicGlobalObject;
     376    };
     377
    359378} // namespace JSC
    360379
  • trunk/LayoutTests/ChangeLog

    r39375 r39377  
     12008-12-18  Cameron Zwarich  <zwarich@apple.com>
     2
     3        Reviewed by Geoff Garen.
     4
     5        Add tests for bug 21855: REGRESSION (r37323): Gmail complains about popup blocking when opening a link
     6        <https://bugs.webkit.org/show_bug.cgi?id=21855>
     7        <rdar://problem/6278244>
     8
     9        Since DumpRenderTree support was added in order to support these tests,
     10        they are skipped on non-Mac platforms.
     11
     12        * fast/events/popup-blocking-click-in-iframe-expected.txt: Added.
     13        * fast/events/popup-blocking-click-in-iframe.html: Added.
     14        * fast/events/resources/popup-blocking-click-in-iframe-otherFrame.html: Added.
     15        * platform/gtk/Skipped:
     16        * platform/qt/Skipped:
     17        * platform/win/Skipped:
     18
    1192008-12-18  Pamela Greene  <pam@chromium.org>
    220
  • trunk/LayoutTests/platform/gtk/Skipped

    r38784 r39377  
    21322132webarchive
    21332133
     2134# Needs scheduleAsynchronousClick method for EventSender
     2135fast/events/popup-blocking-click-in-iframe.html
     2136
    21342137# Tests in plugins/ directory
    21352138# Tests that need ObjC plugin
  • trunk/LayoutTests/platform/qt/Skipped

    r39359 r39377  
    77editing/selection/5354455-2.html
    88editing/selection/caret-and-focus-ring.html
     9fast/events/popup-blocking-click-in-iframe.html
    910
    1011# -------- crashes
  • trunk/LayoutTests/platform/win/Skipped

    r39191 r39377  
    360360http/tests/navigation/post-goback-repost-policy.html
    361361
     362# Needs scheduleAsynchronousClick method for EventSender
     363fast/events/popup-blocking-click-in-iframe.html
     364
    362365################################################################################
    363366######################### All of above may be related ##########################
  • trunk/WebCore/ChangeLog

    r39373 r39377  
     12008-12-18  Cameron Zwarich  <zwarich@apple.com>
     2
     3        Reviewed by Geoff Garen.
     4
     5        Bug 21855: REGRESSION (r37323): Gmail complains about popup blocking when opening a link
     6        <https://bugs.webkit.org/show_bug.cgi?id=21855>
     7        <rdar://problem/6278244>
     8
     9        If JavaScript is not currently executing, the handleEvent member function
     10        of JSAbstractEventListener should set the dynamic global object to the
     11        global object of the context in which the event occurred.
     12       
     13        If this is not set, then JavaScriptCore will simply take the global object
     14        of the context where the event handler function was created, which may be
     15        a different frame. This will cause the popup blocker to incorrectly block
     16        windows opened from onclick events inside of an iframe whose handler was
     17        created in the outer frame, as it will check the outer frame and see that
     18        it is not processing any events.
     19
     20        * bindings/js/JSEventListener.cpp:
     21        (WebCore::JSAbstractEventListener::handleEvent):
     22
    1232008-12-17  Simon Fraser  <simon.fraser@apple.com>
    224
  • trunk/WebCore/bindings/js/JSEventListener.cpp

    r38595 r39377  
    9696        globalObject->setCurrentEvent(event);
    9797
     98        // If this event handler is the first JavaScript to execute, then the
     99        // dynamic global object should be set to the global object of the
     100        // window in which the event occurred.
     101        JSGlobalData* globalData = globalObject->globalData();
     102        DynamicGlobalObjectScope globalObjectScope(exec, globalData->dynamicGlobalObject ? globalData->dynamicGlobalObject : globalObject);
     103
    98104        JSValue* retval;
    99105        if (handleEventFunction) {
  • trunk/WebKitTools/ChangeLog

    r39317 r39377  
     12008-12-18  Cameron Zwarich  <zwarich@apple.com>
     2
     3        Reviewed by Geoff Garen.
     4
     5        Add tests for bug 21855: REGRESSION (r37323): Gmail complains about popup blocking when opening a link
     6        <https://bugs.webkit.org/show_bug.cgi?id=21855>
     7        <rdar://problem/6278244>
     8
     9        Add support for scheduling asynchronous clicks to DumpRenderTree, but
     10        only on the Mac.
     11
     12        * DumpRenderTree/mac/EventSendingController.h:
     13        * DumpRenderTree/mac/EventSendingController.mm:
     14        (+[EventSendingController isSelectorExcludedFromWebScript:]): Expose
     15        scheduleAsynchronousClick to JavaScript.
     16        (-[EventSendingController scheduleAsynchronousClick]): Add.
     17
    1182008-12-15  Darin Adler  <darin@apple.com>
    219
  • trunk/WebKitTools/DumpRenderTree/mac/EventSendingController.h

    r34871 r39377  
    4444+ (void)clearSavedEvents;
    4545
     46- (void)scheduleAsynchronousClick;
     47
    4648- (void)enableDOMUIEventLogging:(WebScriptObject *)node;
    4749
  • trunk/WebKitTools/DumpRenderTree/mac/EventSendingController.mm

    r34874 r39377  
    122122            || aSelector == @selector(mouseUp:)
    123123            || aSelector == @selector(contextClick)
     124            || aSelector == @selector(scheduleAsynchronousClick)
    124125            || aSelector == @selector(mouseMoveToX:Y:)
    125126            || aSelector == @selector(leapForward:)
     
    404405}
    405406
     407- (void)scheduleAsynchronousClick
     408{
     409    [self performSelector:@selector(mouseDown:) withObject:nil afterDelay:0];
     410    [self performSelector:@selector(mouseUp:) withObject:nil afterDelay:0];
     411}
     412
    406413+ (void)saveEvent:(NSInvocation *)event
    407414{
Note: See TracChangeset for help on using the changeset viewer.