Title: [97716] trunk
Revision
97716
Author
[email protected]
Date
2011-10-17 21:47:05 -0700 (Mon, 17 Oct 2011)

Log Message

Source/WebCore: Make NavigationAction wrap a ResourceRequest instead of a KURL.
https://bugs.webkit.org/show_bug.cgi?id=68803

With this, FrameLoaderClient::dispatchCreatePage knows about the
request that will be used for the initial navigaion of the to be
created page.

Reviewed by Nate Chapin.

Test: platform/chromium/fast/loader/create-view-target-blank.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadURL):
(WebCore::FrameLoader::load):
(WebCore::FrameLoader::loadWithDocumentLoader):
(WebCore::FrameLoader::reload):
(WebCore::FrameLoader::loadPostRequest):
(WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
(WebCore::FrameLoader::loadDifferentDocumentItem):
(WebCore::createWindow):
* loader/NavigationAction.cpp:
(WebCore::NavigationAction::NavigationAction):
* loader/NavigationAction.h:
(WebCore::NavigationAction::isEmpty):
(WebCore::NavigationAction::url):
(WebCore::NavigationAction::resourceRequest):
* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNavigationPolicy):
* page/ContextMenuController.cpp:
(WebCore::openNewWindow):
* WebCore.exp: updated

Source/WebKit/chromium: Make NavigationAction wrap a ResourceRequest instead of a KURL.
https://bugs.webkit.org/show_bug.cgi?id=68803

Use the request in the NavigationAction, if the FrameLoadRequest
doesn't already contain a request.

Reviewed by Nate Chapin.

* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::createWindow):

Tools: [chromium] add LayoutTestController.dumpCreateView() to monitor calls to WebViewClient::createView
https://bugs.webkit.org/show_bug.cgi?id=68803

Reviewed by Nate Chapin.

* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(LayoutTestController::dumpCreateView):
* DumpRenderTree/chromium/LayoutTestController.h:
(LayoutTestController::shouldDumpCreateView):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::createView):

LayoutTests: Verify that the URL to be opened in the new window is passed by dispatchCreateWindow down to createView.
https://bugs.webkit.org/show_bug.cgi?id=68803

Reviewed by Nate Chapin.

* platform/chromium/fast/loader/create-view-target-blank-expected.txt: Added.
* platform/chromium/fast/loader/create-view-target-blank.html: Added.
* platform/chromium/fast/loader/resources/done.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97715 => 97716)


--- trunk/LayoutTests/ChangeLog	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/LayoutTests/ChangeLog	2011-10-18 04:47:05 UTC (rev 97716)
@@ -1,3 +1,14 @@
+2011-10-17  Jochen Eisinger  <[email protected]>
+
+        Verify that the URL to be opened in the new window is passed by dispatchCreateWindow down to createView.
+        https://bugs.webkit.org/show_bug.cgi?id=68803
+
+        Reviewed by Nate Chapin.
+
+        * platform/chromium/fast/loader/create-view-target-blank-expected.txt: Added.
+        * platform/chromium/fast/loader/create-view-target-blank.html: Added.
+        * platform/chromium/fast/loader/resources/done.html: Added.
+
 2011-10-17  Tom Sepez  <[email protected]>
 
         XSSAuditor bypass with remote script ending in ? character

Added: trunk/LayoutTests/platform/chromium/fast/loader/create-view-target-blank-expected.txt (0 => 97716)


--- trunk/LayoutTests/platform/chromium/fast/loader/create-view-target-blank-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/loader/create-view-target-blank-expected.txt	2011-10-18 04:47:05 UTC (rev 97716)
@@ -0,0 +1,4 @@
+createView(done.html)
+This test opens a new window by middle-clicking on a link with target=_blank. It passes, if the WebViewClient::createView method was invoked with the parameter "done.html".
+
+link

Added: trunk/LayoutTests/platform/chromium/fast/loader/create-view-target-blank.html (0 => 97716)


--- trunk/LayoutTests/platform/chromium/fast/loader/create-view-target-blank.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/loader/create-view-target-blank.html	2011-10-18 04:47:05 UTC (rev 97716)
@@ -0,0 +1,33 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpCreateView();
+    layoutTestController.setCanOpenWindows();
+    layoutTestController.setCloseRemainingWindowsWhenComplete();
+    layoutTestController.waitUntilDone();
+}
+
+function runTest() {
+    var link = document.getElementById("link");
+    var middleMouseButton = 1;
+    eventSender.mouseMoveTo(link.offsetLeft + 2, link.offsetTop + 2);
+    eventSender.mouseDown(middleMouseButton);
+    eventSender.mouseUp(middleMouseButton);
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<div>
+    <p>
+        This test opens a new window by middle-clicking on a link with
+        target=_blank. It passes, if the WebViewClient::createView method was
+        invoked with the parameter "done.html".
+    </p>
+    <p>
+        <a href="" id="link" target="_blank">link</a>
+    </p>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium/fast/loader/resources/done.html (0 => 97716)


--- trunk/LayoutTests/platform/chromium/fast/loader/resources/done.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/loader/resources/done.html	2011-10-18 04:47:05 UTC (rev 97716)
@@ -0,0 +1,4 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.notifyDone();
+</script>

Modified: trunk/Source/WebCore/ChangeLog (97715 => 97716)


--- trunk/Source/WebCore/ChangeLog	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Source/WebCore/ChangeLog	2011-10-18 04:47:05 UTC (rev 97716)
@@ -1,3 +1,37 @@
+2011-10-17  Jochen Eisinger  <[email protected]>
+
+        Make NavigationAction wrap a ResourceRequest instead of a KURL.
+        https://bugs.webkit.org/show_bug.cgi?id=68803
+
+        With this, FrameLoaderClient::dispatchCreatePage knows about the
+        request that will be used for the initial navigaion of the to be
+        created page.
+
+        Reviewed by Nate Chapin.
+
+        Test: platform/chromium/fast/loader/create-view-target-blank.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadURL):
+        (WebCore::FrameLoader::load):
+        (WebCore::FrameLoader::loadWithDocumentLoader):
+        (WebCore::FrameLoader::reload):
+        (WebCore::FrameLoader::loadPostRequest):
+        (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
+        (WebCore::FrameLoader::loadDifferentDocumentItem):
+        (WebCore::createWindow):
+        * loader/NavigationAction.cpp:
+        (WebCore::NavigationAction::NavigationAction):
+        * loader/NavigationAction.h:
+        (WebCore::NavigationAction::isEmpty):
+        (WebCore::NavigationAction::url):
+        (WebCore::NavigationAction::resourceRequest):
+        * loader/PolicyChecker.cpp:
+        (WebCore::PolicyChecker::checkNavigationPolicy):
+        * page/ContextMenuController.cpp:
+        (WebCore::openNewWindow):
+        * WebCore.exp: updated
+
 2011-10-17  Tom Sepez  <[email protected]>
 
         XSSAuditor bypass with remote script ending in ? character

Modified: trunk/Source/WebCore/WebCore.exp.in (97715 => 97716)


--- trunk/Source/WebCore/WebCore.exp.in	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-10-18 04:47:05 UTC (rev 97716)
@@ -491,8 +491,9 @@
 __ZN7WebCore16MIMETypeRegistry27isSupportedNonImageMIMETypeERKN3WTF6StringE
 __ZN7WebCore16MIMETypeRegistry29getSupportedNonImageMIMETypesEv
 __ZN7WebCore16MIMETypeRegistry32isSupportedImageResourceMIMETypeERKN3WTF6StringE
-__ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_13FrameLoadTypeEb
-__ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_14NavigationTypeE
+__ZN7WebCore16NavigationActionC1ERKNS_15ResourceRequestE
+__ZN7WebCore16NavigationActionC1ERKNS_15ResourceRequestENS_13FrameLoadTypeEb
+__ZN7WebCore16NavigationActionC1ERKNS_15ResourceRequestENS_14NavigationTypeE
 __ZN7WebCore16NavigationActionC1Ev
 __ZN7WebCore16ScriptController10initScriptEPNS_15DOMWrapperWorldE
 __ZN7WebCore16ScriptController11createWorldEv

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (97715 => 97716)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2011-10-18 04:47:05 UTC (rev 97716)
@@ -1199,7 +1199,7 @@
     if (m_pageDismissalEventBeingDispatched != NoDismissal)
         return;
 
-    NavigationAction action(newURL, newLoadType, isFormSubmission, event);
+    NavigationAction action(request, newLoadType, isFormSubmission, event);
 
     if (!targetFrame && !frameName.isEmpty()) {
         policyChecker()->checkNewWindowPolicy(action, FrameLoader::callContinueLoadAfterNewWindowPolicy,
@@ -1268,7 +1268,7 @@
         return;
     }
 
-    policyChecker()->checkNewWindowPolicy(NavigationAction(request.url(), NavigationTypeOther), FrameLoader::callContinueLoadAfterNewWindowPolicy, request, 0, frameName, this);
+    policyChecker()->checkNewWindowPolicy(NavigationAction(request, NavigationTypeOther), FrameLoader::callContinueLoadAfterNewWindowPolicy, request, 0, frameName, this);
 }
 
 void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const NavigationAction& action, bool lockHistory, FrameLoadType type, PassRefPtr<FormState> formState)
@@ -1346,7 +1346,7 @@
 
     if (shouldScrollToAnchor(isFormSubmission,  httpMethod, policyChecker()->loadType(), newURL)) {
         RefPtr<DocumentLoader> oldDocumentLoader = m_documentLoader;
-        NavigationAction action(newURL, policyChecker()->loadType(), isFormSubmission);
+        NavigationAction action(loader->request(), policyChecker()->loadType(), isFormSubmission);
 
         oldDocumentLoader->setTriggeringAction(action);
         policyChecker()->stopCheck();
@@ -1359,7 +1359,7 @@
         policyChecker()->stopCheck();
         setPolicyDocumentLoader(loader);
         if (loader->triggeringAction().isEmpty())
-            loader->setTriggeringAction(NavigationAction(newURL, policyChecker()->loadType(), isFormSubmission));
+            loader->setTriggeringAction(NavigationAction(loader->request(), policyChecker()->loadType(), isFormSubmission));
 
         if (Element* ownerElement = m_frame->ownerElement()) {
             // We skip dispatching the beforeload event if we've already
@@ -1479,7 +1479,7 @@
 
     // If we're about to re-post, set up action so the application can warn the user.
     if (request.httpMethod() == "POST")
-        loader->setTriggeringAction(NavigationAction(request.url(), NavigationTypeFormResubmitted));
+        loader->setTriggeringAction(NavigationAction(request, NavigationTypeFormResubmitted));
 
     loader->setOverrideEncoding(m_documentLoader->overrideEncoding());
     
@@ -2577,7 +2577,7 @@
     workingResourceRequest.setHTTPContentType(contentType);
     addExtraFieldsToRequest(workingResourceRequest, loadType, true);
 
-    NavigationAction action(url, loadType, true, event);
+    NavigationAction action(workingResourceRequest, loadType, true, event);
 
     if (!frameName.isEmpty()) {
         // The search for a target frame is done earlier in the case of form submission.
@@ -2871,7 +2871,7 @@
     mainFrame->loader()->m_client->dispatchShow();
     if (!m_suppressOpenerInNewFrame)
         mainFrame->loader()->setOpener(frame.get());
-    mainFrame->loader()->loadWithNavigationAction(request, NavigationAction(), false, FrameLoadTypeStandard, formState);
+    mainFrame->loader()->loadWithNavigationAction(request, NavigationAction(request), false, FrameLoadTypeStandard, formState);
 }
 
 void FrameLoader::requestFromDelegate(ResourceRequest& request, unsigned long& identifier, ResourceError& error)
@@ -3034,7 +3034,6 @@
         currentURL = documentLoader()->url();
     RefPtr<FormData> formData = item->formData();
 
-    bool addedExtraFields = false;
     ResourceRequest request(itemURL);
 
     if (!item->referrer().isNull())
@@ -3054,7 +3053,6 @@
         // Make sure to add extra fields to the request after the Origin header is added for the FormData case.
         // See https://bugs.webkit.org/show_bug.cgi?id=22194 for more discussion.
         addExtraFieldsToRequest(request, m_loadType, true);
-        addedExtraFields = true;
         
         // FIXME: Slight hack to test if the NSURL cache contains the page we're going to.
         // We want to know this before talking to the policy delegate, since it affects whether 
@@ -3065,10 +3063,10 @@
         // extremely rare, but in that case the user will get an error on the navigation.
         
         if (ResourceHandle::willLoadFromCache(request, m_frame))
-            action = "" loadType, false);
+            action = "" loadType, false);
         else {
             request.setCachePolicy(ReloadIgnoringCacheData);
-            action = "" NavigationTypeFormResubmitted);
+            action = "" NavigationTypeFormResubmitted);
         }
     } else {
         switch (loadType) {
@@ -3092,12 +3090,13 @@
                 ASSERT_NOT_REACHED();
         }
 
-        action = "" loadType, false);
-    }
-    
-    if (!addedExtraFields)
         addExtraFieldsToRequest(request, m_loadType, true);
 
+        ResourceRequest requestForOriginalURL(request);
+        requestForOriginalURL.setURL(itemOriginalURL);
+        action = "" loadType, false);
+    }
+
     loadWithNavigationAction(request, action, false, loadType, 0);
 }
 
@@ -3281,7 +3280,7 @@
     if (!oldPage)
         return 0;
 
-    NavigationAction action;
+    NavigationAction action(requestWithReferrer.resourceRequest());
     Page* page = oldPage->chrome()->createWindow(openerFrame, requestWithReferrer, features, action);
     if (!page)
         return 0;

Modified: trunk/Source/WebCore/loader/NavigationAction.cpp (97715 => 97716)


--- trunk/Source/WebCore/loader/NavigationAction.cpp	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Source/WebCore/loader/NavigationAction.cpp	2011-10-18 04:47:05 UTC (rev 97716)
@@ -52,29 +52,35 @@
 {
 }
 
-NavigationAction::NavigationAction(const KURL& url, NavigationType type)
-    : m_URL(url)
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest)
+    : m_resourceRequest(resourceRequest)
+    , m_type(NavigationTypeOther)
+{
+}
+
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type)
+    : m_resourceRequest(resourceRequest)
     , m_type(type)
 {
 }
 
-NavigationAction::NavigationAction(const KURL& url, FrameLoadType frameLoadType,
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType,
         bool isFormSubmission)
-    : m_URL(url)
+    : m_resourceRequest(resourceRequest)
     , m_type(navigationType(frameLoadType, isFormSubmission, 0))
 {
 }
 
-NavigationAction::NavigationAction(const KURL& url, NavigationType type, PassRefPtr<Event> event)
-    : m_URL(url)
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type, PassRefPtr<Event> event)
+    : m_resourceRequest(resourceRequest)
     , m_type(type)
     , m_event(event)
 {
 }
 
-NavigationAction::NavigationAction(const KURL& url, FrameLoadType frameLoadType,
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType,
         bool isFormSubmission, PassRefPtr<Event> event)
-    : m_URL(url)
+    : m_resourceRequest(resourceRequest)
     , m_type(navigationType(frameLoadType, isFormSubmission, event))
     , m_event(event)
 {

Modified: trunk/Source/WebCore/loader/NavigationAction.h (97715 => 97716)


--- trunk/Source/WebCore/loader/NavigationAction.h	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Source/WebCore/loader/NavigationAction.h	2011-10-18 04:47:05 UTC (rev 97716)
@@ -32,6 +32,7 @@
 #include "Event.h"
 #include "FrameLoaderTypes.h"
 #include "KURL.h"
+#include "ResourceRequest.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -39,19 +40,22 @@
     class NavigationAction {
     public:
         NavigationAction();
-        NavigationAction(const KURL&, NavigationType);
-        NavigationAction(const KURL&, FrameLoadType, bool isFormSubmission);
-        NavigationAction(const KURL&, NavigationType, PassRefPtr<Event>);
-        NavigationAction(const KURL&, FrameLoadType, bool isFormSubmission, PassRefPtr<Event>);
+        NavigationAction(const ResourceRequest&);
+        NavigationAction(const ResourceRequest&, NavigationType);
+        NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission);
+        NavigationAction(const ResourceRequest&, NavigationType, PassRefPtr<Event>);
+        NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission, PassRefPtr<Event>);
 
-        bool isEmpty() const { return m_URL.isEmpty(); }
+        bool isEmpty() const { return m_resourceRequest.url().isEmpty(); }
 
-        KURL url() const { return m_URL; }
+        KURL url() const { return m_resourceRequest.url(); }
+        const ResourceRequest& resourceRequest() const { return m_resourceRequest; }
+
         NavigationType type() const { return m_type; }
         const Event* event() const { return m_event.get(); }
 
     private:
-        KURL m_URL;
+        ResourceRequest m_resourceRequest;
         NavigationType m_type;
         RefPtr<Event> m_event;
     };

Modified: trunk/Source/WebCore/loader/PolicyChecker.cpp (97715 => 97716)


--- trunk/Source/WebCore/loader/PolicyChecker.cpp	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Source/WebCore/loader/PolicyChecker.cpp	2011-10-18 04:47:05 UTC (rev 97716)
@@ -59,7 +59,7 @@
 {
     NavigationAction action = ""
     if (action.isEmpty()) {
-        action = "" NavigationTypeOther);
+        action = "" NavigationTypeOther);
         loader->setTriggeringAction(action);
     }
 

Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (97715 => 97716)


--- trunk/Source/WebCore/page/ContextMenuController.cpp	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp	2011-10-18 04:47:05 UTC (rev 97716)
@@ -159,7 +159,7 @@
 {
     if (Page* oldPage = frame->page()) {
         FrameLoadRequest request(frame->document()->securityOrigin(), ResourceRequest(urlToLoad, frame->loader()->outgoingReferrer()));
-        if (Page* newPage = oldPage->chrome()->createWindow(frame, request, WindowFeatures(), NavigationAction())) {
+        if (Page* newPage = oldPage->chrome()->createWindow(frame, request, WindowFeatures(), NavigationAction(request.resourceRequest()))) {
             newPage->mainFrame()->loader()->loadFrameRequest(request, false, false, 0, 0, SendReferrer);   
             newPage->chrome()->show();
         }

Modified: trunk/Source/WebKit/chromium/ChangeLog (97715 => 97716)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-18 04:47:05 UTC (rev 97716)
@@ -1,3 +1,16 @@
+2011-10-17  Jochen Eisinger  <[email protected]>
+
+        Make NavigationAction wrap a ResourceRequest instead of a KURL.
+        https://bugs.webkit.org/show_bug.cgi?id=68803
+
+        Use the request in the NavigationAction, if the FrameLoadRequest
+        doesn't already contain a request.
+
+        Reviewed by Nate Chapin.
+
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::createWindow):
+
 2011-10-17  James Robinson  <[email protected]>
 
         [chromium] Fix a new[]/delete mismatch in InnerGestureRecognizerTest that makes valgrind sad

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (97715 => 97716)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2011-10-18 04:47:05 UTC (rev 97716)
@@ -256,7 +256,7 @@
 }
 
 Page* ChromeClientImpl::createWindow(
-    Frame* frame, const FrameLoadRequest& r, const WindowFeatures& features, const NavigationAction&)
+    Frame* frame, const FrameLoadRequest& r, const WindowFeatures& features, const NavigationAction& action)
 {
     if (!m_webView->client())
         return 0;
@@ -264,6 +264,8 @@
     WrappedResourceRequest request;
     if (!r.resourceRequest().isEmpty())
         request.bind(r.resourceRequest());
+    else if (!action.resourceRequest().isEmpty())
+        request.bind(action.resourceRequest());
     WebViewImpl* newView = static_cast<WebViewImpl*>(
         m_webView->client()->createView(WebFrameImpl::fromFrame(frame), request, features, r.frameName()));
     if (!newView)

Modified: trunk/Tools/ChangeLog (97715 => 97716)


--- trunk/Tools/ChangeLog	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Tools/ChangeLog	2011-10-18 04:47:05 UTC (rev 97716)
@@ -1,3 +1,18 @@
+2011-10-17  Jochen Eisinger  <[email protected]>
+
+        [chromium] add LayoutTestController.dumpCreateView() to monitor calls to WebViewClient::createView
+        https://bugs.webkit.org/show_bug.cgi?id=68803
+
+        Reviewed by Nate Chapin.
+
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        (LayoutTestController::LayoutTestController):
+        (LayoutTestController::dumpCreateView):
+        * DumpRenderTree/chromium/LayoutTestController.h:
+        (LayoutTestController::shouldDumpCreateView):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::createView):
+
 2011-10-17  Nate Chapin  <[email protected]>
 
         Add myself to watchlists, and add a watch

Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (97715 => 97716)


--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp	2011-10-18 04:47:05 UTC (rev 97716)
@@ -112,6 +112,7 @@
     bindMethod("dumpStatusCallbacks", &LayoutTestController::dumpWindowStatusChanges);
     bindMethod("dumpTitleChanges", &LayoutTestController::dumpTitleChanges);
     bindMethod("dumpPermissionClientCallbacks", &LayoutTestController::dumpPermissionClientCallbacks);
+    bindMethod("dumpCreateView", &LayoutTestController::dumpCreateView);
     bindMethod("elementDoesAutoCompleteForElementWithId", &LayoutTestController::elementDoesAutoCompleteForElementWithId);
     bindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspector);
     bindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScriptInIsolatedWorld);
@@ -384,6 +385,12 @@
     result->setNull();
 }
 
+void LayoutTestController::dumpCreateView(const CppArgumentList&, CppVariant* result)
+{
+    m_dumpCreateView = true;
+    result->setNull();
+}
+
 void LayoutTestController::setAcceptsEditing(const CppArgumentList& arguments, CppVariant* result)
 {
     if (arguments.size() > 0 && arguments[0].isBool())

Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h (97715 => 97716)


--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h	2011-10-18 04:47:05 UTC (rev 97716)
@@ -131,6 +131,11 @@
     // It takes no arguments, and ignores any that may be present.
     void dumpWindowStatusChanges(const CppArgumentList&, CppVariant*);
 
+    // This function sets a flag that tells the test_shell to dump all calls to
+    // WebViewClient::createView().
+    // It takes no arguments, and ignores any that may be present.
+    void dumpCreateView(const CppArgumentList&, CppVariant*);
+
     // When called with a boolean argument, this sets a flag that controls
     // whether content-editable elements accept editing focus when an editing
     // attempt is made. It ignores any additional arguments.
@@ -434,6 +439,7 @@
     bool shouldDumpChildFramesAsText() { return m_dumpChildFramesAsText; }
     bool shouldGeneratePixelResults() { return m_generatePixelResults; }
     void setShouldGeneratePixelResults(bool value) { m_generatePixelResults = value; }
+    bool shouldDumpCreateView() { return m_dumpCreateView; }
     bool acceptsEditing() { return m_acceptsEditing; }
     bool canOpenWindows() { return m_canOpenWindows; }
     bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; }
@@ -594,6 +600,10 @@
     // If true, the test_shell will generate pixel results in dumpAsText mode
     bool m_generatePixelResults;
 
+    // If true, output a descriptive line each time WebViewClient::createView
+    // is invoked.
+    bool m_dumpCreateView;
+
     // If true, the element will be treated as editable. This value is returned
     // from various editing callbacks that are called just before edit operations
     // are allowed.

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (97715 => 97716)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2011-10-18 04:37:22 UTC (rev 97715)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2011-10-18 04:47:05 UTC (rev 97716)
@@ -239,10 +239,12 @@
 
 // WebViewClient -------------------------------------------------------------
 
-WebView* WebViewHost::createView(WebFrame*, const WebURLRequest&, const WebWindowFeatures&, const WebString&)
+WebView* WebViewHost::createView(WebFrame*, const WebURLRequest& request, const WebWindowFeatures&, const WebString&)
 {
     if (!layoutTestController()->canOpenWindows())
         return 0;
+    if (layoutTestController()->shouldDumpCreateView())
+        fprintf(stdout, "createView(%s)\n", URLDescription(request.url()).c_str());
     return m_shell->createNewWindow(WebURL())->webView();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to