[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

darin at apple.com darin at apple.com
Wed Dec 22 11:39:00 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9590484dcdc032bcae49d551295dd94977c4fa0d
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 2 19:10:22 2010 +0000

    2010-08-02  Darin Adler  <darin at apple.com>
    
            Reviewed by Sam Weinig.
    
            WebKitTestRunner needs layoutTestController.setCanOpenWindows
            https://bugs.webkit.org/show_bug.cgi?id=42321
    
            WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
            https://bugs.webkit.org/show_bug.cgi?id=42779
    
            * platform/mac-wk2/Skipped: Removed tests that are now passing. Moved other tests
            into the appropriate section.
    2010-08-02  Darin Adler  <darin at apple.com>
    
            Reviewed by Sam Weinig.
    
            WebKitTestRunner needs layoutTestController.setCanOpenWindows
            https://bugs.webkit.org/show_bug.cgi?id=42321
    
            WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
            https://bugs.webkit.org/show_bug.cgi?id=42779
    
            * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: Added
            setCanOpenWindows, setCloseRemainingWindowsWhenComplete, and windowCount
    
            * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
            (WTR::InjectedBundle::InjectedBundle): Initialize m_mainPage to 0 instead of
            waiting for the first call to didCreatePage.
            (WTR::InjectedBundle::didCreatePage): Set m_mainPage only when the first page
            is created. Put other pages into a map.
            (WTR::InjectedBundle::willDestroyPage): Added code to handle the destruction
            of the main page.
            (WTR::InjectedBundle::closeOtherPages): Added. Closes all the pages other than
            the main page.
            * WebKitTestRunner/InjectedBundle/InjectedBundle.h: Added pageCount and
            closeOtherPages functions.
    
            * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
            (WTR::InjectedBundlePage::didFinishLoadForFrame): Don't let pages other than
            the main page affect dumping.
            (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame): Ditto.
    
            * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
            (WTR::LayoutTestController::LayoutTestController): Initialize the new
            m_shouldCloseExtraWindows member.
            (WTR::LayoutTestController::setCanOpenWindows): Added. Empty for now.
            (WTR::LayoutTestController::windowCount): Added.
    
            * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
            Added setCanOpenWindows, setCloseRemainingWindowsWhenComplete,
            windowCount, shouldCloseExtraWindowsAfterRunningTest, and
            m_shouldCloseExtraWindows.
    
            * WebKitTestRunner/TestController.cpp:
            (WTR::TestController::shared): Return a pointer to the shared copy, but
            don't allocate and leak it. This seemed cleaner than adding an explicit
            finalize call to go along with the explicit initialize call.
            (WTR::TestController::TestController): Added calls to the initialize and
            run function, which are now done automatically.
            (WTR::TestController::~TestController): Added, since it's called now.
            (WTR::closeOtherPage): Added. Used to close pages other than the main page.
            (WTR::createOtherPage): Added. Used to create pages other than the main page.
            (WTR::TestController::initialize): Added code to set up createOtherPage.
            (WTR::TestController::run): Removed unused return value.
            * WebKitTestRunner/TestController.h: Made constructor and destructor public,
            and initialize and run private. Changed m_mainWebView to be an OwnPtr.
    
            * WebKitTestRunner/mac/PlatformWebViewMac.mm:
            (WTR::PlatformWebView::PlatformWebView): Added a call to setReleasedWhenClosed
            to avoid releasing the window twice. Another way to handle it would be to
            remove the release, but this approach is slightly more robust because it works
            even if some other code calls the close method an extra time.
    
            * WebKitTestRunner/mac/main.mm:
            (main): Use a stack-allocated TestController object instead of calling
            initalize and run on a globally allocated one.
    2010-08-02  Darin Adler  <darin at apple.com>
    
            Reviewed by Sam Weinig.
    
            WebKitTestRunner needs layoutTestController.setCanOpenWindows
            https://bugs.webkit.org/show_bug.cgi?id=42321
    
            WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
            https://bugs.webkit.org/show_bug.cgi?id=42779
    
            Implemented window.close, added a function that does a similar operation on behalf
            of injected bundle code named WKBundlePageClose, and fixed the reference counting of
            the result of the createNewPage client function.
    
            * UIProcess/API/cpp/WKRetainPtr.h: Added clear. Tweaked formatting. Renamed
            releaseRef to leakRef.
    
            * UIProcess/API/mac/WKView.mm:
            (-[WKView _updateVisibility]): Handle the case where drawing area is 0. This
            came up in WebKitTestRunner and other functions handle drawing area of 0.
    
            * UIProcess/WebPageProxy.cpp:
            (WebKit::WebPageProxy::didReceiveSyncMessage): Update now that createNewPage
            returns a PassRefPtr.
            (WebKit::WebPageProxy::createNewPage): Changed to return a PassRefPtr.
            * UIProcess/WebPageProxy.h: Ditto.
    
            * UIProcess/WebUIClient.cpp:
            (WebKit::WebUIClient::createNewPage): Changed to return a PassRefPtr and adopt
            the WKPageRef passed from the client. This follows the "create rule".
            * UIProcess/WebUIClient.h: Ditto.
    
            * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
            (WKBundlePageClose): Added.
            * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: Added WKBundlePageClose
            and re-sorted the other functions in this file.
    
            * WebProcess/WebCoreSupport/WebChromeClient.cpp:
            (WebKit::WebChromeClient::closeWindowSoon): Implemented this.
    
            * WebProcess/WebPage/WebPage.cpp:
            (WebKit::WebPage::WebPage): Called setJavaScriptCanOpenWindowsAutomatically(true).
            I suppose we will need to revisit this later when we implement pop-up blocking.
            (WebKit::WebPage::tryClose): Factored out the part of this that sends a message
            to the other process.
            (WebKit::WebPage::sendClose): This is where the part that sends a message went.
            * WebProcess/WebPage/WebPage.h: Added sendClose, used by both closeWindowSoon
            and WKBundlePageClose.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64485 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 52e087e..e88f4fa 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-08-02  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WebKitTestRunner needs layoutTestController.setCanOpenWindows
+        https://bugs.webkit.org/show_bug.cgi?id=42321
+
+        WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
+        https://bugs.webkit.org/show_bug.cgi?id=42779
+
+        * platform/mac-wk2/Skipped: Removed tests that are now passing. Moved other tests
+        into the appropriate section.
+
 2010-08-02  Andrew Wilson  <atwilson at chromium.org>
 
         Unreviewed fix for typo in chromium test_expectations.txt.
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index fe198aa..e9841f2 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -808,13 +808,13 @@ fast/css/user-drag-none.html
 fast/css/zoom-body-scroll.html
 fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html
 fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html
-fast/dom/elementFromPoint-relative-to-viewport.html
 fast/dom/HTMLTableColElement/resize-table-using-col-width.html
 fast/dom/Node/mutation-blur.html
-fast/dom/replaced-image-map.html
 fast/dom/Window/window-postmessage-clone-frames.html
 fast/dom/Window/window-postmessage-clone.html
 fast/dom/Window/window-xy-properties.html
+fast/dom/elementFromPoint-relative-to-viewport.html
+fast/dom/replaced-image-map.html
 fast/dynamic/hover-style-recalc-crash.html
 fast/dynamic/hovered-detach.html
 fast/dynamic/layer-hit-test-crash.html
@@ -1000,6 +1000,8 @@ fast/frames/frame-deep-nested-resize.html
 fast/frames/hover-timer-crash.html
 fast/frames/iframe-window-focus.html
 fast/frames/take-focus-from-iframe.html
+fast/history/history_reload.html
+fast/history/window-open.html
 fast/images/drag-pdf-as-image.html
 fast/images/drag-svg-as-image.html
 fast/images/image-map-zoom.html
@@ -1040,8 +1042,10 @@ http/tests/local/send-sliced-dragged-file.html
 http/tests/misc/bubble-drag-events.html
 http/tests/misc/drag-over-iframe-invalid-source-crash.html
 http/tests/misc/isindex-with-no-form.html
+http/tests/navigation/no-referrer-reset.html
 http/tests/navigation/no-referrer-same-window.html
 http/tests/navigation/no-referrer-subframe.html
+http/tests/navigation/no-referrer-target-blank.html
 http/tests/navigation/redirect-preserves-referrer.html
 http/tests/security/clipboard/clipboard-file-access.html
 http/tests/security/dataTransfer-set-data-file-url.html
@@ -1062,10 +1066,10 @@ scrollbars/scrollbar-iframe-click-does-not-blur-content.html
 scrollbars/scrollbar-middleclick-nopaste.html
 scrollbars/scrollbar-miss-mousemove-disabled.html
 scrollbars/scrollbar-miss-mousemove.html
+svg/animations/animVal-basics.html
 svg/animations/animate-gradient-transform.html
 svg/animations/animate-keySplines.html
 svg/animations/animate-points.html
-svg/animations/animVal-basics.html
 svg/custom/circle-move-invalidation.svg
 svg/custom/clip-path-child-changes.svg
 svg/custom/clip-path-href-changes.svg
@@ -1211,6 +1215,14 @@ svg/dynamic-updates/SVGImageElement-svgdom-preserveAspectRatio-prop.html
 svg/dynamic-updates/SVGImageElement-svgdom-width-prop.html
 svg/dynamic-updates/SVGImageElement-svgdom-x-prop.html
 svg/dynamic-updates/SVGImageElement-svgdom-y-prop.html
+svg/dynamic-updates/SVGLineElement-dom-x1-attr.html
+svg/dynamic-updates/SVGLineElement-dom-x2-attr.html
+svg/dynamic-updates/SVGLineElement-dom-y1-attr.html
+svg/dynamic-updates/SVGLineElement-dom-y2-attr.html
+svg/dynamic-updates/SVGLineElement-svgdom-x1-prop.html
+svg/dynamic-updates/SVGLineElement-svgdom-x2-prop.html
+svg/dynamic-updates/SVGLineElement-svgdom-y1-prop.html
+svg/dynamic-updates/SVGLineElement-svgdom-y2-prop.html
 svg/dynamic-updates/SVGLinearGradientElement-dom-gradientTransform-attr.html
 svg/dynamic-updates/SVGLinearGradientElement-dom-gradientUnits-attr.html
 svg/dynamic-updates/SVGLinearGradientElement-dom-x1-attr.html
@@ -1223,14 +1235,6 @@ svg/dynamic-updates/SVGLinearGradientElement-svgdom-x1-prop.html
 svg/dynamic-updates/SVGLinearGradientElement-svgdom-x2-prop.html
 svg/dynamic-updates/SVGLinearGradientElement-svgdom-y1-prop.html
 svg/dynamic-updates/SVGLinearGradientElement-svgdom-y2-prop.html
-svg/dynamic-updates/SVGLineElement-dom-x1-attr.html
-svg/dynamic-updates/SVGLineElement-dom-x2-attr.html
-svg/dynamic-updates/SVGLineElement-dom-y1-attr.html
-svg/dynamic-updates/SVGLineElement-dom-y2-attr.html
-svg/dynamic-updates/SVGLineElement-svgdom-x1-prop.html
-svg/dynamic-updates/SVGLineElement-svgdom-x2-prop.html
-svg/dynamic-updates/SVGLineElement-svgdom-y1-prop.html
-svg/dynamic-updates/SVGLineElement-svgdom-y2-prop.html
 svg/dynamic-updates/SVGMarkerElement-dom-markerHeight-attr.html
 svg/dynamic-updates/SVGMarkerElement-dom-markerUnits-attr.html
 svg/dynamic-updates/SVGMarkerElement-dom-markerWidth-attr.html
@@ -1294,10 +1298,10 @@ svg/dynamic-updates/SVGRectElement-svgdom-height-prop.html
 svg/dynamic-updates/SVGRectElement-svgdom-width-prop.html
 svg/dynamic-updates/SVGRectElement-svgdom-x-prop.html
 svg/dynamic-updates/SVGRectElement-svgdom-y-prop.html
+svg/dynamic-updates/SVGTRefElement-dom-href-attr.html
 svg/dynamic-updates/SVGTextElement-dom-transform-attr.html
 svg/dynamic-updates/SVGTextElement-svgdom-rotate-prop.html
 svg/dynamic-updates/SVGTextElement-svgdom-transform-prop.html
-svg/dynamic-updates/SVGTRefElement-dom-href-attr.html
 svg/filters/filter-width-update.svg
 svg/text/select-textLength-spacing-squeeze-1.svg
 svg/text/select-textLength-spacing-squeeze-2.svg
@@ -1504,6 +1508,7 @@ plugins/window-open.html
 # <https://bugs.webkit.org/show_bug.cgi?id=41084>
 compositing/webgl/webgl-background-color.html
 compositing/webgl/webgl-reflection.html
+fast/canvas/webgl/array-buffer-crash.html
 fast/canvas/webgl/array-buffer-view-crash.html
 fast/canvas/webgl/array-get-and-set-method-removal.html
 fast/canvas/webgl/array-get-out-of-bounds.html
@@ -1511,6 +1516,8 @@ fast/canvas/webgl/array-set-out-of-bounds.html
 fast/canvas/webgl/array-setters.html
 fast/canvas/webgl/array-unit-tests.html
 fast/canvas/webgl/buffer-bind-test.html
+fast/canvas/webgl/buffer-data-array-buffer.html
+fast/canvas/webgl/canvas-test.html
 fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html
 fast/canvas/webgl/context-attributes.html
 fast/canvas/webgl/copy-tex-image-and-sub-image-2d.html
@@ -1524,60 +1531,59 @@ fast/canvas/webgl/gl-enable-enum-test.html
 fast/canvas/webgl/gl-enum-tests.html
 fast/canvas/webgl/gl-get-calls.html
 fast/canvas/webgl/gl-object-get-calls.html
+fast/canvas/webgl/gl-pixelstorei.html
 fast/canvas/webgl/gl-uniform-arrays.html
 fast/canvas/webgl/gl-uniformmatrix4fv.html
 fast/canvas/webgl/gl-vertex-attrib.html
 fast/canvas/webgl/incorrect-context-object-behaviour.html
 fast/canvas/webgl/index-validation-copies-indices.html
 fast/canvas/webgl/index-validation-crash-with-buffer-sub-data.html
-fast/canvas/webgl/index-validation.html
+fast/canvas/webgl/index-validation-verifies-too-many-indices.html
 fast/canvas/webgl/index-validation-with-resized-buffer.html
+fast/canvas/webgl/index-validation.html
 fast/canvas/webgl/invalid-UTF-16.html
+fast/canvas/webgl/invalid-passed-params.html
 fast/canvas/webgl/null-object-behaviour.html
 fast/canvas/webgl/null-uniform-location.html
 fast/canvas/webgl/point-size.html
 fast/canvas/webgl/program-test.html
+fast/canvas/webgl/read-pixels-pack-alignment.html
 fast/canvas/webgl/renderbuffer-initialization.html
 fast/canvas/webgl/tex-image-and-sub-image-2d-with-array-buffer-view.html
 fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data.html
 fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html
+fast/canvas/webgl/tex-image-and-uniform-binding-bugs.html
 fast/canvas/webgl/tex-image-with-format-and-type.html
 fast/canvas/webgl/tex-input-validation.html
 fast/canvas/webgl/tex-sub-image-2d.html
 fast/canvas/webgl/texImage2DImageDataTest.html
 fast/canvas/webgl/texImageTest.html
 fast/canvas/webgl/texture-active-bind.html
+fast/canvas/webgl/texture-complete.html
 fast/canvas/webgl/texture-npot.html
+fast/canvas/webgl/texture-transparent-pixels-initialized.html
 fast/canvas/webgl/triangle.html
 fast/canvas/webgl/uniform-location.html
 fast/canvas/webgl/viewport-unchanged-upon-resize.html
 fast/canvas/webgl/webgl-array-invalid-ranges.html
 fast/dom/Window/timer-resume-on-navigation-back.html
-fast/events/pageshow-pagehide-on-back-cached.html
 fast/events/pageshow-pagehide-on-back-cached-with-frames.html
+fast/events/pageshow-pagehide-on-back-cached.html
 fast/events/tab-focus-anchor.html
+fast/frames/frame-crash-with-page-cache.html
 fast/harness/override-preferences-2.html
 fast/harness/override-preferences.html
+fast/harness/page-cache-crash-on-data-urls.html
 fast/harness/use-page-cache.html
 fast/history/timed-refresh-in-cached-frame.html
 fast/loader/frames-with-unload-handlers-in-page-cache.html
 fast/loader/input-element-page-cache-crash.html
 fast/parser/noscript-with-javascript-disabled.html
 fast/parser/noscript-with-javascript-enabled.html
-loader/go-back-to-different-window-size.html
-fast/canvas/webgl/array-buffer-crash.html
-fast/canvas/webgl/buffer-data-array-buffer.html
-fast/canvas/webgl/index-validation-verifies-too-many-indices.html
-fast/canvas/webgl/tex-image-and-uniform-binding-bugs.html
-fast/canvas/webgl/texture-complete.html
-fast/canvas/webgl/texture-transparent-pixels-initialized.html
 fast/repaint/no-caret-repaint-in-non-content-editable-element.html
 http/tests/appcache/disabled.html
+loader/go-back-to-different-window-size.html
 media/restore-from-page-cache.html
-fast/canvas/webgl/canvas-test.html
-fast/canvas/webgl/gl-pixelstorei.html
-fast/canvas/webgl/invalid-passed-params.html
-fast/canvas/webgl/read-pixels-pack-alignment.html
 
 # Pasteboard doesn't work in WebKit2
 # <https://bugs.webkit.org/show_bug.cgi?id=42317>
@@ -1691,81 +1697,6 @@ inspector/timeline-script-tag-1.html
 inspector/timeline-script-tag-2.html
 inspector/timeline-trivial.html
 
-# WebKitTestRunner needs to support layoutTestController.setCanOpenWindows
-# <https://bugs.webkit.org/show_bug.cgi?id=42321>
-fast/dom/Document/early-document-access.html
-fast/dom/Window/closure-access-after-navigation-window.html
-fast/dom/Window/dom-access-from-closure-window.html
-fast/dom/Window/new-window-opener.html
-fast/dom/Window/setting-properties-on-closed-window.html
-fast/dom/Window/window-early-properties.html
-fast/dom/Window/window-open-pending-url.html
-fast/dom/Window/window-open-self-from-other-frame.html
-fast/dom/location-new-window-no-crash.html
-fast/dom/open-and-close-by-DOM.html
-fast/events/popup-allowed-from-gesture-initiated-event.html
-fast/events/popup-allowed-from-gesture-initiated-form-submit.html
-fast/events/popup-blocked-from-fake-button-click.html
-fast/events/popup-blocked-from-fake-focus.html
-fast/events/popup-blocked-from-fake-user-gesture.html
-fast/events/popup-blocked-to-post-blank.html
-fast/events/show-modal-dialog-onblur-onfocus.html
-fast/frames/frame-crash-with-page-cache.html
-fast/frames/iframe-reparenting-new-page.html
-fast/frames/sandboxed-iframe-navigation-windowopen.html
-fast/harness/page-cache-crash-on-data-urls.html
-fast/harness/show-modal-dialog.html
-fast/history/history_reload.html
-fast/history/window-open.html
-fast/loader/cancel-load-during-port-block-timer.html
-fast/loader/crash-copying-backforwardlist.html
-fast/loader/stateobjects/pushstate-without-history.html
-fast/loader/stateobjects/replacestate-in-iframe.html
-fast/loader/stateobjects/replacestate-then-pushstate.html
-fast/loader/stateobjects/replacestate-updates-location.html
-fast/parser/xhtml-close-while-parsing.xhtml
-plugins/access-after-page-destroyed.html
-http/tests/appcache/crash-when-navigating-away-then-back.html
-http/tests/media/video-cancel-load.html
-http/tests/misc/set-window-opener-to-null.html
-http/tests/misc/slow-preload-cancel.html
-http/tests/misc/window-open-then-write.html
-http/tests/navigation/new-window-redirect-history.html
-http/tests/navigation/no-referrer-reset.html
-http/tests/navigation/no-referrer-target-blank.html
-http/tests/navigation/target-frame-from-window.html
-http/tests/security/aboutBlank/security-context-window-open.html
-http/tests/security/aboutBlank/window-open-self-about-blank.html
-http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write.html
-http/tests/security/aboutBlank/xss-DENIED-navigate-opener-javascript-url.html
-http/tests/security/aboutBlank/xss-DENIED-set-opener.html
-http/tests/security/cross-frame-access-call.html
-http/tests/security/dataURL/xss-DENIED-from-data-url-in-foreign-domain-window-open.html
-http/tests/security/dataURL/xss-DENIED-from-javascript-url-window-open.html
-http/tests/security/dataURL/xss-DENIED-to-data-url-in-foreign-domain-window-open.html
-http/tests/security/dataURL/xss-DENIED-to-data-url-window-open.html
-http/tests/security/frameNavigation/cross-origin-opener.html
-http/tests/security/frameNavigation/not-opener.html
-http/tests/security/frameNavigation/opener.html
-http/tests/security/frameNavigation/xss-DENIED-plugin-navigation.html
-http/tests/security/frameNavigation/xss-DENIED-targeted-link-navigation.html
-http/tests/security/isolatedWorld/userGestureEvents.html
-http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-window-open.html
-http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.html
-http/tests/security/javascriptURL/xss-DENIED-from-javascript-url-in-foreign-domain-window-open.html
-http/tests/security/javascriptURL/xss-DENIED-to-javascript-url-in-foreign-domain-window-open.html
-http/tests/security/originHeader/origin-header-for-empty.html
-http/tests/security/window-events-clear-domain.html
-http/tests/security/window-events-clear-port.html
-http/tests/security/window-events-pass.html
-http/tests/xmlhttprequest/close-window.html
-http/tests/xmlhttprequest/cross-origin-authorization-with-embedder.html
-http/tests/xmlhttprequest/cross-origin-authorization.html
-http/tests/xmlhttprequest/cross-origin-no-authorization.html
-http/tests/xmlhttprequest/request-from-popup.html
-storage/domstorage/localstorage/window-open.html
-storage/domstorage/sessionstorage/window-open.html
-
 # WebKitTestRunner needs to support layoutTestController.dumpBackForwardList
 # <https://bugs.webkit.org/show_bug.cgi?id=42322>
 fast/loader/fragment-after-redirect-gets-back-entry.html
@@ -1829,6 +1760,7 @@ http/tests/navigation/metaredirect-frames.html
 http/tests/navigation/metaredirect-goback.html
 http/tests/navigation/metaredirect-subframeload.html
 http/tests/navigation/multiple-back-forward-entries.html
+http/tests/navigation/new-window-redirect-history.html
 http/tests/navigation/onload-navigation-iframe-2.html
 http/tests/navigation/onload-navigation-iframe-timeout.html
 http/tests/navigation/onload-navigation-iframe.html
@@ -1919,14 +1851,15 @@ http/tests/security/isolatedWorld/location-properties.html
 http/tests/security/isolatedWorld/location-prototype.html
 http/tests/security/isolatedWorld/number-prototype.html
 http/tests/security/isolatedWorld/object-prototype.html
+http/tests/security/isolatedWorld/storage-properties.html
+http/tests/security/isolatedWorld/storage-prototype.html
 http/tests/security/isolatedWorld/string-prototype.html
 http/tests/security/isolatedWorld/top-properties.html
+http/tests/security/isolatedWorld/userGestureEvents.html
 http/tests/security/isolatedWorld/window-properties.html
 http/tests/security/isolatedWorld/window-setTimeout-function.html
 http/tests/security/isolatedWorld/window-setTimeout-string.html
 http/tests/security/isolatedWorld/world-reuse.html
-http/tests/security/isolatedWorld/storage-properties.html
-http/tests/security/isolatedWorld/storage-prototype.html
 
 # WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
 # <https://bugs.webkit.org/show_bug.cgi?id=42328>
@@ -2032,16 +1965,18 @@ fast/dom/location-hash.html
 fast/history/history-length.html
 fast/loader/location-port.html
 fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html
+fast/loader/stateobjects/document-destroyed-navigate-back.html
 fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html
 fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html
 fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html
 fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html
 fast/loader/stateobjects/pushstate-clears-forward-history.html
+fast/loader/stateobjects/pushstate-then-replacestate.html
 fast/loader/stateobjects/pushstate-updates-location.html
 fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html
 fast/loader/stateobjects/pushstate-within-popstate-handler-assert.html
-fast/loader/stateobjects/pushstate-then-replacestate.html
-fast/loader/stateobjects/document-destroyed-navigate-back.html
+fast/loader/stateobjects/pushstate-without-history.html
+fast/loader/stateobjects/replacestate-then-pushstate.html
 http/tests/loading/state-object-security-exception.html
 
 # WebKitTestRunner needs textInputController
@@ -2289,6 +2224,7 @@ fast/events/keypress-insert-tab.html
 # WebKitTestRunner needs layoutTestController.setWindowIsKey
 # <https://bugs.webkit.org/show_bug.cgi?id=42688>
 editing/selection/4975120.html
+fast/events/show-modal-dialog-onblur-onfocus.html
 
 # WebKitTestRunner needs layoutTestController.setEditingBehavior
 # <https://bugs.webkit.org/show_bug.cgi?id=42689>
@@ -2355,11 +2291,6 @@ fast/loader/non-deferred-substitute-load.html
 # <https://bugs.webkit.org/show_bug.cgi?id=42778>
 http/tests/cookies/third-party-cookie-relaxing.html
 
-# WebKit2 needs layoutTestController.setCloseRemainingWindowsWhenComplete
-# <https://bugs.webkit.org/show_bug.cgi?id=42779>
-http/tests/security/popup-blocked-from-fake-event.html
-http/tests/security/popup-blocked-from-window-open.html
-
 # WebKitTestRunner needs GCController
 # <https://bugs.webkit.org/show_bug.cgi?id=42701>
 fast/dom/gc-10.html
@@ -2369,6 +2300,9 @@ fast/frames/removal-before-attach-crash.html
 # WebKitTestRunner needs to print onunload handler information
 # <https://bugs.webkit.org/show_bug.cgi?id=42703>
 fast/events/onunload-clears-onbeforeunload.html
+fast/events/onunload-not-on-body.html
+fast/events/onunload.html
+fast/events/pageshow-pagehide-on-back-uncached.html
 fast/events/pageshow-pagehide.html
 fast/events/stop-load-in-unload-handler-using-document-write.html
 fast/events/stop-load-in-unload-handler-using-window-stop.html
@@ -2377,6 +2311,8 @@ fast/frames/frame-unload-crash.html
 fast/loader/onunload-form-submit-crash-2.html
 fast/loader/onunload-form-submit-crash.html
 fast/loader/start-load-in-unload.html
+fast/loader/stateobjects/pushstate-in-iframe.html
+fast/loader/stateobjects/replacestate-in-iframe.html
 fast/loader/unload-form-about-blank.html
 fast/loader/unload-form-post-about-blank.html
 fast/loader/unload-form-post.html
@@ -2386,15 +2322,12 @@ fast/loader/unload-hyperlink.html
 fast/loader/unload-javascript-url.html
 fast/loader/unload-reload.html
 fast/loader/unload-window-location.html
+http/tests/navigation/history-back-across-form-submission-to-fragment.html
+http/tests/security/window-events-pass.html
 http/tests/xmlhttprequest/frame-load-cancelled-abort.html
 http/tests/xmlhttprequest/frame-unload-abort-crash.html
 http/tests/xmlhttprequest/send-undefined-and-null.html
 http/tests/xmlhttprequest/xhr-onunload.html
-fast/events/onunload.html
-fast/events/onunload-not-on-body.html
-fast/events/pageshow-pagehide-on-back-uncached.html
-http/tests/navigation/history-back-across-form-submission-to-fragment.html
-fast/loader/stateobjects/pushstate-in-iframe.html
 
 # WebKitTestRunner needs to print history delegate information
 # <https://bugs.webkit.org/show_bug.cgi?id=42704>
@@ -2440,6 +2373,20 @@ editing/deleting/smart-editing-disabled.html
 # WebKitTestRunner needs plainText.plainText
 editing/text-iterator/basic-iteration.html
 
+# WebKitTestRunner needs layoutTestController.setNewWindowsCopyBackForwardList
+fast/loader/crash-copying-backforwardlist.html
+
+# WebKitTestRunner needs layoutTestController.authenticateSession
+http/tests/xmlhttprequest/cross-origin-authorization-with-embedder.html
+
+# WebKitTestRunner needs layoutTestController.setPopupBlockingEnabled
+fast/events/popup-allowed-from-gesture-initiated-event.html
+fast/events/popup-allowed-from-gesture-initiated-form-submit.html
+fast/events/popup-blocked-from-fake-button-click.html
+fast/events/popup-blocked-from-fake-focus.html
+fast/events/popup-blocked-from-fake-user-gesture.html
+fast/events/popup-blocked-to-post-blank.html
+
 # WebKit2 needs support for moving/resizing and querying the location/size the window
 fast/dom/Window/window-lookup-precedence.html
 fast/dom/Window/window-resize-and-move-arguments.html
@@ -2477,6 +2424,9 @@ http/tests/xmlhttprequest/logout.html
 http/tests/xmlhttprequest/re-login-async.html
 http/tests/xmlhttprequest/re-login.html
 
+# WebKit2 needs showModalDialog
+fast/harness/show-modal-dialog.html
+
 # WebKit2 needs to support synchronous creation of about:blank/data:url frames'
 editing/selection/DOMSelection-crossing-document.html
 fast/dom/Document/document-write-doctype.html
@@ -2538,6 +2488,40 @@ http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-sub-frame.html
 http/tests/security/javascriptURL/xss-DENIED-to-javascript-url-in-foreign-domain-subframe.html
 http/tests/security/protocol-compare-case-insensitive.html
 
+# Unexplained failures that were formerly in the setCanOpenWindows or setCloseRemainingWindowsWhenComplete lists.
+fast/dom/Window/new-window-opener.html
+fast/dom/open-and-close-by-DOM.html
+fast/frames/iframe-reparenting-new-page.html
+fast/parser/xhtml-close-while-parsing.xhtml
+http/tests/media/video-cancel-load.html
+http/tests/misc/set-window-opener-to-null.html
+http/tests/misc/window-open-then-write.html
+http/tests/navigation/target-frame-from-window.html
+http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write.html
+http/tests/security/aboutBlank/xss-DENIED-navigate-opener-javascript-url.html
+http/tests/security/aboutBlank/xss-DENIED-set-opener.html
+http/tests/security/cross-frame-access-call.html
+http/tests/security/dataURL/xss-DENIED-from-data-url-in-foreign-domain-window-open.html
+http/tests/security/dataURL/xss-DENIED-from-javascript-url-window-open.html
+http/tests/security/dataURL/xss-DENIED-to-data-url-in-foreign-domain-window-open.html
+http/tests/security/dataURL/xss-DENIED-to-data-url-window-open.html
+http/tests/security/frameNavigation/opener.html
+http/tests/security/frameNavigation/xss-DENIED-plugin-navigation.html
+http/tests/security/frameNavigation/xss-DENIED-targeted-link-navigation.html
+http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.html
+http/tests/security/javascriptURL/xss-DENIED-from-javascript-url-in-foreign-domain-window-open.html
+http/tests/security/javascriptURL/xss-DENIED-to-javascript-url-in-foreign-domain-window-open.html
+http/tests/security/window-events-clear-port.html
+http/tests/xmlhttprequest/close-window.html
+http/tests/xmlhttprequest/cross-origin-authorization.html
+http/tests/xmlhttprequest/cross-origin-no-authorization.html
+http/tests/xmlhttprequest/request-from-popup.html
+plugins/access-after-page-destroyed.html
+storage/domstorage/localstorage/window-open.html
+storage/domstorage/sessionstorage/window-open.html
+http/tests/security/popup-blocked-from-fake-event.html
+http/tests/security/popup-blocked-from-window-open.html
+
 # Unexplained failures that were formerly in the "unsafe access" list.
 http/tests/security/cross-frame-access-child-explicit-domain.html
 http/tests/security/cross-frame-access-enumeration.html
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 4f73f98..35a3392 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,52 @@
+2010-08-02  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WebKitTestRunner needs layoutTestController.setCanOpenWindows
+        https://bugs.webkit.org/show_bug.cgi?id=42321
+
+        WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
+        https://bugs.webkit.org/show_bug.cgi?id=42779
+
+        Implemented window.close, added a function that does a similar operation on behalf
+        of injected bundle code named WKBundlePageClose, and fixed the reference counting of
+        the result of the createNewPage client function.
+
+        * UIProcess/API/cpp/WKRetainPtr.h: Added clear. Tweaked formatting. Renamed
+        releaseRef to leakRef.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _updateVisibility]): Handle the case where drawing area is 0. This
+        came up in WebKitTestRunner and other functions handle drawing area of 0.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveSyncMessage): Update now that createNewPage
+        returns a PassRefPtr.
+        (WebKit::WebPageProxy::createNewPage): Changed to return a PassRefPtr.
+        * UIProcess/WebPageProxy.h: Ditto.
+
+        * UIProcess/WebUIClient.cpp:
+        (WebKit::WebUIClient::createNewPage): Changed to return a PassRefPtr and adopt
+        the WKPageRef passed from the client. This follows the "create rule".
+        * UIProcess/WebUIClient.h: Ditto.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageClose): Added.
+        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: Added WKBundlePageClose
+        and re-sorted the other functions in this file.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::closeWindowSoon): Implemented this.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Called setJavaScriptCanOpenWindowsAutomatically(true).
+        I suppose we will need to revisit this later when we implement pop-up blocking.
+        (WebKit::WebPage::tryClose): Factored out the part of this that sends a message
+        to the other process.
+        (WebKit::WebPage::sendClose): This is where the part that sends a message went.
+        * WebProcess/WebPage/WebPage.h: Added sendClose, used by both closeWindowSoon
+        and WKBundlePageClose.
+
 2010-08-02  John Sullivan  <sullivan at apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=43369
diff --git a/WebKit2/UIProcess/API/cpp/WKRetainPtr.h b/WebKit2/UIProcess/API/cpp/WKRetainPtr.h
index d5f1270..e9322a7 100644
--- a/WebKit2/UIProcess/API/cpp/WKRetainPtr.h
+++ b/WebKit2/UIProcess/API/cpp/WKRetainPtr.h
@@ -32,8 +32,7 @@ namespace WebKit {
 
 enum WKAdoptTag { AdoptWK };
 
-template <typename T>
-class WKRetainPtr {
+template<typename T> class WKRetainPtr {
 public:
     typedef T PtrType;
 
@@ -54,8 +53,7 @@ public:
     {
     }
     
-    template <typename U>
-    WKRetainPtr(const WKRetainPtr<U>& o)
+    template<typename U> WKRetainPtr(const WKRetainPtr<U>& o)
         : m_ptr(o.get())
     {
         if (PtrType ptr = m_ptr)
@@ -76,7 +74,20 @@ public:
     }
 
     PtrType get() const { return m_ptr; }
-    PtrType releaseRef() { PtrType tmp = m_ptr; m_ptr = 0; return tmp; }
+
+    void clear()
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = 0;
+        if (ptr)
+            WKRelease(ptr);
+    }
+    PtrType leakRef()
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = 0;
+        return ptr;
+    }
     
     PtrType operator->() const { return m_ptr; }
     bool operator!() const { return !m_ptr; }
@@ -93,6 +104,9 @@ public:
     void adopt(PtrType);
     void swap(WKRetainPtr&);
 
+    // FIXME: Remove once all callers are calling leakRef.
+    PtrType releaseRef() { leakRef(); }
+
 private:
     PtrType m_ptr;
 };
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index 664f32d..b00b96d 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -236,7 +236,8 @@ static bool isViewVisible(NSView *view)
 - (void)_updateVisibility
 {
     _data->_page->setIsInWindow([self window]);
-    _data->_page->drawingArea()->setPageIsVisible(isViewVisible(self));
+    if (DrawingAreaProxy* area = _data->_page->drawingArea())
+        area->setPageIsVisible(isViewVisible(self));
 }
 
 - (void)viewWillMoveToWindow:(NSWindow *)window
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 5ef7e6f..6d85bbd 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -590,7 +590,7 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP
 
     switch (messageID.get<WebPageProxyMessage::Kind>()) {
         case WebPageProxyMessage::CreateNewPage: {
-            WebPageProxy* newPage = createNewPage();
+            RefPtr<WebPageProxy> newPage = createNewPage();
             if (newPage) {
                 // FIXME: Pass the real size.
                 reply.encode(CoreIPC::In(newPage->pageID(), IntSize(100, 100), 
@@ -794,7 +794,7 @@ void WebPageProxy::decidePolicyForMIMEType(WebFrameProxy* frame, const String& M
 }
 
 // UIClient
-WebPageProxy* WebPageProxy::createNewPage()
+PassRefPtr<WebPageProxy> WebPageProxy::createNewPage()
 {
     return m_uiClient.createNewPage(this);
 }
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 21274c8..77c2881 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -186,7 +186,7 @@ private:
     void decidePolicyForNewWindowAction(WebFrameProxy*, WebCore::NavigationType navigationType, const WebCore::String& url, uint64_t listenerID);
     void decidePolicyForMIMEType(WebFrameProxy*, const WebCore::String& MIMEType, const WebCore::String& url, uint64_t listenerID);
 
-    WebPageProxy* createNewPage();
+    PassRefPtr<WebPageProxy> createNewPage();
     void showPage();
     void closePage();
     void runJavaScriptAlert(WebFrameProxy*, const WebCore::String&);
diff --git a/WebKit2/UIProcess/WebUIClient.cpp b/WebKit2/UIProcess/WebUIClient.cpp
index db7054d..8c3942d 100644
--- a/WebKit2/UIProcess/WebUIClient.cpp
+++ b/WebKit2/UIProcess/WebUIClient.cpp
@@ -26,6 +26,7 @@
 #include "WebUIClient.h"
 
 #include "WKAPICast.h"
+#include "WebPageProxy.h"
 #include <WebCore/PlatformString.h>
 #include <string.h>
 
@@ -46,12 +47,12 @@ void WebUIClient::initialize(const WKPageUIClient* client)
         memset(&m_pageUIClient, 0, sizeof(m_pageUIClient));
 }
 
-WebPageProxy* WebUIClient::createNewPage(WebPageProxy* page)
+PassRefPtr<WebPageProxy> WebUIClient::createNewPage(WebPageProxy* page)
 {
     if (!m_pageUIClient.createNewPage)
         return 0;
     
-    return toWK(m_pageUIClient.createNewPage(toRef(page), m_pageUIClient.clientInfo));
+    return adoptRef(toWK(m_pageUIClient.createNewPage(toRef(page), m_pageUIClient.clientInfo)));
 } 
 
 void WebUIClient::showPage(WebPageProxy* page)
diff --git a/WebKit2/UIProcess/WebUIClient.h b/WebKit2/UIProcess/WebUIClient.h
index 27c5bc0..df2e715 100644
--- a/WebKit2/UIProcess/WebUIClient.h
+++ b/WebKit2/UIProcess/WebUIClient.h
@@ -27,6 +27,7 @@
 #define WebUIClient_h
 
 #include "WKPage.h"
+#include <wtf/PassRefPtr.h>
 
 namespace WebCore {
     class String;
@@ -42,7 +43,7 @@ public:
     WebUIClient();
     void initialize(const WKPageUIClient*);
 
-    WebPageProxy* createNewPage(WebPageProxy*);
+    PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*);
     void showPage(WebPageProxy*);
     void close(WebPageProxy*);
     void runJavaScriptAlert(WebPageProxy*, const WebCore::String&, WebFrameProxy*);
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index dee1ec4..fd2582f 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -80,3 +80,8 @@ void WKBundlePageClearMainFrameName(WKBundlePageRef pageRef)
 {
     toWK(pageRef)->clearMainFrameName();
 }
+
+void WKBundlePageClose(WKBundlePageRef pageRef)
+{
+    toWK(pageRef)->sendClose();
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
index 93f3696..09391f9 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
@@ -33,10 +33,11 @@
 extern "C" {
 #endif
 
-WK_EXPORT WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef page);
-WK_EXPORT void WKBundlePageExecuteEditingCommand(WKBundlePageRef page, WKStringRef commandName, WKStringRef argument);
 WK_EXPORT bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef page, WKStringRef commandName);
 WK_EXPORT void WKBundlePageClearMainFrameName(WKBundlePageRef page);
+WK_EXPORT void WKBundlePageClose(WKBundlePageRef page);
+WK_EXPORT WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef page);
+WK_EXPORT void WKBundlePageExecuteEditingCommand(WKBundlePageRef page, WKStringRef commandName, WKStringRef argument);
 
 #ifdef __cplusplus
 }
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index 4def7c5..e7b53c8 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -40,6 +40,7 @@
 #include <WebCore/FileChooser.h>
 #include <WebCore/Frame.h>
 #include <WebCore/FrameLoader.h>
+#include <WebCore/Page.h>
 #include <WebCore/SecurityOrigin.h>
 
 using namespace WebCore;
@@ -208,7 +209,21 @@ bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame*
 
 void WebChromeClient::closeWindowSoon()
 {
-    notImplemented();
+    // FIXME: This code assumes that the client will respond to a close page
+    // message by actually closing the page. Safari does this, but there is
+    // no guarantee that other applications will, which will leave this page
+    // half detached. This approach is an inherent limitation making parts of
+    // a close execute synchronously as part of window.close, but other parts
+    // later on.
+
+    m_page->corePage()->setGroupName(String());
+
+    if (WebFrame* frame = m_page->mainFrame()) {
+        if (Frame* coreFrame = frame->coreFrame())
+            coreFrame->loader()->stopForUserCancel();
+    }
+
+    m_page->sendClose();
 }
 
 void WebChromeClient::runJavaScriptAlert(Frame* frame, const String& alertText)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 902833d..76c5ca2 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -111,6 +111,8 @@ WebPage::WebPage(uint64_t pageID, const IntSize& viewSize, const WebPreferencesS
     m_page->settings()->setSansSerifFontFamily(store.sansSerifFontFamily);
     m_page->settings()->setSerifFontFamily(store.serifFontFamily);
 
+    m_page->settings()->setJavaScriptCanOpenWindowsAutomatically(true);
+
     m_page->setGroupName("WebKit2Group");
     
     platformInitialize();
@@ -237,6 +239,11 @@ void WebPage::tryClose()
     if (!m_mainFrame->coreFrame()->loader()->shouldClose())
         return;
 
+    sendClose();
+}
+
+void WebPage::sendClose()
+{
     WebProcess::shared().connection()->send(WebPageProxyMessage::ClosePage, m_pageID, CoreIPC::In());
 }
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 617e26e..a5d9557 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -109,6 +109,7 @@ public:
     void executeEditingCommand(const WebCore::String& commandName, const WebCore::String& argument);
     bool isEditingCommandEnabled(const WebCore::String& commandName);
     void clearMainFrameName();
+    void sendClose();
 
 #if USE(ACCELERATED_COMPOSITING)
     void changeAcceleratedCompositingMode(WebCore::GraphicsLayer*);
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 00d5860..745d931 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,68 @@
+2010-08-02  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WebKitTestRunner needs layoutTestController.setCanOpenWindows
+        https://bugs.webkit.org/show_bug.cgi?id=42321
+
+        WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
+        https://bugs.webkit.org/show_bug.cgi?id=42779
+
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: Added
+        setCanOpenWindows, setCloseRemainingWindowsWhenComplete, and windowCount
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::InjectedBundle): Initialize m_mainPage to 0 instead of
+        waiting for the first call to didCreatePage.
+        (WTR::InjectedBundle::didCreatePage): Set m_mainPage only when the first page
+        is created. Put other pages into a map.
+        (WTR::InjectedBundle::willDestroyPage): Added code to handle the destruction
+        of the main page.
+        (WTR::InjectedBundle::closeOtherPages): Added. Closes all the pages other than
+        the main page.
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h: Added pageCount and
+        closeOtherPages functions.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::didFinishLoadForFrame): Don't let pages other than
+        the main page affect dumping.
+        (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame): Ditto.
+
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::LayoutTestController): Initialize the new
+        m_shouldCloseExtraWindows member.
+        (WTR::LayoutTestController::setCanOpenWindows): Added. Empty for now.
+        (WTR::LayoutTestController::windowCount): Added.
+
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+        Added setCanOpenWindows, setCloseRemainingWindowsWhenComplete,
+        windowCount, shouldCloseExtraWindowsAfterRunningTest, and
+        m_shouldCloseExtraWindows.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::shared): Return a pointer to the shared copy, but
+        don't allocate and leak it. This seemed cleaner than adding an explicit
+        finalize call to go along with the explicit initialize call.
+        (WTR::TestController::TestController): Added calls to the initialize and
+        run function, which are now done automatically.
+        (WTR::TestController::~TestController): Added, since it's called now.
+        (WTR::closeOtherPage): Added. Used to close pages other than the main page.
+        (WTR::createOtherPage): Added. Used to create pages other than the main page.
+        (WTR::TestController::initialize): Added code to set up createOtherPage.
+        (WTR::TestController::run): Removed unused return value.
+        * WebKitTestRunner/TestController.h: Made constructor and destructor public,
+        and initialize and run private. Changed m_mainWebView to be an OwnPtr.
+
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::PlatformWebView): Added a call to setReleasedWhenClosed
+        to avoid releasing the window twice. Another way to handle it would be to
+        remove the release, but this approach is slightly more robust because it works
+        even if some other code calls the close method an extra time.
+
+        * WebKitTestRunner/mac/main.mm:
+        (main): Use a stack-allocated TestController object instead of calling
+        initalize and run on a globally allocated one.
+
 2010-08-02  Tony Chang  <tony at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
index a0fbb85..2eca583 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
@@ -41,6 +41,9 @@ module WTR {
         // Special options.
         void keepWebHistory();
         void setAcceptsEditing(in boolean value);
+        void setCanOpenWindows(in boolean value);
+        void setCloseRemainingWindowsWhenComplete(in boolean value);
+        unsigned long windowCount();
 
         // Special DOM functions.
         object computedStyleIncludingVisitedInfo(in object element);
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index 8e661b7..095bd9c 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -27,13 +27,16 @@
 
 #include "ActivateFonts.h"
 #include "InjectedBundlePage.h"
-#include <WebKit2/WebKit2.h>
 #include <WebKit2/WKBundle.h>
 #include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundlePagePrivate.h>
 #include <WebKit2/WKBundlePrivate.h>
 #include <WebKit2/WKRetainPtr.h>
 #include <WebKit2/WKStringCF.h>
+#include <WebKit2/WebKit2.h>
+#include <wtf/PassOwnPtr.h>
 #include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
 
 namespace WTR {
 
@@ -45,6 +48,7 @@ InjectedBundle& InjectedBundle::shared()
 
 InjectedBundle::InjectedBundle()
     : m_bundle(0)
+    , m_mainPage(0)
 {
 }
 
@@ -93,13 +97,19 @@ void InjectedBundle::done()
 void InjectedBundle::didCreatePage(WKBundlePageRef page)
 {
     // FIXME: we really need the main page ref to be sent over from the ui process
-    m_mainPage = new InjectedBundlePage(page);
-    m_pages.add(page, m_mainPage);
+    OwnPtr<InjectedBundlePage> pageWrapper = adoptPtr(new InjectedBundlePage(page));
+    if (!m_mainPage)
+        m_mainPage = pageWrapper.release();
+    else
+        m_otherPages.add(page, pageWrapper.leakPtr());
 }
 
 void InjectedBundle::willDestroyPage(WKBundlePageRef page)
 {
-    delete m_pages.take(page);
+    if (m_mainPage && m_mainPage->page() == page)
+        m_mainPage.clear();
+    else
+        delete m_otherPages.take(page);
 }
 
 void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
@@ -133,4 +143,12 @@ void InjectedBundle::setShouldTrackVisitedLinks()
     WKBundleSetShouldTrackVisitedLinks(m_bundle, true);
 }
 
+void InjectedBundle::closeOtherPages()
+{
+    Vector<WKBundlePageRef> pages;
+    copyKeysToVector(m_otherPages, pages);
+    for (size_t i = 0; i < pages.size(); ++i)
+        WKBundlePageClose(pages[i]);
+}
+
 } // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
index 28b56a7..42eb3a1 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
@@ -30,6 +30,7 @@
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKBundleBase.h>
 #include <wtf/HashMap.h>
+#include <wtf/OwnPtr.h>
 #include <wtf/RefPtr.h>
 
 #include <sstream>
@@ -48,7 +49,9 @@ public:
     void done();
 
     LayoutTestController* layoutTestController() { return m_layoutTestController.get(); }
-    InjectedBundlePage* page() { return m_mainPage; }
+    InjectedBundlePage* page() { return m_mainPage.get(); }
+    size_t pageCount() { return !!m_mainPage + m_otherPages.size(); }
+    void closeOtherPages();
 
     std::ostringstream& os() { return m_outputStream; }
 
@@ -69,8 +72,8 @@ private:
     void reset();
 
     WKBundleRef m_bundle;
-    HashMap<WKBundlePageRef, InjectedBundlePage*> m_pages;
-    InjectedBundlePage* m_mainPage;
+    HashMap<WKBundlePageRef, InjectedBundlePage*> m_otherPages;
+    OwnPtr<InjectedBundlePage> m_mainPage;
 
     RefPtr<LayoutTestController> m_layoutTestController;
 
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 2f3d5a2..406787e 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -331,6 +331,9 @@ void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame)
 
     m_isLoading = false;
 
+    if (this != InjectedBundle::shared().page())
+        return;
+
     if (InjectedBundle::shared().layoutTestController()->waitToDump())
         return;
 
@@ -344,6 +347,9 @@ void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame)
 
     m_isLoading = false;
 
+    if (this != InjectedBundle::shared().page())
+        return;
+
     InjectedBundle::shared().done();
 }
 
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index 2f59eb1..8fda21e 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -116,6 +116,7 @@ LayoutTestController::LayoutTestController()
     : m_whatToDump(RenderTree)
     , m_shouldDumpAllFrameScrollPositions(false)
     , m_shouldAllowEditing(true)
+    , m_shouldCloseExtraWindows(false)
     , m_dumpEditingCallbacks(false)
     , m_dumpStatusCallbacks(false)
     , m_waitToDump(false)
@@ -242,6 +243,17 @@ bool LayoutTestController::isCommandEnabled(JSStringRef name)
     return WKBundlePageIsEditingCommandEnabled(InjectedBundle::shared().page()->page(), toWK(name).get());
 }
 
+void LayoutTestController::setCanOpenWindows(bool)
+{
+    // It's not clear if or why any tests require opening windows be forbidden.
+    // For now, just ignore this setting, and if we find later it's needed we can add it.
+}
+
+unsigned LayoutTestController::windowCount()
+{
+    return InjectedBundle::shared().pageCount();
+}
+
 // Object Creation
 
 void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index 9f0641b..75aeb9e 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -60,6 +60,9 @@ public:
     // Special options.
     void keepWebHistory();
     void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; }
+    void setCanOpenWindows(bool);
+    void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; }
+    unsigned windowCount();
 
     // Special DOM functions.
     JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element);
@@ -92,12 +95,17 @@ public:
 
     bool shouldAllowEditing() const { return m_shouldAllowEditing; }
 
+    bool shouldCloseExtraWindowsAfterRunningTest() const { return m_shouldCloseExtraWindows; }
+
 private:
     LayoutTestController();
 
     WhatToDump m_whatToDump;
     bool m_shouldDumpAllFrameScrollPositions;
+
     bool m_shouldAllowEditing;
+    bool m_shouldCloseExtraWindows;
+
     bool m_dumpEditingCallbacks;
     bool m_dumpStatusCallbacks;
     bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index a5b0de2..93857a7 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -28,21 +28,62 @@
 #include "PlatformWebView.h"
 #include "TestInvocation.h"
 #include <WebKit2/WKContextPrivate.h>
+#include <wtf/PassOwnPtr.h>
 
 namespace WTR {
 
+static TestController* controller;
+
 TestController& TestController::shared()
 {
-    static TestController& shared = *new TestController;
-    return shared;
+    ASSERT(controller);
+    return *controller;
 }
 
-TestController::TestController()
+TestController::TestController(int argc, const char* argv[])
     : m_dumpPixels(false)
     , m_verbose(false)
     , m_printSeparators(false)
     , m_usingServerMode(false)
 {
+    initialize(argc, argv);
+    controller = this;
+    run();
+    controller = 0;
+}
+
+TestController::~TestController()
+{
+}
+
+static void closeOtherPage(WKPageRef page, const void* clientInfo)
+{
+    WKPageClose(page);
+    const PlatformWebView* view = static_cast<const PlatformWebView*>(clientInfo);
+    delete view;
+}
+
+static WKPageRef createOtherPage(WKPageRef oldPage, const void*)
+{
+    PlatformWebView* view = new PlatformWebView(WKPageGetPageNamespace(oldPage));
+    WKPageRef newPage = view->page();
+
+    view->resizeTo(800, 600);
+
+    WKPageUIClient otherPageUIClient = {
+        0,
+        view,
+        createOtherPage,
+        0,
+        closeOtherPage,
+        0,
+        0,
+        0
+    };
+    WKPageSetPageUIClient(newPage, &otherPageUIClient);
+
+    WKRetain(newPage);
+    return newPage;
 }
 
 void TestController::initialize(int argc, const char* argv[])
@@ -79,17 +120,29 @@ void TestController::initialize(int argc, const char* argv[])
 
     m_context.adopt(WKContextCreateWithInjectedBundlePath(injectedBundlePath()));
 
-    WKContextInjectedBundleClient injectedBundlePathClient = {
+    WKContextInjectedBundleClient injectedBundleClient = {
         0,
         this,
         didReceiveMessageFromInjectedBundle
     };
-    WKContextSetInjectedBundleClient(m_context.get(), &injectedBundlePathClient);
+    WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient);
 
     _WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
     
     m_pageNamespace.adopt(WKPageNamespaceCreate(m_context.get()));
-    m_mainWebView = new PlatformWebView(m_pageNamespace.get());
+    m_mainWebView = adoptPtr(new PlatformWebView(m_pageNamespace.get()));
+
+    WKPageUIClient pageUIClient = {
+        0,
+        this,
+        createOtherPage,
+        0,
+        0,
+        0,
+        0,
+        0
+    };
+    WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
 }
 
 void TestController::runTest(const char* test)
@@ -114,7 +167,7 @@ void TestController::runTestingServerLoop()
     }
 }
 
-bool TestController::run()
+void TestController::run()
 {
     if (m_usingServerMode)
         runTestingServerLoop();
@@ -122,8 +175,6 @@ bool TestController::run()
         for (size_t i = 0; i < m_paths.size(); ++i)
             runTest(m_paths[i].c_str());
     }
-
-    return true;
 }
 
 void TestController::didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
diff --git a/WebKitTools/WebKitTestRunner/TestController.h b/WebKitTools/WebKitTestRunner/TestController.h
index f79b35c..5754728 100644
--- a/WebKitTools/WebKitTestRunner/TestController.h
+++ b/WebKitTools/WebKitTestRunner/TestController.h
@@ -36,28 +36,26 @@ namespace WTR {
 class TestInvocation;
 class PlatformWebView;
 
+// FIXME: Rename this TestRunner?
 class TestController {
 public:
     static TestController& shared();
 
-    // Initialize the TestController.
-    void initialize(int argc, const char *argv[]);
-
-    // Returns true if all the tests passed, false otherwise.
-    bool run();
+    TestController(int argc, const char* argv[]);
+    ~TestController();
 
     bool verbose() const { return m_verbose; }
 
     WKStringRef injectedBundlePath() { return m_injectedBundlePath.get(); }
     WKStringRef testPluginDirectory() { return m_testPluginDirectory.get(); }
 
-    PlatformWebView* mainWebView() { return m_mainWebView; }
+    PlatformWebView* mainWebView() { return m_mainWebView.get(); }
     WKPageNamespaceRef pageNamespace() { return m_pageNamespace.get(); }
     WKContextRef context() { return m_context.get(); }
 
 private:
-    TestController();
-    ~TestController();
+    void initialize(int argc, const char* argv[]);
+    void run();
 
     void runTestingServerLoop();
     void runTest(const char* pathOrURL);
@@ -80,7 +78,7 @@ private:
     WKRetainPtr<WKStringRef> m_injectedBundlePath;
     WKRetainPtr<WKStringRef> m_testPluginDirectory;
 
-    PlatformWebView* m_mainWebView;
+    OwnPtr<PlatformWebView> m_mainWebView;
     WKRetainPtr<WKContextRef> m_context;
     WKRetainPtr<WKPageNamespaceRef> m_pageNamespace;
 };
diff --git a/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm b/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm
index 21db2eb..4e2a60c 100644
--- a/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm
+++ b/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm
@@ -38,6 +38,7 @@ PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef)
     [[m_window contentView] addSubview:m_view];
     [m_window orderBack:nil];
     [m_window setAutodisplay:NO];
+    [m_window setReleasedWhenClosed:NO];
 }
 
 void PlatformWebView::resizeTo(unsigned width, unsigned height)
diff --git a/WebKitTools/WebKitTestRunner/mac/main.mm b/WebKitTools/WebKitTestRunner/mac/main.mm
index 021c124..d2f26ab 100644
--- a/WebKitTools/WebKitTestRunner/mac/main.mm
+++ b/WebKitTools/WebKitTestRunner/mac/main.mm
@@ -28,13 +28,10 @@
 int main(int argc, const char* argv[])
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
     [NSApplication sharedApplication];
-
-    WTR::TestController::shared().initialize(argc, argv);
-    WTR::TestController::shared().run();
-
+    {
+        WTR::TestController controller(argc, argv);
+    }
     [pool drain];
-
     return 0;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list