Commit ab6cca3f authored by alice.liu@apple.com's avatar alice.liu@apple.com

https://bugs.webkit.org/show_bug.cgi?id=66823

Add the request info to the WebPageProxy::CreateNewPage message

Reviewed by Anders Carlsson.

Source/WebKit2: 

Update function declarations with additional ResourceRequest parameter:
* UIProcess/API/C/WKPage.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::createNewPage):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::createNewPage):
* UIProcess/WebUIClient.h:

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createWindow): 
Pass the ResourceRequest within the FrameLoadRequest.

Tools: 

Update function declarations with additional parameter:
* MiniBrowser/gtk/BrowserWindow.c:
(createNewPage):
* MiniBrowser/mac/BrowserWindowController.m:
(createNewPage):
* MiniBrowser/win/BrowserView.cpp:
(createNewPage):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage):
* WebKitTestRunner/TestController.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@93902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 58a47bd1
2011-08-26 Alice Liu <alice.liu@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=66823
Add the request info to the WebPageProxy::CreateNewPage message
Reviewed by Anders Carlsson.
Update function declarations with additional ResourceRequest parameter:
* UIProcess/API/C/WKPage.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::createNewPage):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::createNewPage):
* UIProcess/WebUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createWindow):
Pass the ResourceRequest within the FrameLoadRequest.
2011-08-26 Alexis Menard <alexis.menard@openbossa.org>
[Qt][WK2]REGRESSION(r93784): It made many tests crash
......
......@@ -35,4 +35,9 @@ const size_t APIClientTraits<WKBundlePageLoaderClient>::interfaceSizesByVersion[
sizeof(WKBundlePageLoaderClient)
};
const size_t APIClientTraits<WKPageUIClient>::interfaceSizesByVersion[] = {
offsetof(WKPageUIClient, createNewPage),
sizeof(WKPageUIClient)
};
} // namespace WebKit
......@@ -27,6 +27,7 @@
#define APIClientTraits_h
#include "WKBundlePage.h"
#include "WKPage.h"
namespace WebKit {
......@@ -41,6 +42,11 @@ template<> struct APIClientTraits<WKBundlePageLoaderClient>
static const size_t interfaceSizesByVersion[2];
};
template<> struct APIClientTraits<WKPageUIClient>
{
static const size_t interfaceSizesByVersion[2];
};
} // namespace WebKit
#endif // APIClientTraits_h
......@@ -160,7 +160,7 @@ typedef struct WKPageResourceLoadClient WKPageResourceLoadClient;
enum { kWKPageResourceLoadClientCurrentVersion = 0 };
// UI Client
typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo);
typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo);
......@@ -195,10 +195,15 @@ typedef void (*WKPageDidCompleteRubberBandForMainFrameCallback)(WKPageRef page,
typedef void (*WKPageSaveDataToFileInDownloadsFolderCallback)(WKPageRef page, WKStringRef suggestedFilename, WKStringRef mimeType, WKURLRef originatingURL, WKDataRef data, const void* clientInfo);
typedef bool (*WKPageShouldInterruptJavaScriptCallback)(WKPageRef page, const void *clientInfo);
// Deprecated
typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
struct WKPageUIClient {
int version;
const void * clientInfo;
WKPageCreateNewPageCallback createNewPage;
// Version 0
WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0;
WKPageCallback showPage;
WKPageCallback close;
WKPageTakeFocusCallback takeFocus;
......@@ -236,11 +241,14 @@ struct WKPageUIClient {
WKPageCallback runModal;
WKPageDidCompleteRubberBandForMainFrameCallback didCompleteRubberBandForMainFrame;
WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder;
WKPageShouldInterruptJavaScriptCallback shouldInterruptJavaScript;
WKPageShouldInterruptJavaScriptCallback shouldInterruptJavaScript;
// Version 1
WKPageCreateNewPageCallback createNewPage;
};
typedef struct WKPageUIClient WKPageUIClient;
enum { kWKPageUIClientCurrentVersion = 0 };
enum { kWKPageUIClientCurrentVersion = 1 };
// Find client.
typedef void (*WKPageDidFindStringCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);
......
......@@ -1893,9 +1893,9 @@ void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIde
// UIClient
void WebPageProxy::createNewPage(const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters)
void WebPageProxy::createNewPage(const ResourceRequest& request, const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters)
{
RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton));
RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, request, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton));
if (newPage) {
newPageID = newPage->pageID();
newPageParameters = newPage->creationParameters();
......
......@@ -614,7 +614,7 @@ private:
void didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceError&);
// UI client
void createNewPage(const WebCore::WindowFeatures&, uint32_t modifiers, int32_t mouseButton, uint64_t& newPageID, WebPageCreationParameters&);
void createNewPage(const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, uint32_t modifiers, int32_t mouseButton, uint64_t& newPageID, WebPageCreationParameters&);
void showPage();
void closePage(bool stopResponsivenessTimer);
void runJavaScriptAlert(uint64_t frameID, const String&);
......
......@@ -22,7 +22,7 @@
messages -> WebPageProxy {
# UI messages
CreateNewPage(WebCore::WindowFeatures windowFeatures, uint32_t modifiers, int32_t mouseButton) -> (uint64_t newPageID, WebKit::WebPageCreationParameters newPageParameters)
CreateNewPage(WebCore::ResourceRequest request, WebCore::WindowFeatures windowFeatures, uint32_t modifiers, int32_t mouseButton) -> (uint64_t newPageID, WebKit::WebPageCreationParameters newPageParameters)
ShowPage()
ClosePage(bool stopResponsivenessTimer)
RunJavaScriptAlert(uint64_t frameID, WTF::String message) -> ()
......
......@@ -43,9 +43,12 @@ using namespace WebCore;
namespace WebKit {
PassRefPtr<WebPageProxy> WebUIClient::createNewPage(WebPageProxy* page, const WindowFeatures& windowFeatures, WebEvent::Modifiers modifiers, WebMouseEvent::Button button)
PassRefPtr<WebPageProxy> WebUIClient::createNewPage(WebPageProxy* page, const ResourceRequest& resourceRequest, const WindowFeatures& windowFeatures, WebEvent::Modifiers modifiers, WebMouseEvent::Button button)
{
if (!m_client.createNewPage)
if (!m_client.version && !m_client.createNewPage_deprecatedForUseWithV0)
return 0;
if (m_client.version == kWKPageUIClientCurrentVersion && !m_client.createNewPage)
return 0;
ImmutableDictionary::MapType map;
......@@ -66,7 +69,11 @@ PassRefPtr<WebPageProxy> WebUIClient::createNewPage(WebPageProxy* page, const Wi
map.set("dialog", WebBoolean::create(windowFeatures.dialog));
RefPtr<ImmutableDictionary> featuresMap = ImmutableDictionary::adopt(map);
return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(featuresMap.get()), toAPI(modifiers), toAPI(button), m_client.clientInfo)));
if (!m_client.version)
return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV0(toAPI(page), toAPI(featuresMap.get()), toAPI(modifiers), toAPI(button), m_client.clientInfo)));
RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(request.get()), toAPI(featuresMap.get()), toAPI(modifiers), toAPI(button), m_client.clientInfo)));
}
void WebUIClient::showPage(WebPageProxy* page)
......
......@@ -36,6 +36,7 @@
namespace WebCore {
class FloatRect;
class IntSize;
class ResourceRequest;
struct WindowFeatures;
}
......@@ -53,7 +54,7 @@ class WebOpenPanelResultListenerProxy;
class WebUIClient : public APIClient<WKPageUIClient, kWKPageUIClientCurrentVersion> {
public:
PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, const WebCore::WindowFeatures&, WebEvent::Modifiers, WebMouseEvent::Button);
PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, WebEvent::Modifiers, WebMouseEvent::Button);
void showPage(WebPageProxy*);
void close(WebPageProxy*);
......
......@@ -49,6 +49,7 @@
#include <WebCore/FileChooser.h>
#include <WebCore/FileIconLoader.h>
#include <WebCore/Frame.h>
#include <WebCore/FrameLoadRequest.h>
#include <WebCore/FrameLoader.h>
#include <WebCore/FrameView.h>
#include <WebCore/HTMLNames.h>
......@@ -156,14 +157,14 @@ void WebChromeClient::focusedFrameChanged(Frame* frame)
WebProcess::shared().connection()->send(Messages::WebPageProxy::FocusedFrameChanged(webFrame ? webFrame->frameID() : 0), m_page->pageID());
}
Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
{
uint32_t modifiers = static_cast<uint32_t>(InjectedBundleNavigationAction::modifiersForNavigationAction(navigationAction));
int32_t mouseButton = static_cast<int32_t>(InjectedBundleNavigationAction::mouseButtonForNavigationAction(navigationAction));
uint64_t newPageID = 0;
WebPageCreationParameters parameters;
if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::CreateNewPage(windowFeatures, modifiers, mouseButton), Messages::WebPageProxy::CreateNewPage::Reply(newPageID, parameters), m_page->pageID()))
if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::CreateNewPage(request.resourceRequest(), windowFeatures, modifiers, mouseButton), Messages::WebPageProxy::CreateNewPage::Reply(newPageID, parameters), m_page->pageID()))
return 0;
if (!newPageID)
......
2011-08-26 Alice Liu <alice.liu@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=66823
Add the request info to the WebPageProxy::CreateNewPage message
Reviewed by Anders Carlsson.
Update function declarations with additional parameter:
* MiniBrowser/gtk/BrowserWindow.c:
(createNewPage):
* MiniBrowser/mac/BrowserWindowController.m:
(createNewPage):
* MiniBrowser/win/BrowserView.cpp:
(createNewPage):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage):
* WebKitTestRunner/TestController.h:
2011-08-26 Noel Gordon <noel.gordon@gmail.com>
Make show-pretty-diff work on linux
......@@ -522,7 +522,7 @@ static void browserWindowLoaderClientInit(BrowserWindow* window)
}
// UI Client.
static WKPageRef createNewPage(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton button, const void *clientInfo)
static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef request, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton button, const void *clientInfo)
{
WKViewRef webView = WKViewCreate(WKPageGetContext(page), 0);
BrowserWindow* window = BROWSER_WINDOW(browser_window_new(webView));
......@@ -613,7 +613,7 @@ static void browserWindowUIClientInit(BrowserWindow *window)
WKPageUIClient uiClient = {
kWKPageUIClientCurrentVersion,
window, /* clientInfo */
createNewPage,
0, /* createNewPage_deprecatedForUseWithV0 */
showPage,
closePage,
0, /* takeFocus */
......@@ -651,7 +651,8 @@ static void browserWindowUIClientInit(BrowserWindow *window)
0, /* runModal */
0, /* didCompleteRubberBandForMainFrame */
0, /* saveDataToFileInDownloadsFolder */
0 /* shouldInterruptJavaScript */
0, /* shouldInterruptJavaScript */
createNewPage
};
WKPageSetPageUIClient(WKViewGetPage(window->webView), &uiClient);
}
......
......@@ -377,7 +377,7 @@ static void decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLRespo
// MARK: UI Client Callbacks
static WKPageRef createNewPage(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton button, const void* clientInfo)
static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef request, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton button, const void* clientInfo)
{
LOG(@"createNewPage");
BrowserWindowController *controller = [[BrowserWindowController alloc] initWithContext:WKPageGetContext(page)];
......@@ -616,7 +616,7 @@ - (void)awakeFromNib
WKPageUIClient uiClient = {
kWKPageUIClientCurrentVersion,
self, /* clientInfo */
createNewPage,
0, /* createNewPage_deprecatedForUseWithV0 */
showPage,
closePage,
0, /* takeFocus */
......@@ -655,6 +655,7 @@ - (void)awakeFromNib
0, // didCompleteRubberBandForMainFrame
0, // saveDataToFileInDownloadsFolder
0, // shouldInterruptJavaScript
createNewPage,
};
WKPageSetPageUIClient(_webView.pageRef, &uiClient);
}
......
......@@ -39,7 +39,7 @@ BrowserView::BrowserView()
// UI Client Callbacks
static WKPageRef createNewPage(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void* clientInfo)
static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef request, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void* clientInfo)
{
BrowserWindow* browserWindow = BrowserWindow::create();
browserWindow->createWindow(0, 0, 800, 600);
......@@ -95,7 +95,7 @@ void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow)
WKPageUIClient uiClient = {
kWKPageUIClientCurrentVersion,
parentWindow, /* clientInfo */
createNewPage,
0, /* createNewPage_deprecatedForUseWithV0 */
showPage,
closePage,
0, /* takeFocus */
......@@ -106,6 +106,7 @@ void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow)
runJavaScriptPrompt,
setStatusText,
mouseDidMoveOverElement,
0, /* missingPluginButtonClicked */
0, /* didNotHandleKeyEvent */
0, /* didNotHandleWheelEvent */
0, /* toolbarsAreVisible */
......@@ -124,7 +125,16 @@ void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow)
0, /* exceededDatabaseQuota */
0, /* runOpenPanel */
0, /* decidePolicyForGeolocationPermissionRequest */
0, /* headerHeight */
0, /* footerHeight */
0, /* drawHeader */
0, /* drawFooter */
0, /* printFrame */
0, /* runModal */
0, /* didCompleteRubberBandForMainFrame */
0, /* saveDataToFileInDownloadsFolder */
0, /* shouldInterruptJavaScript */
createNewPage,
};
WKPageSetPageUIClient(WKViewGetPage(m_webView), &uiClient);
......
......@@ -130,7 +130,7 @@ static void closeOtherPage(WKPageRef page, const void* clientInfo)
delete view;
}
WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
{
PlatformWebView* view = new PlatformWebView(WKPageGetContext(oldPage), WKPageGetPageGroup(oldPage));
WKPageRef newPage = view->page();
......@@ -140,7 +140,7 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKDictionaryRef, WK
WKPageUIClient otherPageUIClient = {
kWKPageUIClientCurrentVersion,
view,
createOtherPage,
0, // createNewPage_deprecatedForUseWithV0
0, // showPage
closeOtherPage,
0, // takeFocus
......@@ -179,6 +179,7 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKDictionaryRef, WK
0, // didCompleteRubberBandForMainFrame
0, // saveDataToFileInDownloadsFolder
0, // shouldInterruptJavaScript
createOtherPage,
};
WKPageSetPageUIClient(newPage, &otherPageUIClient);
......@@ -283,7 +284,7 @@ void TestController::initialize(int argc, const char* argv[])
WKPageUIClient pageUIClient = {
kWKPageUIClientCurrentVersion,
this,
createOtherPage,
0, // createNewPage_deprecatedForUseWithV0
0, // showPage
0, // close
0, // takeFocus
......@@ -322,6 +323,7 @@ void TestController::initialize(int argc, const char* argv[])
0, // didCompleteRubberBandForMainFrame
0, // saveDataToFileInDownloadsFolder
0, // shouldInterruptJavaScript
createOtherPage,
};
WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
......
......@@ -88,7 +88,7 @@ private:
static void processDidCrash(WKPageRef, const void* clientInfo);
void processDidCrash();
static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*);
static WKPageRef createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*);
static void runModal(WKPageRef, const void* clientInfo);
static void runModal(PlatformWebView*);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment