Changeset 64485 in webkit


Ignore:
Timestamp:
Aug 2, 2010 12:10:22 PM (14 years ago)
Author:
Darin Adler
Message:

2010-08-02 Darin Adler <Darin Adler>

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 Adler>

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 Adler>

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.
Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64483 r64485  
     12010-08-02  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        WebKitTestRunner needs layoutTestController.setCanOpenWindows
     6        https://bugs.webkit.org/show_bug.cgi?id=42321
     7
     8        WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
     9        https://bugs.webkit.org/show_bug.cgi?id=42779
     10
     11        * platform/mac-wk2/Skipped: Removed tests that are now passing. Moved other tests
     12        into the appropriate section.
     13
    1142010-08-02  Andrew Wilson  <atwilson@chromium.org>
    215
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r64447 r64485  
    809809fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html
    810810fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html
    811 fast/dom/elementFromPoint-relative-to-viewport.html
    812811fast/dom/HTMLTableColElement/resize-table-using-col-width.html
    813812fast/dom/Node/mutation-blur.html
    814 fast/dom/replaced-image-map.html
    815813fast/dom/Window/window-postmessage-clone-frames.html
    816814fast/dom/Window/window-postmessage-clone.html
    817815fast/dom/Window/window-xy-properties.html
     816fast/dom/elementFromPoint-relative-to-viewport.html
     817fast/dom/replaced-image-map.html
    818818fast/dynamic/hover-style-recalc-crash.html
    819819fast/dynamic/hovered-detach.html
     
    10011001fast/frames/iframe-window-focus.html
    10021002fast/frames/take-focus-from-iframe.html
     1003fast/history/history_reload.html
     1004fast/history/window-open.html
    10031005fast/images/drag-pdf-as-image.html
    10041006fast/images/drag-svg-as-image.html
     
    10411043http/tests/misc/drag-over-iframe-invalid-source-crash.html
    10421044http/tests/misc/isindex-with-no-form.html
     1045http/tests/navigation/no-referrer-reset.html
    10431046http/tests/navigation/no-referrer-same-window.html
    10441047http/tests/navigation/no-referrer-subframe.html
     1048http/tests/navigation/no-referrer-target-blank.html
    10451049http/tests/navigation/redirect-preserves-referrer.html
    10461050http/tests/security/clipboard/clipboard-file-access.html
     
    10631067scrollbars/scrollbar-miss-mousemove-disabled.html
    10641068scrollbars/scrollbar-miss-mousemove.html
     1069svg/animations/animVal-basics.html
    10651070svg/animations/animate-gradient-transform.html
    10661071svg/animations/animate-keySplines.html
    10671072svg/animations/animate-points.html
    1068 svg/animations/animVal-basics.html
    10691073svg/custom/circle-move-invalidation.svg
    10701074svg/custom/clip-path-child-changes.svg
     
    12121216svg/dynamic-updates/SVGImageElement-svgdom-x-prop.html
    12131217svg/dynamic-updates/SVGImageElement-svgdom-y-prop.html
     1218svg/dynamic-updates/SVGLineElement-dom-x1-attr.html
     1219svg/dynamic-updates/SVGLineElement-dom-x2-attr.html
     1220svg/dynamic-updates/SVGLineElement-dom-y1-attr.html
     1221svg/dynamic-updates/SVGLineElement-dom-y2-attr.html
     1222svg/dynamic-updates/SVGLineElement-svgdom-x1-prop.html
     1223svg/dynamic-updates/SVGLineElement-svgdom-x2-prop.html
     1224svg/dynamic-updates/SVGLineElement-svgdom-y1-prop.html
     1225svg/dynamic-updates/SVGLineElement-svgdom-y2-prop.html
    12141226svg/dynamic-updates/SVGLinearGradientElement-dom-gradientTransform-attr.html
    12151227svg/dynamic-updates/SVGLinearGradientElement-dom-gradientUnits-attr.html
     
    12241236svg/dynamic-updates/SVGLinearGradientElement-svgdom-y1-prop.html
    12251237svg/dynamic-updates/SVGLinearGradientElement-svgdom-y2-prop.html
    1226 svg/dynamic-updates/SVGLineElement-dom-x1-attr.html
    1227 svg/dynamic-updates/SVGLineElement-dom-x2-attr.html
    1228 svg/dynamic-updates/SVGLineElement-dom-y1-attr.html
    1229 svg/dynamic-updates/SVGLineElement-dom-y2-attr.html
    1230 svg/dynamic-updates/SVGLineElement-svgdom-x1-prop.html
    1231 svg/dynamic-updates/SVGLineElement-svgdom-x2-prop.html
    1232 svg/dynamic-updates/SVGLineElement-svgdom-y1-prop.html
    1233 svg/dynamic-updates/SVGLineElement-svgdom-y2-prop.html
    12341238svg/dynamic-updates/SVGMarkerElement-dom-markerHeight-attr.html
    12351239svg/dynamic-updates/SVGMarkerElement-dom-markerUnits-attr.html
     
    12951299svg/dynamic-updates/SVGRectElement-svgdom-x-prop.html
    12961300svg/dynamic-updates/SVGRectElement-svgdom-y-prop.html
     1301svg/dynamic-updates/SVGTRefElement-dom-href-attr.html
    12971302svg/dynamic-updates/SVGTextElement-dom-transform-attr.html
    12981303svg/dynamic-updates/SVGTextElement-svgdom-rotate-prop.html
    12991304svg/dynamic-updates/SVGTextElement-svgdom-transform-prop.html
    1300 svg/dynamic-updates/SVGTRefElement-dom-href-attr.html
    13011305svg/filters/filter-width-update.svg
    13021306svg/text/select-textLength-spacing-squeeze-1.svg
     
    15051509compositing/webgl/webgl-background-color.html
    15061510compositing/webgl/webgl-reflection.html
     1511fast/canvas/webgl/array-buffer-crash.html
    15071512fast/canvas/webgl/array-buffer-view-crash.html
    15081513fast/canvas/webgl/array-get-and-set-method-removal.html
     
    15121517fast/canvas/webgl/array-unit-tests.html
    15131518fast/canvas/webgl/buffer-bind-test.html
     1519fast/canvas/webgl/buffer-data-array-buffer.html
     1520fast/canvas/webgl/canvas-test.html
    15141521fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html
    15151522fast/canvas/webgl/context-attributes.html
     
    15251532fast/canvas/webgl/gl-get-calls.html
    15261533fast/canvas/webgl/gl-object-get-calls.html
     1534fast/canvas/webgl/gl-pixelstorei.html
    15271535fast/canvas/webgl/gl-uniform-arrays.html
    15281536fast/canvas/webgl/gl-uniformmatrix4fv.html
     
    15311539fast/canvas/webgl/index-validation-copies-indices.html
    15321540fast/canvas/webgl/index-validation-crash-with-buffer-sub-data.html
     1541fast/canvas/webgl/index-validation-verifies-too-many-indices.html
     1542fast/canvas/webgl/index-validation-with-resized-buffer.html
    15331543fast/canvas/webgl/index-validation.html
    1534 fast/canvas/webgl/index-validation-with-resized-buffer.html
    15351544fast/canvas/webgl/invalid-UTF-16.html
     1545fast/canvas/webgl/invalid-passed-params.html
    15361546fast/canvas/webgl/null-object-behaviour.html
    15371547fast/canvas/webgl/null-uniform-location.html
    15381548fast/canvas/webgl/point-size.html
    15391549fast/canvas/webgl/program-test.html
     1550fast/canvas/webgl/read-pixels-pack-alignment.html
    15401551fast/canvas/webgl/renderbuffer-initialization.html
    15411552fast/canvas/webgl/tex-image-and-sub-image-2d-with-array-buffer-view.html
    15421553fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data.html
    15431554fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html
     1555fast/canvas/webgl/tex-image-and-uniform-binding-bugs.html
    15441556fast/canvas/webgl/tex-image-with-format-and-type.html
    15451557fast/canvas/webgl/tex-input-validation.html
     
    15481560fast/canvas/webgl/texImageTest.html
    15491561fast/canvas/webgl/texture-active-bind.html
     1562fast/canvas/webgl/texture-complete.html
    15501563fast/canvas/webgl/texture-npot.html
     1564fast/canvas/webgl/texture-transparent-pixels-initialized.html
    15511565fast/canvas/webgl/triangle.html
    15521566fast/canvas/webgl/uniform-location.html
     
    15541568fast/canvas/webgl/webgl-array-invalid-ranges.html
    15551569fast/dom/Window/timer-resume-on-navigation-back.html
     1570fast/events/pageshow-pagehide-on-back-cached-with-frames.html
    15561571fast/events/pageshow-pagehide-on-back-cached.html
    1557 fast/events/pageshow-pagehide-on-back-cached-with-frames.html
    15581572fast/events/tab-focus-anchor.html
     1573fast/frames/frame-crash-with-page-cache.html
    15591574fast/harness/override-preferences-2.html
    15601575fast/harness/override-preferences.html
     1576fast/harness/page-cache-crash-on-data-urls.html
    15611577fast/harness/use-page-cache.html
    15621578fast/history/timed-refresh-in-cached-frame.html
     
    15651581fast/parser/noscript-with-javascript-disabled.html
    15661582fast/parser/noscript-with-javascript-enabled.html
    1567 loader/go-back-to-different-window-size.html
    1568 fast/canvas/webgl/array-buffer-crash.html
    1569 fast/canvas/webgl/buffer-data-array-buffer.html
    1570 fast/canvas/webgl/index-validation-verifies-too-many-indices.html
    1571 fast/canvas/webgl/tex-image-and-uniform-binding-bugs.html
    1572 fast/canvas/webgl/texture-complete.html
    1573 fast/canvas/webgl/texture-transparent-pixels-initialized.html
    15741583fast/repaint/no-caret-repaint-in-non-content-editable-element.html
    15751584http/tests/appcache/disabled.html
     1585loader/go-back-to-different-window-size.html
    15761586media/restore-from-page-cache.html
    1577 fast/canvas/webgl/canvas-test.html
    1578 fast/canvas/webgl/gl-pixelstorei.html
    1579 fast/canvas/webgl/invalid-passed-params.html
    1580 fast/canvas/webgl/read-pixels-pack-alignment.html
    15811587
    15821588# Pasteboard doesn't work in WebKit2
     
    16911697inspector/timeline-script-tag-2.html
    16921698inspector/timeline-trivial.html
    1693 
    1694 # WebKitTestRunner needs to support layoutTestController.setCanOpenWindows
    1695 # <https://bugs.webkit.org/show_bug.cgi?id=42321>
    1696 fast/dom/Document/early-document-access.html
    1697 fast/dom/Window/closure-access-after-navigation-window.html
    1698 fast/dom/Window/dom-access-from-closure-window.html
    1699 fast/dom/Window/new-window-opener.html
    1700 fast/dom/Window/setting-properties-on-closed-window.html
    1701 fast/dom/Window/window-early-properties.html
    1702 fast/dom/Window/window-open-pending-url.html
    1703 fast/dom/Window/window-open-self-from-other-frame.html
    1704 fast/dom/location-new-window-no-crash.html
    1705 fast/dom/open-and-close-by-DOM.html
    1706 fast/events/popup-allowed-from-gesture-initiated-event.html
    1707 fast/events/popup-allowed-from-gesture-initiated-form-submit.html
    1708 fast/events/popup-blocked-from-fake-button-click.html
    1709 fast/events/popup-blocked-from-fake-focus.html
    1710 fast/events/popup-blocked-from-fake-user-gesture.html
    1711 fast/events/popup-blocked-to-post-blank.html
    1712 fast/events/show-modal-dialog-onblur-onfocus.html
    1713 fast/frames/frame-crash-with-page-cache.html
    1714 fast/frames/iframe-reparenting-new-page.html
    1715 fast/frames/sandboxed-iframe-navigation-windowopen.html
    1716 fast/harness/page-cache-crash-on-data-urls.html
    1717 fast/harness/show-modal-dialog.html
    1718 fast/history/history_reload.html
    1719 fast/history/window-open.html
    1720 fast/loader/cancel-load-during-port-block-timer.html
    1721 fast/loader/crash-copying-backforwardlist.html
    1722 fast/loader/stateobjects/pushstate-without-history.html
    1723 fast/loader/stateobjects/replacestate-in-iframe.html
    1724 fast/loader/stateobjects/replacestate-then-pushstate.html
    1725 fast/loader/stateobjects/replacestate-updates-location.html
    1726 fast/parser/xhtml-close-while-parsing.xhtml
    1727 plugins/access-after-page-destroyed.html
    1728 http/tests/appcache/crash-when-navigating-away-then-back.html
    1729 http/tests/media/video-cancel-load.html
    1730 http/tests/misc/set-window-opener-to-null.html
    1731 http/tests/misc/slow-preload-cancel.html
    1732 http/tests/misc/window-open-then-write.html
    1733 http/tests/navigation/new-window-redirect-history.html
    1734 http/tests/navigation/no-referrer-reset.html
    1735 http/tests/navigation/no-referrer-target-blank.html
    1736 http/tests/navigation/target-frame-from-window.html
    1737 http/tests/security/aboutBlank/security-context-window-open.html
    1738 http/tests/security/aboutBlank/window-open-self-about-blank.html
    1739 http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write.html
    1740 http/tests/security/aboutBlank/xss-DENIED-navigate-opener-javascript-url.html
    1741 http/tests/security/aboutBlank/xss-DENIED-set-opener.html
    1742 http/tests/security/cross-frame-access-call.html
    1743 http/tests/security/dataURL/xss-DENIED-from-data-url-in-foreign-domain-window-open.html
    1744 http/tests/security/dataURL/xss-DENIED-from-javascript-url-window-open.html
    1745 http/tests/security/dataURL/xss-DENIED-to-data-url-in-foreign-domain-window-open.html
    1746 http/tests/security/dataURL/xss-DENIED-to-data-url-window-open.html
    1747 http/tests/security/frameNavigation/cross-origin-opener.html
    1748 http/tests/security/frameNavigation/not-opener.html
    1749 http/tests/security/frameNavigation/opener.html
    1750 http/tests/security/frameNavigation/xss-DENIED-plugin-navigation.html
    1751 http/tests/security/frameNavigation/xss-DENIED-targeted-link-navigation.html
    1752 http/tests/security/isolatedWorld/userGestureEvents.html
    1753 http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-window-open.html
    1754 http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.html
    1755 http/tests/security/javascriptURL/xss-DENIED-from-javascript-url-in-foreign-domain-window-open.html
    1756 http/tests/security/javascriptURL/xss-DENIED-to-javascript-url-in-foreign-domain-window-open.html
    1757 http/tests/security/originHeader/origin-header-for-empty.html
    1758 http/tests/security/window-events-clear-domain.html
    1759 http/tests/security/window-events-clear-port.html
    1760 http/tests/security/window-events-pass.html
    1761 http/tests/xmlhttprequest/close-window.html
    1762 http/tests/xmlhttprequest/cross-origin-authorization-with-embedder.html
    1763 http/tests/xmlhttprequest/cross-origin-authorization.html
    1764 http/tests/xmlhttprequest/cross-origin-no-authorization.html
    1765 http/tests/xmlhttprequest/request-from-popup.html
    1766 storage/domstorage/localstorage/window-open.html
    1767 storage/domstorage/sessionstorage/window-open.html
    17681699
    17691700# WebKitTestRunner needs to support layoutTestController.dumpBackForwardList
     
    18301761http/tests/navigation/metaredirect-subframeload.html
    18311762http/tests/navigation/multiple-back-forward-entries.html
     1763http/tests/navigation/new-window-redirect-history.html
    18321764http/tests/navigation/onload-navigation-iframe-2.html
    18331765http/tests/navigation/onload-navigation-iframe-timeout.html
     
    19201852http/tests/security/isolatedWorld/number-prototype.html
    19211853http/tests/security/isolatedWorld/object-prototype.html
     1854http/tests/security/isolatedWorld/storage-properties.html
     1855http/tests/security/isolatedWorld/storage-prototype.html
    19221856http/tests/security/isolatedWorld/string-prototype.html
    19231857http/tests/security/isolatedWorld/top-properties.html
     1858http/tests/security/isolatedWorld/userGestureEvents.html
    19241859http/tests/security/isolatedWorld/window-properties.html
    19251860http/tests/security/isolatedWorld/window-setTimeout-function.html
    19261861http/tests/security/isolatedWorld/window-setTimeout-string.html
    19271862http/tests/security/isolatedWorld/world-reuse.html
    1928 http/tests/security/isolatedWorld/storage-properties.html
    1929 http/tests/security/isolatedWorld/storage-prototype.html
    19301863
    19311864# WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
     
    20331966fast/loader/location-port.html
    20341967fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html
     1968fast/loader/stateobjects/document-destroyed-navigate-back.html
    20351969fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html
    20361970fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html
     
    20381972fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html
    20391973fast/loader/stateobjects/pushstate-clears-forward-history.html
     1974fast/loader/stateobjects/pushstate-then-replacestate.html
    20401975fast/loader/stateobjects/pushstate-updates-location.html
    20411976fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html
    20421977fast/loader/stateobjects/pushstate-within-popstate-handler-assert.html
    2043 fast/loader/stateobjects/pushstate-then-replacestate.html
    2044 fast/loader/stateobjects/document-destroyed-navigate-back.html
     1978fast/loader/stateobjects/pushstate-without-history.html
     1979fast/loader/stateobjects/replacestate-then-pushstate.html
    20451980http/tests/loading/state-object-security-exception.html
    20461981
     
    22902225# <https://bugs.webkit.org/show_bug.cgi?id=42688>
    22912226editing/selection/4975120.html
     2227fast/events/show-modal-dialog-onblur-onfocus.html
    22922228
    22932229# WebKitTestRunner needs layoutTestController.setEditingBehavior
     
    23562292http/tests/cookies/third-party-cookie-relaxing.html
    23572293
    2358 # WebKit2 needs layoutTestController.setCloseRemainingWindowsWhenComplete
    2359 # <https://bugs.webkit.org/show_bug.cgi?id=42779>
    2360 http/tests/security/popup-blocked-from-fake-event.html
    2361 http/tests/security/popup-blocked-from-window-open.html
    2362 
    23632294# WebKitTestRunner needs GCController
    23642295# <https://bugs.webkit.org/show_bug.cgi?id=42701>
     
    23702301# <https://bugs.webkit.org/show_bug.cgi?id=42703>
    23712302fast/events/onunload-clears-onbeforeunload.html
     2303fast/events/onunload-not-on-body.html
     2304fast/events/onunload.html
     2305fast/events/pageshow-pagehide-on-back-uncached.html
    23722306fast/events/pageshow-pagehide.html
    23732307fast/events/stop-load-in-unload-handler-using-document-write.html
     
    23782312fast/loader/onunload-form-submit-crash.html
    23792313fast/loader/start-load-in-unload.html
     2314fast/loader/stateobjects/pushstate-in-iframe.html
     2315fast/loader/stateobjects/replacestate-in-iframe.html
    23802316fast/loader/unload-form-about-blank.html
    23812317fast/loader/unload-form-post-about-blank.html
     
    23872323fast/loader/unload-reload.html
    23882324fast/loader/unload-window-location.html
     2325http/tests/navigation/history-back-across-form-submission-to-fragment.html
     2326http/tests/security/window-events-pass.html
    23892327http/tests/xmlhttprequest/frame-load-cancelled-abort.html
    23902328http/tests/xmlhttprequest/frame-unload-abort-crash.html
    23912329http/tests/xmlhttprequest/send-undefined-and-null.html
    23922330http/tests/xmlhttprequest/xhr-onunload.html
    2393 fast/events/onunload.html
    2394 fast/events/onunload-not-on-body.html
    2395 fast/events/pageshow-pagehide-on-back-uncached.html
    2396 http/tests/navigation/history-back-across-form-submission-to-fragment.html
    2397 fast/loader/stateobjects/pushstate-in-iframe.html
    23982331
    23992332# WebKitTestRunner needs to print history delegate information
     
    24412374editing/text-iterator/basic-iteration.html
    24422375
     2376# WebKitTestRunner needs layoutTestController.setNewWindowsCopyBackForwardList
     2377fast/loader/crash-copying-backforwardlist.html
     2378
     2379# WebKitTestRunner needs layoutTestController.authenticateSession
     2380http/tests/xmlhttprequest/cross-origin-authorization-with-embedder.html
     2381
     2382# WebKitTestRunner needs layoutTestController.setPopupBlockingEnabled
     2383fast/events/popup-allowed-from-gesture-initiated-event.html
     2384fast/events/popup-allowed-from-gesture-initiated-form-submit.html
     2385fast/events/popup-blocked-from-fake-button-click.html
     2386fast/events/popup-blocked-from-fake-focus.html
     2387fast/events/popup-blocked-from-fake-user-gesture.html
     2388fast/events/popup-blocked-to-post-blank.html
     2389
    24432390# WebKit2 needs support for moving/resizing and querying the location/size the window
    24442391fast/dom/Window/window-lookup-precedence.html
     
    24772424http/tests/xmlhttprequest/re-login-async.html
    24782425http/tests/xmlhttprequest/re-login.html
     2426
     2427# WebKit2 needs showModalDialog
     2428fast/harness/show-modal-dialog.html
    24792429
    24802430# WebKit2 needs to support synchronous creation of about:blank/data:url frames'
     
    25392489http/tests/security/protocol-compare-case-insensitive.html
    25402490
     2491# Unexplained failures that were formerly in the setCanOpenWindows or setCloseRemainingWindowsWhenComplete lists.
     2492fast/dom/Window/new-window-opener.html
     2493fast/dom/open-and-close-by-DOM.html
     2494fast/frames/iframe-reparenting-new-page.html
     2495fast/parser/xhtml-close-while-parsing.xhtml
     2496http/tests/media/video-cancel-load.html
     2497http/tests/misc/set-window-opener-to-null.html
     2498http/tests/misc/window-open-then-write.html
     2499http/tests/navigation/target-frame-from-window.html
     2500http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write.html
     2501http/tests/security/aboutBlank/xss-DENIED-navigate-opener-javascript-url.html
     2502http/tests/security/aboutBlank/xss-DENIED-set-opener.html
     2503http/tests/security/cross-frame-access-call.html
     2504http/tests/security/dataURL/xss-DENIED-from-data-url-in-foreign-domain-window-open.html
     2505http/tests/security/dataURL/xss-DENIED-from-javascript-url-window-open.html
     2506http/tests/security/dataURL/xss-DENIED-to-data-url-in-foreign-domain-window-open.html
     2507http/tests/security/dataURL/xss-DENIED-to-data-url-window-open.html
     2508http/tests/security/frameNavigation/opener.html
     2509http/tests/security/frameNavigation/xss-DENIED-plugin-navigation.html
     2510http/tests/security/frameNavigation/xss-DENIED-targeted-link-navigation.html
     2511http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.html
     2512http/tests/security/javascriptURL/xss-DENIED-from-javascript-url-in-foreign-domain-window-open.html
     2513http/tests/security/javascriptURL/xss-DENIED-to-javascript-url-in-foreign-domain-window-open.html
     2514http/tests/security/window-events-clear-port.html
     2515http/tests/xmlhttprequest/close-window.html
     2516http/tests/xmlhttprequest/cross-origin-authorization.html
     2517http/tests/xmlhttprequest/cross-origin-no-authorization.html
     2518http/tests/xmlhttprequest/request-from-popup.html
     2519plugins/access-after-page-destroyed.html
     2520storage/domstorage/localstorage/window-open.html
     2521storage/domstorage/sessionstorage/window-open.html
     2522http/tests/security/popup-blocked-from-fake-event.html
     2523http/tests/security/popup-blocked-from-window-open.html
     2524
    25412525# Unexplained failures that were formerly in the "unsafe access" list.
    25422526http/tests/security/cross-frame-access-child-explicit-domain.html
  • trunk/WebKit2/ChangeLog

    r64480 r64485  
     12010-08-02  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        WebKitTestRunner needs layoutTestController.setCanOpenWindows
     6        https://bugs.webkit.org/show_bug.cgi?id=42321
     7
     8        WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
     9        https://bugs.webkit.org/show_bug.cgi?id=42779
     10
     11        Implemented window.close, added a function that does a similar operation on behalf
     12        of injected bundle code named WKBundlePageClose, and fixed the reference counting of
     13        the result of the createNewPage client function.
     14
     15        * UIProcess/API/cpp/WKRetainPtr.h: Added clear. Tweaked formatting. Renamed
     16        releaseRef to leakRef.
     17
     18        * UIProcess/API/mac/WKView.mm:
     19        (-[WKView _updateVisibility]): Handle the case where drawing area is 0. This
     20        came up in WebKitTestRunner and other functions handle drawing area of 0.
     21
     22        * UIProcess/WebPageProxy.cpp:
     23        (WebKit::WebPageProxy::didReceiveSyncMessage): Update now that createNewPage
     24        returns a PassRefPtr.
     25        (WebKit::WebPageProxy::createNewPage): Changed to return a PassRefPtr.
     26        * UIProcess/WebPageProxy.h: Ditto.
     27
     28        * UIProcess/WebUIClient.cpp:
     29        (WebKit::WebUIClient::createNewPage): Changed to return a PassRefPtr and adopt
     30        the WKPageRef passed from the client. This follows the "create rule".
     31        * UIProcess/WebUIClient.h: Ditto.
     32
     33        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     34        (WKBundlePageClose): Added.
     35        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: Added WKBundlePageClose
     36        and re-sorted the other functions in this file.
     37
     38        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     39        (WebKit::WebChromeClient::closeWindowSoon): Implemented this.
     40
     41        * WebProcess/WebPage/WebPage.cpp:
     42        (WebKit::WebPage::WebPage): Called setJavaScriptCanOpenWindowsAutomatically(true).
     43        I suppose we will need to revisit this later when we implement pop-up blocking.
     44        (WebKit::WebPage::tryClose): Factored out the part of this that sends a message
     45        to the other process.
     46        (WebKit::WebPage::sendClose): This is where the part that sends a message went.
     47        * WebProcess/WebPage/WebPage.h: Added sendClose, used by both closeWindowSoon
     48        and WKBundlePageClose.
     49
    1502010-08-02  John Sullivan  <sullivan@apple.com>
    251
  • trunk/WebKit2/UIProcess/API/cpp/WKRetainPtr.h

    r61698 r64485  
    3333enum WKAdoptTag { AdoptWK };
    3434
    35 template <typename T>
    36 class WKRetainPtr {
     35template<typename T> class WKRetainPtr {
    3736public:
    3837    typedef T PtrType;
     
    5554    }
    5655   
    57     template <typename U>
    58     WKRetainPtr(const WKRetainPtr<U>& o)
     56    template<typename U> WKRetainPtr(const WKRetainPtr<U>& o)
    5957        : m_ptr(o.get())
    6058    {
     
    7775
    7876    PtrType get() const { return m_ptr; }
    79     PtrType releaseRef() { PtrType tmp = m_ptr; m_ptr = 0; return tmp; }
     77
     78    void clear()
     79    {
     80        PtrType ptr = m_ptr;
     81        m_ptr = 0;
     82        if (ptr)
     83            WKRelease(ptr);
     84    }
     85    PtrType leakRef()
     86    {
     87        PtrType ptr = m_ptr;
     88        m_ptr = 0;
     89        return ptr;
     90    }
    8091   
    8192    PtrType operator->() const { return m_ptr; }
     
    94105    void swap(WKRetainPtr&);
    95106
     107    // FIXME: Remove once all callers are calling leakRef.
     108    PtrType releaseRef() { leakRef(); }
     109
    96110private:
    97111    PtrType m_ptr;
  • trunk/WebKit2/UIProcess/API/mac/WKView.mm

    r64155 r64485  
    237237{
    238238    _data->_page->setIsInWindow([self window]);
    239     _data->_page->drawingArea()->setPageIsVisible(isViewVisible(self));
     239    if (DrawingAreaProxy* area = _data->_page->drawingArea())
     240        area->setPageIsVisible(isViewVisible(self));
    240241}
    241242
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r64317 r64485  
    591591    switch (messageID.get<WebPageProxyMessage::Kind>()) {
    592592        case WebPageProxyMessage::CreateNewPage: {
    593             WebPageProxy* newPage = createNewPage();
     593            RefPtr<WebPageProxy> newPage = createNewPage();
    594594            if (newPage) {
    595595                // FIXME: Pass the real size.
     
    795795
    796796// UIClient
    797 WebPageProxy* WebPageProxy::createNewPage()
     797PassRefPtr<WebPageProxy> WebPageProxy::createNewPage()
    798798{
    799799    return m_uiClient.createNewPage(this);
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r64386 r64485  
    187187    void decidePolicyForMIMEType(WebFrameProxy*, const WebCore::String& MIMEType, const WebCore::String& url, uint64_t listenerID);
    188188
    189     WebPageProxy* createNewPage();
     189    PassRefPtr<WebPageProxy> createNewPage();
    190190    void showPage();
    191191    void closePage();
  • trunk/WebKit2/UIProcess/WebUIClient.cpp

    r64317 r64485  
    2727
    2828#include "WKAPICast.h"
     29#include "WebPageProxy.h"
    2930#include <WebCore/PlatformString.h>
    3031#include <string.h>
     
    4748}
    4849
    49 WebPageProxy* WebUIClient::createNewPage(WebPageProxy* page)
     50PassRefPtr<WebPageProxy> WebUIClient::createNewPage(WebPageProxy* page)
    5051{
    5152    if (!m_pageUIClient.createNewPage)
    5253        return 0;
    5354   
    54     return toWK(m_pageUIClient.createNewPage(toRef(page), m_pageUIClient.clientInfo));
     55    return adoptRef(toWK(m_pageUIClient.createNewPage(toRef(page), m_pageUIClient.clientInfo)));
    5556}
    5657
  • trunk/WebKit2/UIProcess/WebUIClient.h

    r64317 r64485  
    2828
    2929#include "WKPage.h"
     30#include <wtf/PassRefPtr.h>
    3031
    3132namespace WebCore {
     
    4344    void initialize(const WKPageUIClient*);
    4445
    45     WebPageProxy* createNewPage(WebPageProxy*);
     46    PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*);
    4647    void showPage(WebPageProxy*);
    4748    void close(WebPageProxy*);
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r64445 r64485  
    8181    toWK(pageRef)->clearMainFrameName();
    8282}
     83
     84void WKBundlePageClose(WKBundlePageRef pageRef)
     85{
     86    toWK(pageRef)->sendClose();
     87}
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h

    r64445 r64485  
    3434#endif
    3535
     36WK_EXPORT bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef page, WKStringRef commandName);
     37WK_EXPORT void WKBundlePageClearMainFrameName(WKBundlePageRef page);
     38WK_EXPORT void WKBundlePageClose(WKBundlePageRef page);
    3639WK_EXPORT WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef page);
    3740WK_EXPORT void WKBundlePageExecuteEditingCommand(WKBundlePageRef page, WKStringRef commandName, WKStringRef argument);
    38 WK_EXPORT bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef page, WKStringRef commandName);
    39 WK_EXPORT void WKBundlePageClearMainFrameName(WKBundlePageRef page);
    4041
    4142#ifdef __cplusplus
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r64462 r64485  
    4141#include <WebCore/Frame.h>
    4242#include <WebCore/FrameLoader.h>
     43#include <WebCore/Page.h>
    4344#include <WebCore/SecurityOrigin.h>
    4445
     
    209210void WebChromeClient::closeWindowSoon()
    210211{
    211     notImplemented();
     212    // FIXME: This code assumes that the client will respond to a close page
     213    // message by actually closing the page. Safari does this, but there is
     214    // no guarantee that other applications will, which will leave this page
     215    // half detached. This approach is an inherent limitation making parts of
     216    // a close execute synchronously as part of window.close, but other parts
     217    // later on.
     218
     219    m_page->corePage()->setGroupName(String());
     220
     221    if (WebFrame* frame = m_page->mainFrame()) {
     222        if (Frame* coreFrame = frame->coreFrame())
     223            coreFrame->loader()->stopForUserCancel();
     224    }
     225
     226    m_page->sendClose();
    212227}
    213228
  • trunk/WebKit2/WebProcess/WebPage/WebPage.cpp

    r64445 r64485  
    112112    m_page->settings()->setSerifFontFamily(store.serifFontFamily);
    113113
     114    m_page->settings()->setJavaScriptCanOpenWindowsAutomatically(true);
     115
    114116    m_page->setGroupName("WebKit2Group");
    115117   
     
    238240        return;
    239241
     242    sendClose();
     243}
     244
     245void WebPage::sendClose()
     246{
    240247    WebProcess::shared().connection()->send(WebPageProxyMessage::ClosePage, m_pageID, CoreIPC::In());
    241248}
  • trunk/WebKit2/WebProcess/WebPage/WebPage.h

    r64445 r64485  
    110110    bool isEditingCommandEnabled(const WebCore::String& commandName);
    111111    void clearMainFrameName();
     112    void sendClose();
    112113
    113114#if USE(ACCELERATED_COMPOSITING)
  • trunk/WebKitTools/ChangeLog

    r64484 r64485  
     12010-08-02  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        WebKitTestRunner needs layoutTestController.setCanOpenWindows
     6        https://bugs.webkit.org/show_bug.cgi?id=42321
     7
     8        WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete
     9        https://bugs.webkit.org/show_bug.cgi?id=42779
     10
     11        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: Added
     12        setCanOpenWindows, setCloseRemainingWindowsWhenComplete, and windowCount
     13
     14        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     15        (WTR::InjectedBundle::InjectedBundle): Initialize m_mainPage to 0 instead of
     16        waiting for the first call to didCreatePage.
     17        (WTR::InjectedBundle::didCreatePage): Set m_mainPage only when the first page
     18        is created. Put other pages into a map.
     19        (WTR::InjectedBundle::willDestroyPage): Added code to handle the destruction
     20        of the main page.
     21        (WTR::InjectedBundle::closeOtherPages): Added. Closes all the pages other than
     22        the main page.
     23        * WebKitTestRunner/InjectedBundle/InjectedBundle.h: Added pageCount and
     24        closeOtherPages functions.
     25
     26        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     27        (WTR::InjectedBundlePage::didFinishLoadForFrame): Don't let pages other than
     28        the main page affect dumping.
     29        (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame): Ditto.
     30
     31        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
     32        (WTR::LayoutTestController::LayoutTestController): Initialize the new
     33        m_shouldCloseExtraWindows member.
     34        (WTR::LayoutTestController::setCanOpenWindows): Added. Empty for now.
     35        (WTR::LayoutTestController::windowCount): Added.
     36
     37        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
     38        Added setCanOpenWindows, setCloseRemainingWindowsWhenComplete,
     39        windowCount, shouldCloseExtraWindowsAfterRunningTest, and
     40        m_shouldCloseExtraWindows.
     41
     42        * WebKitTestRunner/TestController.cpp:
     43        (WTR::TestController::shared): Return a pointer to the shared copy, but
     44        don't allocate and leak it. This seemed cleaner than adding an explicit
     45        finalize call to go along with the explicit initialize call.
     46        (WTR::TestController::TestController): Added calls to the initialize and
     47        run function, which are now done automatically.
     48        (WTR::TestController::~TestController): Added, since it's called now.
     49        (WTR::closeOtherPage): Added. Used to close pages other than the main page.
     50        (WTR::createOtherPage): Added. Used to create pages other than the main page.
     51        (WTR::TestController::initialize): Added code to set up createOtherPage.
     52        (WTR::TestController::run): Removed unused return value.
     53        * WebKitTestRunner/TestController.h: Made constructor and destructor public,
     54        and initialize and run private. Changed m_mainWebView to be an OwnPtr.
     55
     56        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     57        (WTR::PlatformWebView::PlatformWebView): Added a call to setReleasedWhenClosed
     58        to avoid releasing the window twice. Another way to handle it would be to
     59        remove the release, but this approach is slightly more robust because it works
     60        even if some other code calls the close method an extra time.
     61
     62        * WebKitTestRunner/mac/main.mm:
     63        (main): Use a stack-allocated TestController object instead of calling
     64        initalize and run on a globally allocated one.
     65
    1662010-08-02  Tony Chang  <tony@chromium.org>
    267
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl

    r64251 r64485  
    4242        void keepWebHistory();
    4343        void setAcceptsEditing(in boolean value);
     44        void setCanOpenWindows(in boolean value);
     45        void setCloseRemainingWindowsWhenComplete(in boolean value);
     46        unsigned long windowCount();
    4447
    4548        // Special DOM functions.
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r64445 r64485  
    2828#include "ActivateFonts.h"
    2929#include "InjectedBundlePage.h"
    30 #include <WebKit2/WebKit2.h>
    3130#include <WebKit2/WKBundle.h>
    3231#include <WebKit2/WKBundlePage.h>
     32#include <WebKit2/WKBundlePagePrivate.h>
    3333#include <WebKit2/WKBundlePrivate.h>
    3434#include <WebKit2/WKRetainPtr.h>
    3535#include <WebKit2/WKStringCF.h>
     36#include <WebKit2/WebKit2.h>
     37#include <wtf/PassOwnPtr.h>
    3638#include <wtf/RetainPtr.h>
     39#include <wtf/Vector.h>
    3740
    3841namespace WTR {
     
    4649InjectedBundle::InjectedBundle()
    4750    : m_bundle(0)
     51    , m_mainPage(0)
    4852{
    4953}
     
    9498{
    9599    // FIXME: we really need the main page ref to be sent over from the ui process
    96     m_mainPage = new InjectedBundlePage(page);
    97     m_pages.add(page, m_mainPage);
     100    OwnPtr<InjectedBundlePage> pageWrapper = adoptPtr(new InjectedBundlePage(page));
     101    if (!m_mainPage)
     102        m_mainPage = pageWrapper.release();
     103    else
     104        m_otherPages.add(page, pageWrapper.leakPtr());
    98105}
    99106
    100107void InjectedBundle::willDestroyPage(WKBundlePageRef page)
    101108{
    102     delete m_pages.take(page);
     109    if (m_mainPage && m_mainPage->page() == page)
     110        m_mainPage.clear();
     111    else
     112        delete m_otherPages.take(page);
    103113}
    104114
     
    134144}
    135145
     146void InjectedBundle::closeOtherPages()
     147{
     148    Vector<WKBundlePageRef> pages;
     149    copyKeysToVector(m_otherPages, pages);
     150    for (size_t i = 0; i < pages.size(); ++i)
     151        WKBundlePageClose(pages[i]);
     152}
     153
    136154} // namespace WTR
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h

    r64380 r64485  
    3131#include <WebKit2/WKBundleBase.h>
    3232#include <wtf/HashMap.h>
     33#include <wtf/OwnPtr.h>
    3334#include <wtf/RefPtr.h>
    3435
     
    4950
    5051    LayoutTestController* layoutTestController() { return m_layoutTestController.get(); }
    51     InjectedBundlePage* page() { return m_mainPage; }
     52    InjectedBundlePage* page() { return m_mainPage.get(); }
     53    size_t pageCount() { return !!m_mainPage + m_otherPages.size(); }
     54    void closeOtherPages();
    5255
    5356    std::ostringstream& os() { return m_outputStream; }
     
    7073
    7174    WKBundleRef m_bundle;
    72     HashMap<WKBundlePageRef, InjectedBundlePage*> m_pages;
    73     InjectedBundlePage* m_mainPage;
     75    HashMap<WKBundlePageRef, InjectedBundlePage*> m_otherPages;
     76    OwnPtr<InjectedBundlePage> m_mainPage;
    7477
    7578    RefPtr<LayoutTestController> m_layoutTestController;
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r64445 r64485  
    332332    m_isLoading = false;
    333333
     334    if (this != InjectedBundle::shared().page())
     335        return;
     336
    334337    if (InjectedBundle::shared().layoutTestController()->waitToDump())
    335338        return;
     
    344347
    345348    m_isLoading = false;
     349
     350    if (this != InjectedBundle::shared().page())
     351        return;
    346352
    347353    InjectedBundle::shared().done();
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp

    r64251 r64485  
    117117    , m_shouldDumpAllFrameScrollPositions(false)
    118118    , m_shouldAllowEditing(true)
     119    , m_shouldCloseExtraWindows(false)
    119120    , m_dumpEditingCallbacks(false)
    120121    , m_dumpStatusCallbacks(false)
     
    243244}
    244245
     246void LayoutTestController::setCanOpenWindows(bool)
     247{
     248    // It's not clear if or why any tests require opening windows be forbidden.
     249    // For now, just ignore this setting, and if we find later it's needed we can add it.
     250}
     251
     252unsigned LayoutTestController::windowCount()
     253{
     254    return InjectedBundle::shared().pageCount();
     255}
     256
    245257// Object Creation
    246258
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h

    r64251 r64485  
    6161    void keepWebHistory();
    6262    void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; }
     63    void setCanOpenWindows(bool);
     64    void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; }
     65    unsigned windowCount();
    6366
    6467    // Special DOM functions.
     
    9396    bool shouldAllowEditing() const { return m_shouldAllowEditing; }
    9497
     98    bool shouldCloseExtraWindowsAfterRunningTest() const { return m_shouldCloseExtraWindows; }
     99
    95100private:
    96101    LayoutTestController();
     
    98103    WhatToDump m_whatToDump;
    99104    bool m_shouldDumpAllFrameScrollPositions;
     105
    100106    bool m_shouldAllowEditing;
     107    bool m_shouldCloseExtraWindows;
     108
    101109    bool m_dumpEditingCallbacks;
    102110    bool m_dumpStatusCallbacks;
  • trunk/WebKitTools/WebKitTestRunner/TestController.cpp

    r64396 r64485  
    2929#include "TestInvocation.h"
    3030#include <WebKit2/WKContextPrivate.h>
     31#include <wtf/PassOwnPtr.h>
    3132
    3233namespace WTR {
    3334
     35static TestController* controller;
     36
    3437TestController& TestController::shared()
    3538{
    36     static TestController& shared = *new TestController;
    37     return shared;
     39    ASSERT(controller);
     40    return *controller;
    3841}
    3942
    40 TestController::TestController()
     43TestController::TestController(int argc, const char* argv[])
    4144    : m_dumpPixels(false)
    4245    , m_verbose(false)
     
    4447    , m_usingServerMode(false)
    4548{
     49    initialize(argc, argv);
     50    controller = this;
     51    run();
     52    controller = 0;
     53}
     54
     55TestController::~TestController()
     56{
     57}
     58
     59static void closeOtherPage(WKPageRef page, const void* clientInfo)
     60{
     61    WKPageClose(page);
     62    const PlatformWebView* view = static_cast<const PlatformWebView*>(clientInfo);
     63    delete view;
     64}
     65
     66static WKPageRef createOtherPage(WKPageRef oldPage, const void*)
     67{
     68    PlatformWebView* view = new PlatformWebView(WKPageGetPageNamespace(oldPage));
     69    WKPageRef newPage = view->page();
     70
     71    view->resizeTo(800, 600);
     72
     73    WKPageUIClient otherPageUIClient = {
     74        0,
     75        view,
     76        createOtherPage,
     77        0,
     78        closeOtherPage,
     79        0,
     80        0,
     81        0
     82    };
     83    WKPageSetPageUIClient(newPage, &otherPageUIClient);
     84
     85    WKRetain(newPage);
     86    return newPage;
    4687}
    4788
     
    80121    m_context.adopt(WKContextCreateWithInjectedBundlePath(injectedBundlePath()));
    81122
    82     WKContextInjectedBundleClient injectedBundlePathClient = {
     123    WKContextInjectedBundleClient injectedBundleClient = {
    83124        0,
    84125        this,
    85126        didReceiveMessageFromInjectedBundle
    86127    };
    87     WKContextSetInjectedBundleClient(m_context.get(), &injectedBundlePathClient);
     128    WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient);
    88129
    89130    _WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
    90131   
    91132    m_pageNamespace.adopt(WKPageNamespaceCreate(m_context.get()));
    92     m_mainWebView = new PlatformWebView(m_pageNamespace.get());
     133    m_mainWebView = adoptPtr(new PlatformWebView(m_pageNamespace.get()));
     134
     135    WKPageUIClient pageUIClient = {
     136        0,
     137        this,
     138        createOtherPage,
     139        0,
     140        0,
     141        0,
     142        0,
     143        0
     144    };
     145    WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
    93146}
    94147
     
    115168}
    116169
    117 bool TestController::run()
     170void TestController::run()
    118171{
    119172    if (m_usingServerMode)
     
    123176            runTest(m_paths[i].c_str());
    124177    }
    125 
    126     return true;
    127178}
    128179
  • trunk/WebKitTools/WebKitTestRunner/TestController.h

    r64396 r64485  
    3737class PlatformWebView;
    3838
     39// FIXME: Rename this TestRunner?
    3940class TestController {
    4041public:
    4142    static TestController& shared();
    4243
    43     // Initialize the TestController.
    44     void initialize(int argc, const char *argv[]);
    45 
    46     // Returns true if all the tests passed, false otherwise.
    47     bool run();
     44    TestController(int argc, const char* argv[]);
     45    ~TestController();
    4846
    4947    bool verbose() const { return m_verbose; }
     
    5250    WKStringRef testPluginDirectory() { return m_testPluginDirectory.get(); }
    5351
    54     PlatformWebView* mainWebView() { return m_mainWebView; }
     52    PlatformWebView* mainWebView() { return m_mainWebView.get(); }
    5553    WKPageNamespaceRef pageNamespace() { return m_pageNamespace.get(); }
    5654    WKContextRef context() { return m_context.get(); }
    5755
    5856private:
    59     TestController();
    60     ~TestController();
     57    void initialize(int argc, const char* argv[]);
     58    void run();
    6159
    6260    void runTestingServerLoop();
     
    8179    WKRetainPtr<WKStringRef> m_testPluginDirectory;
    8280
    83     PlatformWebView* m_mainWebView;
     81    OwnPtr<PlatformWebView> m_mainWebView;
    8482    WKRetainPtr<WKContextRef> m_context;
    8583    WKRetainPtr<WKPageNamespaceRef> m_pageNamespace;
  • trunk/WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r63155 r64485  
    3939    [m_window orderBack:nil];
    4040    [m_window setAutodisplay:NO];
     41    [m_window setReleasedWhenClosed:NO];
    4142}
    4243
  • trunk/WebKitTools/WebKitTestRunner/mac/main.mm

    r61769 r64485  
    2929{
    3030    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    31 
    3231    [NSApplication sharedApplication];
    33 
    34     WTR::TestController::shared().initialize(argc, argv);
    35     WTR::TestController::shared().run();
    36 
     32    {
     33        WTR::TestController controller(argc, argv);
     34    }
    3735    [pool drain];
    38 
    3936    return 0;
    4037}
Note: See TracChangeset for help on using the changeset viewer.