Changeset 57045 in webkit
- Timestamp:
- Apr 3, 2010 12:05:55 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r57044 r57045 1 2010-04-02 Andy Estes <aestes@apple.com> 2 3 Reviewed by Adam Barth. 4 5 Tests for https://bugs.webkit.org/show_bug.cgi?id=37008. 6 7 * fast/events/popup-allowed-from-gesture-initiated-event-expected.txt: Added. 8 * fast/events/popup-allowed-from-gesture-initiated-event.html: Added. 9 * fast/events/popup-blocked-from-fake-button-click-expected.txt: Added. 10 * fast/events/popup-blocked-from-fake-button-click.html: Added. 11 * fast/events/popup-blocked-from-fake-focus-expected.txt: Added. 12 * fast/events/popup-blocked-from-fake-focus.html: Added. 13 1 14 2010-04-02 Adam Barth <abarth@webkit.org> 2 15 -
trunk/WebCore/Android.mk
r56825 r57045 174 174 dom/UIEvent.cpp \ 175 175 dom/UIEventWithKeyState.cpp \ 176 dom/UserGestureIndicator.cpp \ 176 177 dom/WebKitAnimationEvent.cpp \ 177 178 dom/WebKitTransitionEvent.cpp \ -
trunk/WebCore/ChangeLog
r57041 r57045 1 2010-04-02 Andy Estes <aestes@apple.com> 2 3 Reviewed by Adam Barth. 4 5 The previous mechanism for testing whether an event was due to a user 6 gesture only checked the event type, not the source of the event. This 7 allowed scripts to defeat popup blocking by programatically emitting 8 certain types of events. 9 10 Change the user gesture detection to check for a flag that is only set 11 when the event in question was generated through the platform and not 12 through the DOM. 13 14 https://bugs.webkit.org/show_bug.cgi?id=37008 15 16 Tests: fast/events/popup-allowed-from-gesture-initiated-event.html 17 fast/events/popup-blocked-from-fake-button-click.html 18 fast/events/popup-blocked-from-fake-focus.html 19 20 * Android.mk: Add UserGestureIndicator.{cpp, h}. 21 * GNUmakefile.am: Same. 22 * WebCore.gypi: Same. 23 * WebCore.pro: Same. 24 * WebCore.vcproj/WebCore.vcproj: Same. 25 * WebCore.xcodeproj/project.pbxproj: Same. 26 * bindings/v8/ScriptController.cpp: 27 (WebCore::ScriptController::processingUserGesture): Check the value of 28 UserGesureIndicator::processingUserGesture(). 29 * dom/Document.cpp: 30 (WebCore::Document::createEvent): Remove call to 31 Event::setCreatedByDOM(). 32 * dom/Event.cpp: 33 (WebCore::Event::Event): Remove initializers for m_createdByDOM. 34 (WebCore::Event::fromUserGesture): Check the value of 35 UserGestureIndicator::processingUserGesture(). 36 * dom/Event.h: Remove m_createdByDOM. 37 * dom/UserGestureIndicator.cpp: Added. 38 (WebCore::UserGestureIndicator::UserGestureIndicator): Save the previous 39 value of s_processingUserGesture before setting it to true. 40 (WebCore::UserGestureIndicator::~UserGestureIndicator): Restore 41 s_processingUserGesture to its previous value. 42 * dom/UserGestureIndicator.h: Added. 43 (WebCore::UserGestureIndicator::processingUserGesture): Return the value 44 of s_processingUserGesture. 45 * page/EventHandler.cpp: 46 (WebCore::EventHandler::handleMousePressEvent): Instantiate a 47 UserGestureIndicator object on the stack to indicate a user gesture is 48 being processed. 49 (WebCore::EventHandler::handleMouseDoubleClickEvent): Same. 50 (WebCore::EventHandler::handleMouseReleaseEvent): Same. 51 (WebCore::EventHandler::keyEvent): Same. 52 (WebCore::EventHandler::handleTouchEvent): Same. 53 1 54 2010-04-02 Justin Schuh <jschuh@chromium.org> 2 55 -
trunk/WebCore/GNUmakefile.am
r56991 r57045 867 867 WebCore/dom/UIEventWithKeyState.cpp \ 868 868 WebCore/dom/UIEventWithKeyState.h \ 869 WebCore/dom/UserGestureIndicator.cpp \ 870 WebCore/dom/UserGestureIndicator.h \ 869 871 WebCore/dom/WebKitAnimationEvent.cpp \ 870 872 WebCore/dom/WebKitAnimationEvent.h \ -
trunk/WebCore/WebCore.gypi
r57028 r57045 1221 1221 'dom/UIEventWithKeyState.cpp', 1222 1222 'dom/UIEventWithKeyState.h', 1223 'dom/UserGestureIndicator.cpp', 1224 'dom/UserGestureIndicator.h', 1223 1225 'dom/WebKitAnimationEvent.cpp', 1224 1226 'dom/WebKitAnimationEvent.h', -
trunk/WebCore/WebCore.pro
r56968 r57045 539 539 dom/UIEvent.cpp \ 540 540 dom/UIEventWithKeyState.cpp \ 541 dom/UserGestureIndicator.cpp \ 541 542 dom/WebKitAnimationEvent.cpp \ 542 543 dom/WebKitTransitionEvent.cpp \ … … 1251 1252 dom/UIEvent.h \ 1252 1253 dom/UIEventWithKeyState.h \ 1254 dom/UserGestureIndicator.h \ 1253 1255 dom/WebKitAnimationEvent.h \ 1254 1256 dom/WebKitTransitionEvent.h \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r56991 r57045 29486 29486 </File> 29487 29487 <File 29488 RelativePath="..\dom\UserGestureIndicator.cpp" 29489 > 29490 </File> 29491 <File 29492 RelativePath="..\dom\UserGestureIndicator.h" 29493 > 29494 </File> 29495 <File 29488 29496 RelativePath="..\dom\WebKitAnimationEvent.cpp" 29489 29497 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r56991 r57045 560 560 24F54EAC101FE914000AE741 /* ApplicationCacheHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 24F54EAA101FE914000AE741 /* ApplicationCacheHost.cpp */; }; 561 561 24F54EAD101FE914000AE741 /* ApplicationCacheHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */; settings = {ATTRIBUTES = (); }; }; 562 2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */; }; 563 2542F4DB1166C25A00E89A86 /* UserGestureIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */; }; 562 564 29A812260FBB9C1D00510293 /* AccessibilityRenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A812080FBB9C1D00510293 /* AccessibilityRenderObject.cpp */; }; 563 565 29A812270FBB9C1D00510293 /* AccessibilityTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A812090FBB9C1D00510293 /* AccessibilityTable.cpp */; }; … … 5953 5955 24F54EAA101FE914000AE741 /* ApplicationCacheHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplicationCacheHost.cpp; sourceTree = "<group>"; }; 5954 5956 24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationCacheHost.h; sourceTree = "<group>"; }; 5957 2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserGestureIndicator.cpp; sourceTree = "<group>"; }; 5958 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserGestureIndicator.h; sourceTree = "<group>"; }; 5955 5959 29A812080FBB9C1D00510293 /* AccessibilityRenderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityRenderObject.cpp; sourceTree = "<group>"; }; 5956 5960 29A812090FBB9C1D00510293 /* AccessibilityTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityTable.cpp; sourceTree = "<group>"; }; … … 16223 16227 93354A3B0B24F8C9003F6DEA /* UIEventWithKeyState.cpp */, 16224 16228 85031B390A44EFC700F992E0 /* UIEventWithKeyState.h */, 16229 2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */, 16230 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */, 16225 16231 31C0FF1B0E4CEB6E007D6FE5 /* WebKitAnimationEvent.cpp */, 16226 16232 31C0FF1C0E4CEB6E007D6FE5 /* WebKitAnimationEvent.h */, … … 18780 18786 8952535311641B3400CABF00 /* FileThread.h in Headers */, 18781 18787 97C078501165D5BE003A32EF /* SuffixTree.h in Headers */, 18788 2542F4DB1166C25A00E89A86 /* UserGestureIndicator.h in Headers */, 18782 18789 ); 18783 18790 runOnlyForDeploymentPostprocessing = 0; … … 20995 21002 2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */, 20996 21003 8952535211641B3400CABF00 /* FileThread.cpp in Sources */, 21004 2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */, 20997 21005 ); 20998 21006 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/v8/ScriptController.cpp
r56825 r57045 48 48 #include "ScriptSourceCode.h" 49 49 #include "Settings.h" 50 #include "UserGestureIndicator.h" 50 51 #include "V8Binding.h" 51 52 #include "V8BindingState.h" … … 177 178 // Note: This is more liberal than Firefox's implementation. 178 179 if (event) { 179 if ( event->createdByDOM())180 if (!UserGestureIndicator::processingUserGesture()) 180 181 return false; 181 182 -
trunk/WebCore/dom/Document.cpp
r57012 r57045 3062 3062 event = TouchEvent::create(); 3063 3063 #endif 3064 if (event) { 3065 event->setCreatedByDOM(true); 3064 if (event) 3066 3065 return event.release(); 3067 } 3066 3068 3067 ec = NOT_SUPPORTED_ERR; 3069 3068 return 0; -
trunk/WebCore/dom/Event.cpp
r56445 r57045 25 25 26 26 #include "AtomicString.h" 27 #include "UserGestureIndicator.h" 27 28 #include <wtf/CurrentTime.h> 28 29 … … 37 38 , m_defaultHandled(false) 38 39 , m_cancelBubble(false) 39 , m_createdByDOM(false)40 40 , m_eventPhase(0) 41 41 , m_currentTarget(0) … … 53 53 , m_defaultHandled(false) 54 54 , m_cancelBubble(false) 55 , m_createdByDOM(false)56 55 , m_eventPhase(0) 57 56 , m_currentTarget(0) … … 204 203 bool Event::fromUserGesture() 205 204 { 206 if ( createdByDOM())205 if (!UserGestureIndicator::processingUserGesture()) 207 206 return false; 208 207 -
trunk/WebCore/dom/Event.h
r56445 r57045 159 159 virtual Clipboard* clipboard() const { return 0; } 160 160 161 bool createdByDOM() const { return m_createdByDOM; }162 void setCreatedByDOM(bool createdByDOM) { m_createdByDOM = createdByDOM; }163 164 161 protected: 165 162 Event(); … … 180 177 bool m_cancelBubble; 181 178 182 // Whether this event was created by document.createEvent().183 bool m_createdByDOM;184 185 179 unsigned short m_eventPhase; 186 180 EventTarget* m_currentTarget; -
trunk/WebCore/page/EventHandler.cpp
r56567 r57045 67 67 #include "Settings.h" 68 68 #include "TextEvent.h" 69 #include "UserGestureIndicator.h" 69 70 #include "WheelEvent.h" 70 71 #include "htmlediting.h" // for comparePositions() … … 1166 1167 { 1167 1168 RefPtr<FrameView> protector(m_frame->view()); 1168 1169 1170 UserGestureIndicator gestureIndicator; 1171 1169 1172 cancelFakeMouseMoveEvent(); 1170 1173 m_mousePressed = true; … … 1295 1298 { 1296 1299 RefPtr<FrameView> protector(m_frame->view()); 1300 1301 UserGestureIndicator gestureIndicator; 1297 1302 1298 1303 // We get this instead of a second mouse-up … … 1462 1467 { 1463 1468 RefPtr<FrameView> protector(m_frame->view()); 1469 1470 UserGestureIndicator gestureIndicator; 1464 1471 1465 1472 #if ENABLE(PAN_SCROLLING) … … 2121 2128 if (!node) 2122 2129 return false; 2130 2131 UserGestureIndicator gestureIndicator; 2123 2132 2124 2133 if (FrameView* view = m_frame->view()) … … 2688 2697 const Vector<PlatformTouchPoint>& points = event.touchPoints(); 2689 2698 AtomicString* eventName = 0; 2699 2700 UserGestureIndicator gestureIndicator; 2690 2701 2691 2702 for (unsigned i = 0; i < points.size(); ++i) {
Note: See TracChangeset
for help on using the changeset viewer.