<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[173851] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/173851">173851</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2014-09-22 15:00:49 -0700 (Mon, 22 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Cocoa] Add UI delegate callback when window.close() is called
https://bugs.webkit.org/show_bug.cgi?id=137008
<rdar://problem/17801001>
Reviewed by Anders Carlsson.
Source/WebKit2:
Implement support infrastructure to notify the UI client when window.close() is called.
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added method declaration for -_webViewClose:.
* UIProcess/Cocoa/UIDelegate.h: Added override declaration for API::UIClient::close().
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate): Wire up delegate method to Objective-C selector, -[WKUIDelegatePrivate _webViewClose:].
(WebKit::UIDelegate::UIClient::close): Added; turns around and calls -[WKUIDelegatePrivate _webViewClose:] (if applicable).
Tools:
Add a test to ensure that -[WKUIDelegatePrivate _webViewClose:] is called on window.close()
for window opened via JavaScript (i.e. window.open()).
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/open-and-close-window.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaUIDelegateh">trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaUIDelegatemm">trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2openandclosewindowhtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2/open-and-close-window.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaOpenAndCloseWindowmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (173850 => 173851)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-09-22 21:13:38 UTC (rev 173850)
+++ trunk/Source/WebKit2/ChangeLog        2014-09-22 22:00:49 UTC (rev 173851)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-09-22 Daniel Bates <dabates@apple.com>
+
+ [Cocoa] Add UI delegate callback when window.close() is called
+ https://bugs.webkit.org/show_bug.cgi?id=137008
+ <rdar://problem/17801001>
+
+ Reviewed by Anders Carlsson.
+
+ Implement support infrastructure to notify the UI client when window.close() is called.
+
+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added method declaration for -_webViewClose:.
+ * UIProcess/Cocoa/UIDelegate.h: Added override declaration for API::UIClient::close().
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::setDelegate): Wire up delegate method to Objective-C selector, -[WKUIDelegatePrivate _webViewClose:].
+ (WebKit::UIDelegate::UIClient::close): Added; turns around and calls -[WKUIDelegatePrivate _webViewClose:] (if applicable).
+
</ins><span class="cx"> 2014-09-21 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Generate Element casting helper functions
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (173850 => 173851)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2014-09-22 21:13:38 UTC (rev 173850)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2014-09-22 22:00:49 UTC (rev 173851)
</span><span class="lines">@@ -44,6 +44,8 @@
</span><span class="cx">
</span><span class="cx"> - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame;
</span><span class="cx">
</span><ins>+- (void)_webViewClose:(WKWebView *)webView;
+
</ins><span class="cx"> #if TARGET_OS_IPHONE
</span><span class="cx"> - (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray *)defaultActions;
</span><span class="cx"> - (void)_webView:(WKWebView *)webView didNotHandleTapAsClickAtPoint:(CGPoint)point;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaUIDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (173850 => 173851)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h        2014-09-22 21:13:38 UTC (rev 173850)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h        2014-09-22 22:00:49 UTC (rev 173851)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> private:
</span><span class="cx"> // API::UIClient
</span><span class="cx"> virtual PassRefPtr<WebKit::WebPageProxy> createNewPage(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, const WebKit::NavigationActionData&) override;
</span><ins>+ virtual void close(WebKit::WebPageProxy*) override;
</ins><span class="cx"> virtual void runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void ()> completionHandler) override;
</span><span class="cx"> virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (bool)> completionHandler) override;
</span><span class="cx"> virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (const WTF::String&)> completionHandler) override;
</span><span class="lines">@@ -84,6 +85,7 @@
</span><span class="cx"> bool webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1;
</span><span class="cx"> bool webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded : 1;
</span><span class="cx"> bool webViewPrintFrame : 1;
</span><ins>+ bool webViewClose : 1;
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> bool webViewActionsForElementDefaultActions : 1;
</span><span class="cx"> bool webViewDidNotHandleTapAsClickAtPoint : 1;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaUIDelegatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (173850 => 173851)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm        2014-09-22 21:13:38 UTC (rev 173850)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm        2014-09-22 22:00:49 UTC (rev 173851)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler = [delegate respondsToSelector:@selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)];
</span><span class="cx"> m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded = [delegate respondsToSelector:@selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)];
</span><span class="cx"> m_delegateMethods.webViewPrintFrame = [delegate respondsToSelector:@selector(_webView:printFrame:)];
</span><ins>+ m_delegateMethods.webViewClose = [delegate respondsToSelector:@selector(_webViewClose:)];
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)];
</span><span class="cx"> m_delegateMethods.webViewDidNotHandleTapAsClickAtPoint = [delegate respondsToSelector:@selector(_webView:didNotHandleTapAsClickAtPoint:)];
</span><span class="lines">@@ -228,6 +229,18 @@
</span><span class="cx"> [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(*API::FrameHandle::create(webFrameProxy->frameID()))];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void UIDelegate::UIClient::close(WebKit::WebPageProxy*)
+{
+ if (!m_uiDelegate.m_delegateMethods.webViewClose)
+ return;
+
+ auto delegate = m_uiDelegate.m_delegate.get();
+ if (!delegate)
+ return;
+
+ [(id <WKUIDelegatePrivate>)delegate _webViewClose:m_uiDelegate.m_webView];
+}
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> RetainPtr<NSArray> UIDelegate::UIClient::actionsForElement(_WKActivatedElementInfo *elementInfo, RetainPtr<NSArray> defaultActions)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (173850 => 173851)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-09-22 21:13:38 UTC (rev 173850)
+++ trunk/Tools/ChangeLog        2014-09-22 22:00:49 UTC (rev 173851)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-09-22 Daniel Bates <dabates@apple.com>
+
+ [Cocoa] Add UI delegate callback when window.close() is called
+ https://bugs.webkit.org/show_bug.cgi?id=137008
+ <rdar://problem/17801001>
+
+ Reviewed by Anders Carlsson.
+
+ Add a test to ensure that -[WKUIDelegatePrivate _webViewClose:] is called on window.close()
+ for window opened via JavaScript (i.e. window.open()).
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/open-and-close-window.html: Added.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm: Added.
+
</ins><span class="cx"> 2014-09-22 Youenn Fablet <youennf@gmail.com>
</span><span class="cx">
</span><span class="cx"> W3C importer should import html files within resources folders
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (173850 => 173851)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-09-22 21:13:38 UTC (rev 173850)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-09-22 22:00:49 UTC (rev 173851)
</span><span class="lines">@@ -245,6 +245,8 @@
</span><span class="cx">                 CDC2C71517970DDB00E627FB /* TimeRanges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDC2C7141797089D00E627FB /* TimeRanges.cpp */; };
</span><span class="cx">                 CE14F1A4181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */; };
</span><span class="cx">                 CE32C7C818184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */; };
</span><ins>+                CEA6CF2319CCF5BD0064F5A7 /* OpenAndCloseWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */; };
+                CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */; };
</ins><span class="cx">                 E1220DA0155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */; };
</span><span class="cx">                 E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
</span><span class="cx">                 E194E1BB177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = E194E1BA177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm */; };
</span><span class="lines">@@ -333,6 +335,7 @@
</span><span class="cx">                                 517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */,
</span><span class="cx">                                 33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */,
</span><span class="cx">                                 A57A34F216AF6B2B00C2501F /* PageVisibilityStateWithWindowChanges.html in Copy Resources */,
</span><ins>+                                CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */,
</ins><span class="cx">                                 F6FDDDD614241C6F004F1729 /* push-state.html in Copy Resources */,
</span><span class="cx">                                 52B8CF9815868D9100281053 /* SetDocumentURI.html in Copy Resources */,
</span><span class="cx">                                 1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */,
</span><span class="lines">@@ -611,6 +614,8 @@
</span><span class="cx">                 CDC2C7141797089D00E627FB /* TimeRanges.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TimeRanges.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = WillPerformClientRedirectToURLCrash.html; sourceTree = "<group>"; };
</span><span class="cx">                 CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WillPerformClientRedirectToURLCrash.mm; sourceTree = "<group>"; };
</span><ins>+                CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenAndCloseWindow.mm; sourceTree = "<group>"; };
+                CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "open-and-close-window.html"; sourceTree = "<group>"; };
</ins><span class="cx">                 E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheDisableWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
</span><span class="cx">                 E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCacheDisableWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
</span><span class="cx">                 E194E1BA177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StopLoadingFromDidReceiveResponse.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -715,6 +720,7 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
</span><span class="cx">                                 1ABC3DED1899BE6D004F0626 /* Navigation.mm */,
</span><ins>+                                CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
</ins><span class="cx">                                 C95501BE19AD2FAF0049BE3E /* Preferences.mm */,
</span><span class="cx">                                 7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
</span><span class="cx">                         );
</span><span class="lines">@@ -968,6 +974,7 @@
</span><span class="cx">                                 930AD401150698B30067970F /* lots-of-text.html */,
</span><span class="cx">                                 2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */,
</span><span class="cx">                                 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */,
</span><ins>+                                CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */,
</ins><span class="cx">                                 F6FDDDD514241C48004F1729 /* push-state.html */,
</span><span class="cx">                                 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */,
</span><span class="cx">                                 C0ADBE8412FCA6B600D2C129 /* simple-form.html */,
</span><span class="lines">@@ -1381,6 +1388,7 @@
</span><span class="cx">                                 1AA9BAE418500450003B6BC6 /* WeakObjCPtr.mm in Sources */,
</span><span class="cx">                                 A5E2027315B2181900C13E14 /* WindowlessWebViewWithMedia.mm in Sources */,
</span><span class="cx">                                 F6B7BE9417469209008A3445 /* DidAssociateFormControls.cpp in Sources */,
</span><ins>+                                CEA6CF2319CCF5BD0064F5A7 /* OpenAndCloseWindow.mm in Sources */,
</ins><span class="cx">                                 BC3C4C7F14587AA60025FB62 /* WKBrowsingContextGroupTest.mm in Sources */,
</span><span class="cx">                                 BC3C4C7214575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm in Sources */,
</span><span class="cx">                                 93A7EB3D18FA63A4009E7670 /* URLExtras.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2openandclosewindowhtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/open-and-close-window.html (0 => 173851)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/open-and-close-window.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/open-and-close-window.html        2014-09-22 22:00:49 UTC (rev 173851)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (document.location.search === "?close-window")
+ window.close();
+else
+ window.open("open-and-close-window.html?close-window");
+</script>
+</head>
+</html>
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaOpenAndCloseWindowmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm (0 => 173851)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm        2014-09-22 22:00:49 UTC (rev 173851)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#import "PlatformUtilities.h"
+#import <WebKit/WKPreferences.h>
+#import <WebKit/WKUIDelegatePrivate.h>
+#import <WebKit/WKWebView.h>
+#import <WebKit/WKWebViewConfiguration.h>
+#import <wtf/RetainPtr.h>
+
+#if WK_API_ENABLED
+
+@class OpenAndCloseWindowUIDelegate;
+
+static bool isDone;
+static RetainPtr<WKWebView> openedWebView;
+static RetainPtr<OpenAndCloseWindowUIDelegate> sharedUIDelegate;
+
+@interface OpenAndCloseWindowUIDelegate : NSObject <WKUIDelegate>
+@end
+
+@implementation OpenAndCloseWindowUIDelegate
+
+- (void)_webViewClose:(WKWebView *)webView
+{
+ EXPECT_EQ(openedWebView, webView);
+ isDone = true;
+}
+
+- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
+{
+ openedWebView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration]);
+ [openedWebView setUIDelegate:sharedUIDelegate.get()];
+ return openedWebView.get();
+}
+
+@end
+
+TEST(WebKit2, OpenAndCloseWindow)
+{
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+
+ sharedUIDelegate = adoptNS([[OpenAndCloseWindowUIDelegate alloc] init]);
+ [webView setUIDelegate:sharedUIDelegate.get()];
+
+ [webView configuration].preferences.javaScriptCanOpenWindowsAutomatically = YES;
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"open-and-close-window" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&isDone);
+}
+
+#endif
</ins><span class="cx">Property changes on: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
</div>
</body>
</html>