Changeset 185915 in webkit
- Timestamp:
- Jun 24, 2015, 9:57:30 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r185905 r185915 1 2015-06-24 Brady Eidson <beidson@apple.com> 2 3 Update JavaScript dialog delegates to include a WKSecurityOriginRef argument. 4 <rdar://problem/21269187> and https://bugs.webkit.org/show_bug.cgi?id=146249 5 6 Reviewed by Alex Christensen. 7 8 * UIProcess/API/C/WKPage.cpp: 9 (WKPageSetPageUIClient): Call the new signature if the client has it set. 10 Otherwise fall back to the old signature. 11 * UIProcess/API/C/WKPageUIClient.h: Deprecate the old method signature, and add the new 12 one to the newest V5 client structure. 13 1 14 2015-06-24 Ryuan Choi <ryuan.choi@navercorp.com> 2 15 -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r185877 r185915 1409 1409 } 1410 1410 1411 virtual void runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame, const SecurityOriginData& , std::function<void ()> completionHandler) override1412 { 1413 if (!m_client.runJavaScriptAlert ) {1411 virtual void runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame, const SecurityOriginData& securityOriginData, std::function<void ()> completionHandler) override 1412 { 1413 if (!m_client.runJavaScriptAlert && !m_client.runJavaScriptAlert_deprecatedForUseWithV0) { 1414 1414 completionHandler(); 1415 1415 return; 1416 1416 } 1417 1417 1418 m_client.runJavaScriptAlert(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); 1418 if (m_client.runJavaScriptAlert) { 1419 RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(securityOriginData.protocol, securityOriginData.host, securityOriginData.port); 1420 m_client.runJavaScriptAlert(toAPI(page), toAPI(message.impl()), toAPI(frame), toAPI(securityOrigin.get()), m_client.base.clientInfo); 1421 } else 1422 m_client.runJavaScriptAlert_deprecatedForUseWithV0(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); 1423 1419 1424 completionHandler(); 1420 1425 } 1421 1426 1422 virtual void runJavaScriptConfirm(WebPageProxy* page, const String& message, WebFrameProxy* frame, const SecurityOriginData& , std::function<void (bool)> completionHandler) override1423 { 1424 if (!m_client.runJavaScriptConfirm ) {1427 virtual void runJavaScriptConfirm(WebPageProxy* page, const String& message, WebFrameProxy* frame, const SecurityOriginData& securityOriginData, std::function<void (bool)> completionHandler) override 1428 { 1429 if (!m_client.runJavaScriptConfirm && !m_client.runJavaScriptConfirm_deprecatedForUseWithV0) { 1425 1430 completionHandler(false); 1426 1431 return; 1427 1432 } 1428 1433 1429 bool result = m_client.runJavaScriptConfirm(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); 1434 bool result; 1435 if (m_client.runJavaScriptConfirm) { 1436 RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(securityOriginData.protocol, securityOriginData.host, securityOriginData.port); 1437 result = m_client.runJavaScriptConfirm(toAPI(page), toAPI(message.impl()), toAPI(frame), toAPI(securityOrigin.get()), m_client.base.clientInfo); 1438 } else 1439 result = m_client.runJavaScriptConfirm_deprecatedForUseWithV0(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); 1440 1430 1441 completionHandler(result); 1431 1442 } 1432 1443 1433 virtual void runJavaScriptPrompt(WebPageProxy* page, const String& message, const String& defaultValue, WebFrameProxy* frame, const SecurityOriginData& , std::function<void (const String&)> completionHandler) override1434 { 1435 if (!m_client.runJavaScriptPrompt ) {1444 virtual void runJavaScriptPrompt(WebPageProxy* page, const String& message, const String& defaultValue, WebFrameProxy* frame, const SecurityOriginData& securityOriginData, std::function<void (const String&)> completionHandler) override 1445 { 1446 if (!m_client.runJavaScriptPrompt && !m_client.runJavaScriptPrompt_deprecatedForUseWithV0) { 1436 1447 completionHandler(String()); 1437 1448 return; 1438 1449 } 1439 1450 1440 RefPtr<API::String> string = adoptRef(toImpl(m_client.runJavaScriptPrompt(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), m_client.base.clientInfo))); 1451 RefPtr<API::String> string; 1452 if (m_client.runJavaScriptPrompt) { 1453 RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(securityOriginData.protocol, securityOriginData.host, securityOriginData.port); 1454 string = adoptRef(toImpl(m_client.runJavaScriptPrompt(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), toAPI(securityOrigin.get()), m_client.base.clientInfo))); 1455 } else 1456 string = adoptRef(toImpl(m_client.runJavaScriptPrompt_deprecatedForUseWithV0(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), m_client.base.clientInfo))); 1457 1441 1458 if (!string) { 1442 1459 completionHandler(String()); -
trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h
r185721 r185915 51 51 typedef void (*WKPageUIClientCallback)(WKPageRef page, const void* clientInfo); 52 52 typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo); 53 typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo);54 typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);55 typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo);53 typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo); 54 typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo); 55 typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo); 56 56 typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo); 57 57 typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo); … … 98 98 typedef void (*WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo); 99 99 typedef void (*WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo); 100 typedef void (*WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo); 101 typedef bool (*WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); 102 typedef WKStringRef (*WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo); 100 103 101 104 typedef struct WKPageUIClientBase { … … 114 117 WKPageFocusCallback focus; 115 118 WKPageUnfocusCallback unfocus; 116 WKPageRunJavaScriptAlertCallback runJavaScriptAlert;117 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm;118 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt;119 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; 120 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; 121 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; 119 122 WKPageSetStatusTextCallback setStatusText; 120 123 WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; … … 159 162 WKPageFocusCallback focus; 160 163 WKPageUnfocusCallback unfocus; 161 WKPageRunJavaScriptAlertCallback runJavaScriptAlert;162 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm;163 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt;164 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; 165 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; 166 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; 164 167 WKPageSetStatusTextCallback setStatusText; 165 168 WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; … … 210 213 WKPageFocusCallback focus; 211 214 WKPageUnfocusCallback unfocus; 212 WKPageRunJavaScriptAlertCallback runJavaScriptAlert;213 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm;214 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt;215 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; 216 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; 217 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; 215 218 WKPageSetStatusTextCallback setStatusText; 216 219 WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; … … 266 269 WKPageFocusCallback focus; 267 270 WKPageUnfocusCallback unfocus; 268 WKPageRunJavaScriptAlertCallback runJavaScriptAlert;269 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm;270 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt;271 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; 272 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; 273 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; 271 274 WKPageSetStatusTextCallback setStatusText; 272 275 WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; … … 325 328 WKPageFocusCallback focus; 326 329 WKPageUnfocusCallback unfocus; 327 WKPageRunJavaScriptAlertCallback runJavaScriptAlert;328 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm;329 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt;330 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; 331 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; 332 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; 330 333 WKPageSetStatusTextCallback setStatusText; 331 334 WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; … … 390 393 WKPageFocusCallback focus; 391 394 WKPageUnfocusCallback unfocus; 392 WKPageRunJavaScriptAlertCallback runJavaScriptAlert;393 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm;394 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt;395 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; 396 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; 397 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; 395 398 WKPageSetStatusTextCallback setStatusText; 396 399 WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; … … 447 450 WKPageDecidePolicyForUserMediaPermissionRequestCallback decidePolicyForUserMediaPermissionRequest; 448 451 WKPageDidClickAutoFillButtonCallback didClickAutoFillButton; 452 WKPageRunJavaScriptAlertCallback runJavaScriptAlert; 453 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; 454 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; 449 455 } WKPageUIClientV5; 450 456 … … 461 467 WKPageFocusCallback focus; 462 468 WKPageUnfocusCallback unfocus; 463 WKPageRunJavaScriptAlertCallback runJavaScriptAlert;464 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm;465 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt;469 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; 470 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; 471 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; 466 472 WKPageSetStatusTextCallback setStatusText; 467 473 WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; -
trunk/Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp
r185496 r185915 61 61 uiClient.focus = focus; 62 62 uiClient.unfocus = unfocus; 63 uiClient.runJavaScriptAlert = runJavaScriptAlert;64 uiClient.runJavaScriptConfirm = runJavaScriptConfirm;65 uiClient.runJavaScriptPrompt = runJavaScriptPrompt;63 uiClient.runJavaScriptAlert_deprecatedForUseWithV0 = runJavaScriptAlert; 64 uiClient.runJavaScriptConfirm_deprecatedForUseWithV0 = runJavaScriptConfirm; 65 uiClient.runJavaScriptPrompt_deprecatedForUseWithV0 = runJavaScriptPrompt; 66 66 uiClient.toolbarsAreVisible = toolbarsAreVisible; 67 67 uiClient.setToolbarsAreVisible = setToolbarsAreVisible; -
trunk/Tools/ChangeLog
r185898 r185915 1 2015-06-24 Brady Eidson <beidson@apple.com> 2 3 Update JavaScript dialog delegates to include a WKSecurityOriginRef argument. 4 <rdar://problem/21269187> and https://bugs.webkit.org/show_bug.cgi?id=146249 5 6 Reviewed by Alex Christensen. 7 8 - Update WKTR to the new client structure. 9 - Update existing TestWebKitAPI tests to either use the new client structure or 10 assign the old function signature to the updated variable name. 11 - Include a new test. 12 13 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 14 15 * TestWebKitAPI/Tests/WebKit2/CloseFromWithinCreatePage.cpp: 16 (TestWebKitAPI::runJavaScriptAlert): 17 18 * TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp: 19 (TestWebKitAPI::TEST): 20 21 * TestWebKitAPI/Tests/WebKit2/ModalAlertsSPI.cpp: 22 (TestWebKitAPI::analyzeDialogArguments): 23 (TestWebKitAPI::runJavaScriptAlert): 24 (TestWebKitAPI::runJavaScriptConfirm): 25 (TestWebKitAPI::runJavaScriptPrompt): 26 (TestWebKitAPI::createNewPage): 27 (TestWebKitAPI::TEST): 28 29 * TestWebKitAPI/Tests/mac/FullscreenZoomInitialFrame.mm: 30 (TestWebKitAPI::FullscreenZoomInitialFrame::initializeView): 31 32 * TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm: 33 (TestWebKitAPI::PageVisibilityStateWithWindowChanges::initializeView): 34 35 * WebKitTestRunner/TestController.cpp: 36 (WTR::TestController::createOtherPage): 37 (WTR::TestController::createWebViewWithOptions): 38 1 39 2015-06-23 Dewei Zhu <dewei_zhu@apple.com> 2 40 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r185877 r185915 52 52 5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */; }; 53 53 517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */; }; 54 51CB4AD81B3A079C00C1B1C6 /* ModalAlertsSPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CB4AD71B3A079C00C1B1C6 /* ModalAlertsSPI.cpp */; }; 54 55 51CD1C6C1B38CE4300142CA5 /* ModalAlerts.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */; }; 55 56 51CD1C721B38D48400142CA5 /* modal-alerts-in-new-about-blank-window.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51CD1C711B38D48400142CA5 /* modal-alerts-in-new-about-blank-window.html */; }; … … 520 521 517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCachePruneWithinResourceLoadDelegate.mm; sourceTree = "<group>"; }; 521 522 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCachePruneWithinResourceLoadDelegate.html; sourceTree = "<group>"; }; 523 51CB4AD71B3A079C00C1B1C6 /* ModalAlertsSPI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModalAlertsSPI.cpp; sourceTree = "<group>"; }; 522 524 51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ModalAlerts.mm; sourceTree = "<group>"; }; 523 525 51CD1C711B38D48400142CA5 /* modal-alerts-in-new-about-blank-window.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "modal-alerts-in-new-about-blank-window.html"; sourceTree = "<group>"; }; … … 1006 1008 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */, 1007 1009 8AA28C1916D2FA7B002FF4DB /* LoadPageOnCrash.cpp */, 1010 51CB4AD71B3A079C00C1B1C6 /* ModalAlertsSPI.cpp */, 1008 1011 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */, 1009 1012 33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */, … … 1627 1630 41973B5B1AF2286A006C7B36 /* FileSystem.cpp in Sources */, 1628 1631 7A5623111AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp in Sources */, 1632 51CB4AD81B3A079C00C1B1C6 /* ModalAlertsSPI.cpp in Sources */, 1629 1633 26F6E1F01ADC749B00DE696B /* DFAMinimizer.cpp in Sources */, 1630 1634 260BA5791B1D2E7B004FA07C /* DFACombiner.cpp in Sources */, -
trunk/Tools/TestWebKitAPI/Tests/WebKit2/CloseFromWithinCreatePage.cpp
r177506 r185915 36 36 static std::unique_ptr<PlatformWebView> openedWebView; 37 37 38 static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)38 static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef, const void* clientInfo) 39 39 { 40 40 // FIXME: Check that the alert text matches the storage. -
trunk/Tools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp
r177506 r185915 37 37 static bool done; 38 38 39 static void runJavaScriptAlert (WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)39 static void runJavaScriptAlert_deprecatedForUseWithV0(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo) 40 40 { 41 41 ASSERT_NOT_NULL(frame); … … 58 58 59 59 uiClient.base.version = 0; 60 uiClient.runJavaScriptAlert = runJavaScriptAlert;60 uiClient.runJavaScriptAlert_deprecatedForUseWithV0 = runJavaScriptAlert_deprecatedForUseWithV0; 61 61 62 62 WKPageSetPageUIClient(webView.page(), &uiClient.base); -
trunk/Tools/TestWebKitAPI/Tests/WebKit2/ModalAlertsSPI.cpp
r185914 r185915 1 1 /* 2 * Copyright (C) 201 4Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #include "PlatformUtilities.h" 31 31 #include "PlatformWebView.h" 32 #include "Test.h" 33 #include <WebKit/WKFrame.h> 34 #include <WebKit/WKRetainPtr.h> 35 #include <WebKit/WKSecurityOriginRef.h> 32 36 33 37 namespace TestWebKitAPI { 34 38 35 static bool testDone; 39 static bool done; 40 static unsigned dialogsSeen; 41 static const unsigned dialogsExpected = 3; 42 43 static void analyzeDialogArguments(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef securityOrigin) 44 { 45 EXPECT_EQ(page, WKFrameGetPage(frame)); 46 47 WKRetainPtr<WKURLRef> url = adoptWK(WKFrameCopyURL(frame)); 48 WKRetainPtr<WKStringRef> urlString = adoptWK(WKURLCopyString(url.get())); 49 EXPECT_WK_STREQ("about:blank", urlString.get()); 50 51 WKRetainPtr<WKStringRef> protocol = adoptWK(WKSecurityOriginCopyProtocol(securityOrigin)); 52 EXPECT_WK_STREQ("file", protocol.get()); 53 54 WKRetainPtr<WKStringRef> host = adoptWK(WKSecurityOriginCopyHost(securityOrigin)); 55 EXPECT_WK_STREQ("", host.get()); 56 57 EXPECT_EQ(WKSecurityOriginGetPort(securityOrigin), 0); 58 59 if (++dialogsSeen == dialogsExpected) 60 done = true; 61 } 62 63 static void runJavaScriptAlert(WKPageRef page, WKStringRef, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void*) 64 { 65 analyzeDialogArguments(page, frame, securityOrigin); 66 } 67 68 static bool runJavaScriptConfirm(WKPageRef page, WKStringRef, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void*) 69 { 70 analyzeDialogArguments(page, frame, securityOrigin); 71 return false; 72 } 73 74 static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef, WKStringRef, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void*) 75 { 76 analyzeDialogArguments(page, frame, securityOrigin); 77 return nullptr; 78 } 79 36 80 static std::unique_ptr<PlatformWebView> openedWebView; 37 38 static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)39 {40 // FIXME: Check that the alert text matches the storage.41 testDone = true;42 }43 81 44 82 static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo) … … 53 91 uiClient.base.version = 5; 54 92 uiClient.runJavaScriptAlert = runJavaScriptAlert; 93 uiClient.runJavaScriptConfirm = runJavaScriptConfirm; 94 uiClient.runJavaScriptPrompt = runJavaScriptPrompt; 95 55 96 WKPageSetPageUIClient(openedWebView->page(), &uiClient.base); 56 57 WKPageClose(page);58 97 59 98 WKRetain(openedWebView->page()); … … 61 100 } 62 101 63 TEST(WebKit2, CloseFromWithinCreatePage)102 TEST(WebKit2, ModalAlertsSPI) 64 103 { 65 WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate()); 66 104 WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate()); 67 105 PlatformWebView webView(context.get()); 68 106 … … 72 110 uiClient.base.version = 5; 73 111 uiClient.createNewPage = createNewPage; 74 uiClient.runJavaScriptAlert = runJavaScriptAlert; 112 75 113 WKPageSetPageUIClient(webView.page(), &uiClient.base); 76 114 77 WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource(" close-from-within-create-page", "html"));115 WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("modal-alerts-in-new-about-blank-window", "html")); 78 116 WKPageLoadURL(webView.page(), url.get()); 79 117 80 Util::run(&testDone); 81 82 openedWebView = nullptr; 118 Util::run(&done); 83 119 } 84 120 85 } 121 } // namespace TestWebKitAPI 86 122 87 123 #endif -
trunk/Tools/TestWebKitAPI/Tests/mac/FullscreenZoomInitialFrame.mm
r182859 r185915 58 58 // WebKit2 WKPageUIClient 59 59 60 static void runJavaScriptAlert (WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)60 static void runJavaScriptAlert_deprecatedForUseWithV0(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo) 61 61 { 62 62 EXPECT_TRUE(isWaitingForPageSignalToContinue); … … 113 113 114 114 uiClient.base.version = 0; 115 uiClient.runJavaScriptAlert = runJavaScriptAlert;115 uiClient.runJavaScriptAlert_deprecatedForUseWithV0 = runJavaScriptAlert_deprecatedForUseWithV0; 116 116 117 117 WKPageSetPageUIClient(wkView.pageRef, &uiClient.base); -
trunk/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm
r184807 r185915 53 53 // WebKit2 WKPageUIClient 54 54 55 static void runJavaScriptAlert (WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)55 static void runJavaScriptAlert_deprecatedForUseWithV0(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo) 56 56 { 57 57 EXPECT_TRUE(isWaitingForPageSignalToContinue); … … 100 100 101 101 uiClient.base.version = 0; 102 uiClient.runJavaScriptAlert = runJavaScriptAlert;102 uiClient.runJavaScriptAlert_deprecatedForUseWithV0 = runJavaScriptAlert_deprecatedForUseWithV0; 103 103 104 104 WKPageSetPageUIClient(wkView.pageRef, &uiClient.base); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r185262 r185915 214 214 focus, 215 215 unfocus, 216 0, // runJavaScriptAlert 217 0, // runJavaScript Confirm218 0, // runJavaScript Prompt216 0, // runJavaScriptAlert_deprecatedForUseWithV0 217 0, // runJavaScriptAlert_deprecatedForUseWithV0 218 0, // runJavaScriptAlert_deprecatedForUseWithV0 219 219 0, // setStatusText 220 220 0, // mouseDidMoveOverElement_deprecatedForUseWithV0 … … 261 261 decidePolicyForUserMediaPermissionRequest, 262 262 0, // didClickAutofillButton 263 0, // runJavaScriptAlert 264 0, // runJavaScriptConfirm 265 0, // runJavaScriptPrompt 263 266 }; 264 267 WKPageSetPageUIClient(newPage, &otherPageUIClient.base); … … 459 462 focus, 460 463 unfocus, 461 0, // runJavaScriptAlert 462 0, // runJavaScript Confirm463 0, // runJavaScript Prompt464 0, // runJavaScriptAlert_deprecatedForUseWithV0 465 0, // runJavaScriptAlert_deprecatedForUseWithV0 466 0, // runJavaScriptAlert_deprecatedForUseWithV0 464 467 0, // setStatusText 465 468 0, // mouseDidMoveOverElement_deprecatedForUseWithV0 … … 506 509 decidePolicyForUserMediaPermissionRequest, 507 510 0, // didClickAutofillButton 511 0, // runJavaScriptAlert 512 0, // runJavaScriptConfirm 513 0, // runJavaScriptPrompt 508 514 }; 509 515 WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base);
Note:
See TracChangeset
for help on using the changeset viewer.