Changeset 185915 in webkit


Ignore:
Timestamp:
Jun 24, 2015 9:57:30 AM (9 years ago)
Author:
beidson@apple.com
Message:

Update JavaScript dialog delegates to include a WKSecurityOriginRef argument.
<rdar://problem/21269187> and https://bugs.webkit.org/show_bug.cgi?id=146249

Reviewed by Alex Christensen.

Source/WebKit2:

  • UIProcess/API/C/WKPage.cpp:

(WKPageSetPageUIClient): Call the new signature if the client has it set.

Otherwise fall back to the old signature.

  • UIProcess/API/C/WKPageUIClient.h: Deprecate the old method signature, and add the new one to the newest V5 client structure.

Tools:

  • Update WKTR to the new client structure.
  • Update existing TestWebKitAPI tests to either use the new client structure or assign the old function signature to the updated variable name.
  • Include a new test.
  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2/CloseFromWithinCreatePage.cpp:

(TestWebKitAPI::runJavaScriptAlert):

  • TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebKit2/ModalAlertsSPI.cpp:

(TestWebKitAPI::analyzeDialogArguments):
(TestWebKitAPI::runJavaScriptAlert):
(TestWebKitAPI::runJavaScriptConfirm):
(TestWebKitAPI::runJavaScriptPrompt):
(TestWebKitAPI::createNewPage):
(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/mac/FullscreenZoomInitialFrame.mm:

(TestWebKitAPI::FullscreenZoomInitialFrame::initializeView):

  • TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:

(TestWebKitAPI::PageVisibilityStateWithWindowChanges::initializeView):

  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::createOtherPage):
(WTR::TestController::createWebViewWithOptions):

Location:
trunk
Files:
11 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r185905 r185915  
     12015-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
    1142015-06-24  Ryuan Choi  <ryuan.choi@navercorp.com>
    215
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r185877 r185915  
    14091409        }
    14101410
    1411         virtual void runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame, const SecurityOriginData&, std::function<void ()> completionHandler) override
    1412         {
    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) {
    14141414                completionHandler();
    14151415                return;
    14161416            }
    14171417
    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
    14191424            completionHandler();
    14201425        }
    14211426
    1422         virtual void runJavaScriptConfirm(WebPageProxy* page, const String& message, WebFrameProxy* frame, const SecurityOriginData&, std::function<void (bool)> completionHandler) override
    1423         {
    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) {
    14251430                completionHandler(false);
    14261431                return;
    14271432            }
    14281433
    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
    14301441            completionHandler(result);
    14311442        }
    14321443
    1433         virtual void runJavaScriptPrompt(WebPageProxy* page, const String& message, const String& defaultValue, WebFrameProxy* frame, const SecurityOriginData&, std::function<void (const String&)> completionHandler) override
    1434         {
    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) {
    14361447                completionHandler(String());
    14371448                return;
    14381449            }
    14391450
    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
    14411458            if (!string) {
    14421459                completionHandler(String());
  • trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h

    r185721 r185915  
    5151typedef void (*WKPageUIClientCallback)(WKPageRef page, const void* clientInfo);
    5252typedef 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);
     53typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo);
     54typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo);
     55typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo);
    5656typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo);
    5757typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo);
     
    9898typedef void (*WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo);
    9999typedef void (*WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo);
     100typedef void (*WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo);
     101typedef bool (*WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
     102typedef WKStringRef (*WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo);
    100103
    101104typedef struct WKPageUIClientBase {
     
    114117    WKPageFocusCallback                                                 focus;
    115118    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;
    119122    WKPageSetStatusTextCallback                                         setStatusText;
    120123    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
     
    159162    WKPageFocusCallback                                                 focus;
    160163    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;
    164167    WKPageSetStatusTextCallback                                         setStatusText;
    165168    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
     
    210213    WKPageFocusCallback                                                 focus;
    211214    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;
    215218    WKPageSetStatusTextCallback                                         setStatusText;
    216219    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
     
    266269    WKPageFocusCallback                                                 focus;
    267270    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;
    271274    WKPageSetStatusTextCallback                                         setStatusText;
    272275    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
     
    325328    WKPageFocusCallback                                                 focus;
    326329    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;
    330333    WKPageSetStatusTextCallback                                         setStatusText;
    331334    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
     
    390393    WKPageFocusCallback                                                 focus;
    391394    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;
    395398    WKPageSetStatusTextCallback                                         setStatusText;
    396399    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
     
    447450    WKPageDecidePolicyForUserMediaPermissionRequestCallback             decidePolicyForUserMediaPermissionRequest;
    448451    WKPageDidClickAutoFillButtonCallback                                didClickAutoFillButton;
     452    WKPageRunJavaScriptAlertCallback                                    runJavaScriptAlert;
     453    WKPageRunJavaScriptConfirmCallback                                  runJavaScriptConfirm;
     454    WKPageRunJavaScriptPromptCallback                                   runJavaScriptPrompt;
    449455} WKPageUIClientV5;
    450456
     
    461467    WKPageFocusCallback                                                 focus;
    462468    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;
    466472    WKPageSetStatusTextCallback                                         setStatusText;
    467473    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
  • trunk/Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp

    r185496 r185915  
    6161    uiClient.focus = focus;
    6262    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;
    6666    uiClient.toolbarsAreVisible = toolbarsAreVisible;
    6767    uiClient.setToolbarsAreVisible = setToolbarsAreVisible;
  • trunk/Tools/ChangeLog

    r185898 r185915  
     12015-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
    1392015-06-23  Dewei Zhu  <dewei_zhu@apple.com>
    240
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r185877 r185915  
    5252                5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */; };
    5353                517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */; };
     54                51CB4AD81B3A079C00C1B1C6 /* ModalAlertsSPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CB4AD71B3A079C00C1B1C6 /* ModalAlertsSPI.cpp */; };
    5455                51CD1C6C1B38CE4300142CA5 /* ModalAlerts.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */; };
    5556                51CD1C721B38D48400142CA5 /* modal-alerts-in-new-about-blank-window.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51CD1C711B38D48400142CA5 /* modal-alerts-in-new-about-blank-window.html */; };
     
    520521                517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCachePruneWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
    521522                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>"; };
    522524                51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ModalAlerts.mm; sourceTree = "<group>"; };
    523525                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>"; };
     
    10061008                                33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */,
    10071009                                8AA28C1916D2FA7B002FF4DB /* LoadPageOnCrash.cpp */,
     1010                                51CB4AD71B3A079C00C1B1C6 /* ModalAlertsSPI.cpp */,
    10081011                                33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */,
    10091012                                33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */,
     
    16271630                                41973B5B1AF2286A006C7B36 /* FileSystem.cpp in Sources */,
    16281631                                7A5623111AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp in Sources */,
     1632                                51CB4AD81B3A079C00C1B1C6 /* ModalAlertsSPI.cpp in Sources */,
    16291633                                26F6E1F01ADC749B00DE696B /* DFAMinimizer.cpp in Sources */,
    16301634                                260BA5791B1D2E7B004FA07C /* DFACombiner.cpp in Sources */,
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/CloseFromWithinCreatePage.cpp

    r177506 r185915  
    3636static std::unique_ptr<PlatformWebView> openedWebView;
    3737
    38 static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
     38static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef, const void* clientInfo)
    3939{
    4040    // FIXME: Check that the alert text matches the storage.
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp

    r177506 r185915  
    3737static bool done;
    3838
    39 static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
     39static void runJavaScriptAlert_deprecatedForUseWithV0(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
    4040{
    4141    ASSERT_NOT_NULL(frame);
     
    5858
    5959    uiClient.base.version = 0;
    60     uiClient.runJavaScriptAlert = runJavaScriptAlert;
     60    uiClient.runJavaScriptAlert_deprecatedForUseWithV0 = runJavaScriptAlert_deprecatedForUseWithV0;
    6161
    6262    WKPageSetPageUIClient(webView.page(), &uiClient.base);
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/ModalAlertsSPI.cpp

    r185914 r185915  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030#include "PlatformUtilities.h"
    3131#include "PlatformWebView.h"
     32#include "Test.h"
     33#include <WebKit/WKFrame.h>
     34#include <WebKit/WKRetainPtr.h>
     35#include <WebKit/WKSecurityOriginRef.h>
    3236
    3337namespace TestWebKitAPI {
    3438
    35 static bool testDone;
     39static bool done;
     40static unsigned dialogsSeen;
     41static const unsigned dialogsExpected = 3;
     42
     43static 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
     63static void runJavaScriptAlert(WKPageRef page, WKStringRef, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void*)
     64{
     65    analyzeDialogArguments(page, frame, securityOrigin);
     66}
     67
     68static bool runJavaScriptConfirm(WKPageRef page, WKStringRef, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void*)
     69{
     70    analyzeDialogArguments(page, frame, securityOrigin);
     71    return false;
     72}
     73
     74static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef, WKStringRef, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void*)
     75{
     76    analyzeDialogArguments(page, frame, securityOrigin);
     77    return nullptr;
     78}
     79
    3680static 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 }
    4381
    4482static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo)
     
    5391    uiClient.base.version = 5;
    5492    uiClient.runJavaScriptAlert = runJavaScriptAlert;
     93    uiClient.runJavaScriptConfirm = runJavaScriptConfirm;
     94    uiClient.runJavaScriptPrompt = runJavaScriptPrompt;
     95
    5596    WKPageSetPageUIClient(openedWebView->page(), &uiClient.base);
    56 
    57     WKPageClose(page);
    5897
    5998    WKRetain(openedWebView->page());
     
    61100}
    62101
    63 TEST(WebKit2, CloseFromWithinCreatePage)
     102TEST(WebKit2, ModalAlertsSPI)
    64103{
    65     WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
    66 
     104    WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate());
    67105    PlatformWebView webView(context.get());
    68106
     
    72110    uiClient.base.version = 5;
    73111    uiClient.createNewPage = createNewPage;
    74     uiClient.runJavaScriptAlert = runJavaScriptAlert;
     112
    75113    WKPageSetPageUIClient(webView.page(), &uiClient.base);
    76114
    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"));
    78116    WKPageLoadURL(webView.page(), url.get());
    79117
    80     Util::run(&testDone);
    81 
    82     openedWebView = nullptr;
     118    Util::run(&done);
    83119}
    84120
    85 }
     121} // namespace TestWebKitAPI
    86122
    87123#endif
  • trunk/Tools/TestWebKitAPI/Tests/mac/FullscreenZoomInitialFrame.mm

    r182859 r185915  
    5858// WebKit2 WKPageUIClient
    5959
    60 static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
     60static void runJavaScriptAlert_deprecatedForUseWithV0(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
    6161{
    6262    EXPECT_TRUE(isWaitingForPageSignalToContinue);
     
    113113
    114114    uiClient.base.version = 0;
    115     uiClient.runJavaScriptAlert = runJavaScriptAlert;
     115    uiClient.runJavaScriptAlert_deprecatedForUseWithV0 = runJavaScriptAlert_deprecatedForUseWithV0;
    116116
    117117    WKPageSetPageUIClient(wkView.pageRef, &uiClient.base);
  • trunk/Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm

    r184807 r185915  
    5353// WebKit2 WKPageUIClient
    5454
    55 static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
     55static void runJavaScriptAlert_deprecatedForUseWithV0(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
    5656{
    5757    EXPECT_TRUE(isWaitingForPageSignalToContinue);
     
    100100
    101101    uiClient.base.version = 0;
    102     uiClient.runJavaScriptAlert = runJavaScriptAlert;
     102    uiClient.runJavaScriptAlert_deprecatedForUseWithV0 = runJavaScriptAlert_deprecatedForUseWithV0;
    103103
    104104    WKPageSetPageUIClient(wkView.pageRef, &uiClient.base);
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r185262 r185915  
    214214        focus,
    215215        unfocus,
    216         0, // runJavaScriptAlert
    217         0, // runJavaScriptConfirm
    218         0, // runJavaScriptPrompt
     216        0, // runJavaScriptAlert_deprecatedForUseWithV0
     217        0, // runJavaScriptAlert_deprecatedForUseWithV0
     218        0, // runJavaScriptAlert_deprecatedForUseWithV0
    219219        0, // setStatusText
    220220        0, // mouseDidMoveOverElement_deprecatedForUseWithV0
     
    261261        decidePolicyForUserMediaPermissionRequest,
    262262        0, // didClickAutofillButton
     263        0, // runJavaScriptAlert
     264        0, // runJavaScriptConfirm
     265        0, // runJavaScriptPrompt
    263266    };
    264267    WKPageSetPageUIClient(newPage, &otherPageUIClient.base);
     
    459462        focus,
    460463        unfocus,
    461         0, // runJavaScriptAlert
    462         0, // runJavaScriptConfirm
    463         0, // runJavaScriptPrompt
     464        0, // runJavaScriptAlert_deprecatedForUseWithV0
     465        0, // runJavaScriptAlert_deprecatedForUseWithV0
     466        0, // runJavaScriptAlert_deprecatedForUseWithV0
    464467        0, // setStatusText
    465468        0, // mouseDidMoveOverElement_deprecatedForUseWithV0
     
    506509        decidePolicyForUserMediaPermissionRequest,
    507510        0, // didClickAutofillButton
     511        0, // runJavaScriptAlert
     512        0, // runJavaScriptConfirm
     513        0, // runJavaScriptPrompt
    508514    };
    509515    WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base);
Note: See TracChangeset for help on using the changeset viewer.