Changeset 92982 in webkit
- Timestamp:
- Aug 12, 2011 12:56:56 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r92981 r92982 1 2011-08-12 Andy Estes <aestes@apple.com> 2 3 Cancel in onbeforeunload dialog sometime causes a button to stop working. 4 https://bugs.webkit.org/show_bug.cgi?id=26211 5 6 Reviewed by Alexey Proskuryakov. 7 8 * fast/loader/form-submission-after-beforeunload-cancel-expected.txt: Added. 9 * fast/loader/form-submission-after-beforeunload-cancel.html: Added. 10 1 11 2011-08-12 David Hyatt <hyatt@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r92981 r92982 1 2011-08-12 Andy Estes <aestes@apple.com> 2 3 Cancel in onbeforeunload dialog sometime causes a button to stop working. 4 https://bugs.webkit.org/show_bug.cgi?id=26211 5 6 Reviewed by Alexey Proskuryakov. 7 8 Test: fast/loader/form-submission-after-beforeunload-cancel.html 9 10 If an onbeforeunload handler cancels a navigation that was triggered by 11 a form submission, WebCore's multiple form submission protection 12 prevents the form from being submitted a second time even though no 13 first submission actually took place. Fix this by clearing 14 m_submittedFormURL if the onbeforeunload handler cancels the load. This 15 allows the submission to be retried. 16 17 * loader/FrameLoader.cpp: 18 (WebCore::FrameLoader::shouldClose): Set m_submittedFormURL to KURL() 19 if shouldClose() will return false. 20 1 21 2011-08-12 David Hyatt <hyatt@apple.com> 2 22 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r92623 r92982 2733 2733 } 2734 2734 2735 if (!shouldClose) 2736 m_submittedFormURL = KURL(); 2737 2735 2738 return shouldClose; 2736 2739 } -
trunk/Tools/ChangeLog
r92974 r92982 1 2011-08-12 Andy Estes <aestes@apple.com> 2 3 Cancel in onbeforeunload dialog sometime causes a button to stop working. 4 https://bugs.webkit.org/show_bug.cgi?id=26211 5 6 Reviewed by Alexey Proskuryakov. 7 8 Implement a new LayoutTestController method that a test can call to set 9 the return value of DumpRenderTree's beforeunload UI delegate. 10 11 * DumpRenderTree/LayoutTestController.cpp: 12 (LayoutTestController::LayoutTestController): Initialize 13 m_shouldStayOnPageAfterHandlingBeforeUnload. 14 (setShouldStayOnPageAfterHandlingBeforeUnloadCallback): Call 15 LayoutTestController::setShouldStayOnPageAfterHandlingBeforeUnload(). 16 (LayoutTestController::staticFunctions): Register 17 'setShouldStayOnPageAfterHandlingBeforeUnload' as a static function. 18 * DumpRenderTree/LayoutTestController.h: 19 (LayoutTestController::shouldStayOnPageAfterHandlingBeforeUnload): 20 (LayoutTestController::setShouldStayOnPageAfterHandlingBeforeUnload): 21 * DumpRenderTree/chromium/LayoutTestController.cpp: 22 (LayoutTestController::LayoutTestController): Initialize 23 m_shouldStayOnPageAfterHandlingBeforeUnload and bind 24 'setShouldStayOnPageAfterHandlingBeforeUnload' to its c++ setter. 25 (LayoutTestController::reset): Reset 26 m_shouldStayOnPageAfterHandlingBeforeUnload to false. 27 (LayoutTestController::setShouldStayOnPageAfterHandlingBeforeUnload): 28 Set m_shouldStayOnPageAfterHandlingBeforeUnload to the value passed in 29 from JavaScript. 30 * DumpRenderTree/chromium/LayoutTestController.h: 31 (LayoutTestController::shouldStayOnPageAfterHandlingBeforeUnload): 32 * DumpRenderTree/chromium/WebViewHost.cpp: 33 (WebViewHost::runModalBeforeUnloadDialog): Add the correct logging and 34 return the inverse of 35 LayoutTestController::shouldStayOnPageAfterHandlingBeforeUnload(). 36 * DumpRenderTree/mac/UIDelegate.mm: 37 (-[UIDelegate webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:]): Ditto. 38 * DumpRenderTree/win/UIDelegate.cpp: 39 (UIDelegate::runBeforeUnloadConfirmPanelWithMessage): Ditto. 40 * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: 41 Define setShouldStayOnPageAfterHandlingBeforeUnload(). 42 * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: 43 (WTR::InjectedBundle::postNewBeforeUnloadReturnValue): Post a message 44 to the Test Controller telling it what value it should return in its 45 onbeforeunload UI delegate. 46 * WebKitTestRunner/InjectedBundle/InjectedBundle.h: 47 * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: 48 (WTR::LayoutTestController::setShouldStayOnPageAfterHandlingBeforeUnload): 49 Call InjectedBundle::postNewBeforeUnloadReturnValue(). 50 * WebKitTestRunner/InjectedBundle/LayoutTestController.h: 51 * WebKitTestRunner/TestController.cpp: 52 (WTR::TestController::TestController): Initialize 53 m_beforeUnloadReturnValue to true. 54 (WTR::runBeforeUnloadConfirmPanel): Add the correct logging and return 55 the value of TestController::beforeUnloadReturnValue(). 56 (WTR::TestController::resetStateToConsistentValues): Reset 57 m_beforeUnloadReturnValue to true. 58 * WebKitTestRunner/TestController.h: 59 (WTR::TestController::beforeUnloadReturnValue): 60 (WTR::TestController::setBeforeUnloadReturnValue): 61 * WebKitTestRunner/TestInvocation.cpp: 62 (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Handle the 63 message posted from the injected bundle by retrieving the message body 64 as a WKBoolean and calling TestController::setBeforeUnloadReturnValue(). 65 1 66 2011-08-12 Sam Weinig <sam@webkit.org> 2 67 -
trunk/Tools/DumpRenderTree/LayoutTestController.cpp
r90856 r92982 88 88 , m_deferMainResourceDataLoad(true) 89 89 , m_shouldPaintBrokenImage(true) 90 , m_shouldStayOnPageAfterHandlingBeforeUnload(false) 90 91 , m_testPathOrURL(testPathOrURL) 91 92 , m_expectedPixelHash(expectedPixelHash) … … 2138 2139 2139 2140 controller->allowRoundingHacks(); 2141 return JSValueMakeUndefined(context); 2142 } 2143 2144 static JSValueRef setShouldStayOnPageAfterHandlingBeforeUnloadCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 2145 { 2146 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2147 2148 if (argumentCount == 1) 2149 controller->setShouldStayOnPageAfterHandlingBeforeUnload(JSValueToBoolean(context, arguments[0])); 2150 2140 2151 return JSValueMakeUndefined(context); 2141 2152 } … … 2415 2426 { "setTextDirection", setTextDirectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2416 2427 { "allowRoundingHacks", allowRoundingHacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2428 { "setShouldStayOnPageAfterHandlingBeforeUnload", setShouldStayOnPageAfterHandlingBeforeUnloadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2417 2429 { 0, 0, 0 } 2418 2430 }; -
trunk/Tools/DumpRenderTree/LayoutTestController.h
r90856 r92982 308 308 void allowRoundingHacks(); 309 309 310 bool shouldStayOnPageAfterHandlingBeforeUnload() const { return m_shouldStayOnPageAfterHandlingBeforeUnload; } 311 void setShouldStayOnPageAfterHandlingBeforeUnload(bool shouldStayOnPageAfterHandlingBeforeUnload) { m_shouldStayOnPageAfterHandlingBeforeUnload = shouldStayOnPageAfterHandlingBeforeUnload; } 312 310 313 void setPOSIXLocale(JSStringRef locale); 311 314 … … 399 402 bool m_deferMainResourceDataLoad; 400 403 bool m_shouldPaintBrokenImage; 404 bool m_shouldStayOnPageAfterHandlingBeforeUnload; 401 405 402 406 std::string m_authenticationUsername; -
trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
r92219 r92982 78 78 , m_showDebugLayerTree(false) 79 79 , m_workQueue(this) 80 , m_shouldStayOnPageAfterHandlingBeforeUnload(false) 80 81 { 81 82 … … 220 221 bindMethod("observeStorageTrackerNotifications", &LayoutTestController::observeStorageTrackerNotifications); 221 222 bindMethod("syncLocalStorage", &LayoutTestController::syncLocalStorage); 223 bindMethod("setShouldStayOnPageAfterHandlingBeforeUnload", &LayoutTestController::setShouldStayOnPageAfterHandlingBeforeUnload); 222 224 223 225 // The fallback method is called when an unknown method is invoked. … … 612 614 m_workQueue.reset(); 613 615 m_taskList.revokeAll(); 616 m_shouldStayOnPageAfterHandlingBeforeUnload = false; 614 617 } 615 618 … … 1807 1810 } 1808 1811 1812 void LayoutTestController::setShouldStayOnPageAfterHandlingBeforeUnload(const CppArgumentList& arguments, CppVariant* result) 1813 { 1814 if (arguments.size() == 1 && arguments[0].isBool()) 1815 m_shouldStayOnPageAfterHandlingBeforeUnload = arguments[0].toBoolean(); 1816 1817 result->setNull(); 1818 } 1819 1809 1820 void LayoutTestController::setPluginsEnabled(const CppArgumentList& arguments, CppVariant* result) 1810 1821 { -
trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h
r92219 r92982 394 394 // Changes the direction of the focused element. 395 395 void setTextDirection(const CppArgumentList&, CppVariant*); 396 397 void setShouldStayOnPageAfterHandlingBeforeUnload(const CppArgumentList&, CppVariant*); 396 398 397 399 public: … … 456 458 TaskList* taskList() { return &m_taskList; } 457 459 460 bool shouldStayOnPageAfterHandlingBeforeUnload() const { return m_shouldStayOnPageAfterHandlingBeforeUnload; } 461 458 462 private: 459 463 friend class WorkItem; … … 624 628 // WAV audio data is stored here. 625 629 WebKit::WebArrayBufferView m_audioData; 630 631 bool m_shouldStayOnPageAfterHandlingBeforeUnload; 626 632 }; 627 633 -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp
r92420 r92982 482 482 } 483 483 484 bool WebViewHost::runModalBeforeUnloadDialog(WebFrame*, const WebString&) 485 { 486 return true; // Allow window closure. 484 bool WebViewHost::runModalBeforeUnloadDialog(WebFrame*, const WebString& message) 485 { 486 printf("CONFIRM NAVIGATION: %s\n", message.utf8().data()); 487 return !layoutTestController()->shouldStayOnPageAfterHandlingBeforeUnload(); 487 488 } 488 489 -
trunk/Tools/DumpRenderTree/mac/UIDelegate.mm
r90946 r92982 108 108 if (!done) 109 109 printf("CONFIRM NAVIGATION: %s\n", [message UTF8String]); 110 return YES; 110 111 return !gLayoutTestController->shouldStayOnPageAfterHandlingBeforeUnload(); 111 112 } 112 113 -
trunk/Tools/DumpRenderTree/win/UIDelegate.cpp
r85443 r92982 466 466 HRESULT STDMETHODCALLTYPE UIDelegate::runBeforeUnloadConfirmPanelWithMessage( 467 467 /* [in] */ IWebView* /*sender*/, 468 /* [in] */ BSTR /*message*/,468 /* [in] */ BSTR message, 469 469 /* [in] */ IWebFrame* /*initiatedByFrame*/, 470 470 /* [retval][out] */ BOOL* result) … … 472 472 if (!result) 473 473 return E_POINTER; 474 *result = TRUE; 475 return E_NOTIMPL; 474 printf("CONFIRM NAVIGATION: %S\n", message ? message : L""); 475 *result = !gLayoutTestController->shouldStayOnPageAfterHandlingBeforeUnload(); 476 return S_OK; 476 477 } 477 478 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
r92839 r92982 113 113 114 114 void setWillSendRequestReturnsNull(in boolean flag); 115 116 void setShouldStayOnPageAfterHandlingBeforeUnload(in boolean flag); 115 117 }; 116 118 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
r90163 r92982 233 233 m_pages[i]->dumpBackForwardList(); 234 234 } 235 236 void InjectedBundle::postNewBeforeUnloadReturnValue(bool value) 237 { 238 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("BeforeUnloadReturnValue")); 239 WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value)); 240 WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); 241 } 235 242 236 243 } // namespace WTR -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
r81494 r92982 72 72 73 73 bool shouldDumpPixels() const { return m_dumpPixels; } 74 75 void postNewBeforeUnloadReturnValue(bool); 74 76 75 77 private: -
trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
r92839 r92982 494 494 return WKBundleFrameSetTextDirection(mainFrame, toWK(direction).get()); 495 495 } 496 497 void LayoutTestController::setShouldStayOnPageAfterHandlingBeforeUnload(bool shouldStayOnPage) 498 { 499 InjectedBundle::shared().postNewBeforeUnloadReturnValue(!shouldStayOnPage); 500 } 496 501 497 502 } // namespace WTR -
trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
r92839 r92982 169 169 void setTextDirection(JSStringRef); 170 170 171 void setShouldStayOnPageAfterHandlingBeforeUnload(bool); 172 171 173 private: 172 174 static const double waitToDumpWatchdogTimerInterval; -
trunk/Tools/WebKitTestRunner/TestController.cpp
r91794 r92982 69 69 , m_didPrintWebProcessCrashedMessage(false) 70 70 , m_shouldExitWhenWebProcessCrashes(true) 71 , m_beforeUnloadReturnValue(true) 71 72 { 72 73 initialize(argc, argv); … … 106 107 static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo) 107 108 { 108 printf("%s\n", toSTD(message).c_str()); 109 return true; 109 TestController* testController = static_cast<TestController*>(const_cast<void*>(clientInfo)); 110 printf("CONFIRM NAVIGATION: %s\n", toSTD(message).c_str()); 111 return testController->beforeUnloadReturnValue(); 110 112 } 111 113 … … 359 361 { 360 362 m_state = Resetting; 363 364 m_beforeUnloadReturnValue = true; 361 365 362 366 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("Reset")); -
trunk/Tools/WebKitTestRunner/TestController.h
r84534 r92982 57 57 void runUntil(bool& done, TimeoutDuration); 58 58 void notifyDone(); 59 60 bool beforeUnloadReturnValue() const { return m_beforeUnloadReturnValue; } 61 void setBeforeUnloadReturnValue(bool value) { m_beforeUnloadReturnValue = value; } 59 62 60 63 private: … … 122 125 bool m_didPrintWebProcessCrashedMessage; 123 126 bool m_shouldExitWhenWebProcessCrashes; 127 128 bool m_beforeUnloadReturnValue; 124 129 }; 125 130 -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r89426 r92982 239 239 return; 240 240 } 241 242 if (WKStringIsEqualToUTF8CString(messageName, "BeforeUnloadReturnValue")) { 243 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); 244 WKBooleanRef beforeUnloadReturnValue = static_cast<WKBooleanRef>(messageBody); 245 TestController::shared().setBeforeUnloadReturnValue(WKBooleanGetValue(beforeUnloadReturnValue)); 246 return; 247 } 241 248 242 249 ASSERT_NOT_REACHED();
Note: See TracChangeset
for help on using the changeset viewer.