mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
browser(webkit): install page group preferences to new pages (#2118)
This commit is contained in:
parent
193924f405
commit
38a78bf96b
@ -1 +1 @@
|
||||
1218
|
||||
1219
|
||||
|
||||
@ -12636,10 +12636,10 @@ index 0000000000000000000000000000000000000000..30e6ae3bdc8c1695189885afae949071
|
||||
+} // namespace WebKit
|
||||
diff --git a/Source/WebKit/UIProcess/win/InspectorPlaywrightAgentClientWin.cpp b/Source/WebKit/UIProcess/win/InspectorPlaywrightAgentClientWin.cpp
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..544442b75afcba6e121ab202ad32dcdfaf923e2e
|
||||
index 0000000000000000000000000000000000000000..9ea75b043513fe4c56b3af33d2082375971a75f7
|
||||
--- /dev/null
|
||||
+++ b/Source/WebKit/UIProcess/win/InspectorPlaywrightAgentClientWin.cpp
|
||||
@@ -0,0 +1,83 @@
|
||||
@@ -0,0 +1,82 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2020 Microsoft Corporation.
|
||||
+ *
|
||||
@ -12695,7 +12695,6 @@ index 0000000000000000000000000000000000000000..544442b75afcba6e121ab202ad32dcdf
|
||||
+RefPtr<WebPageProxy> InspectorPlaywrightAgentClientWin::createPage(WTF::String& error, const BrowserContext& context)
|
||||
+{
|
||||
+ auto conf = API::PageConfiguration::create();
|
||||
+ auto prefs = WebPreferences::create(String(), "WebKit2Automation.", "WebKit2Automation.");
|
||||
+ conf->setProcessPool(context.processPool.get());
|
||||
+ conf->setWebsiteDataStore(context.dataStore.get());
|
||||
+ return toImpl(m_createPage(toAPI(&conf.get())));
|
||||
|
||||
@ -173,27 +173,18 @@ void MainWindow::rescaleToolbar()
|
||||
m_toolbarItemsWidth = rect.right;
|
||||
}
|
||||
|
||||
bool MainWindow::init(HINSTANCE hInstance, WKContextRef context, WKWebsiteDataStoreRef dataStore)
|
||||
bool MainWindow::init(HINSTANCE hInstance, WKPageConfigurationRef conf)
|
||||
{
|
||||
auto conf = adoptWK(WKPageConfigurationCreate());
|
||||
auto pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(createWKString("WinPlaywright").get()));
|
||||
auto prefs = adoptWK(WKPreferencesCreate());
|
||||
|
||||
auto pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(createWKString("WinPlaywright").get()));
|
||||
WKPageConfigurationSetPageGroup(conf.get(), pageGroup.get());
|
||||
WKPageConfigurationSetPageGroup(conf, pageGroup.get());
|
||||
WKPageConfigurationSetPreferences(conf, prefs.get());
|
||||
WKPageGroupSetPreferences(pageGroup.get(), prefs.get());
|
||||
|
||||
WKPreferencesSetMediaCapabilitiesEnabled(prefs.get(), false);
|
||||
WKPreferencesSetDeveloperExtrasEnabled(prefs.get(), true);
|
||||
WKPageConfigurationSetPreferences(conf.get(), prefs.get());
|
||||
|
||||
WKPageConfigurationSetContext(conf.get(), context);
|
||||
WKPageConfigurationSetWebsiteDataStore(conf.get(), dataStore);
|
||||
|
||||
return init(hInstance, conf.get());
|
||||
}
|
||||
|
||||
bool MainWindow::init(HINSTANCE hInstance, WKPageConfigurationRef conf)
|
||||
{
|
||||
m_configuration = conf;
|
||||
|
||||
registerClass(hInstance);
|
||||
|
||||
@ -40,7 +40,6 @@ public:
|
||||
MainWindow();
|
||||
|
||||
~MainWindow();
|
||||
bool init(HINSTANCE hInstance, WKContextRef, WKWebsiteDataStoreRef);
|
||||
bool init(HINSTANCE hInstance, WKPageConfigurationRef);
|
||||
|
||||
void resizeSubViews();
|
||||
|
||||
@ -340,6 +340,7 @@ void WebKitBrowserWindow::handleJavaScriptDialog(WKPageRef page, bool accept, WK
|
||||
|
||||
WKPageRef WebKitBrowserWindow::createPageCallback(WKPageConfigurationRef configuration)
|
||||
{
|
||||
// This comes from the Playwright agent, configuration is a pool+data pair.
|
||||
return WebKitBrowserWindow::createViewCallback(configuration, true);
|
||||
}
|
||||
|
||||
@ -357,6 +358,7 @@ WKPageRef WebKitBrowserWindow::createViewCallback(WKPageConfigurationRef configu
|
||||
|
||||
WKPageRef WebKitBrowserWindow::createNewPage(WKPageRef, WKPageConfigurationRef configuration, WKNavigationActionRef, WKWindowFeaturesRef, const void*)
|
||||
{
|
||||
// This comes from the client for popups, configuration is inherited from main page.
|
||||
// Retain popups as per API contract.
|
||||
WKRetainPtr<WKPageRef> newPage = createViewCallback(configuration, false);
|
||||
return newPage.leakRef();
|
||||
|
||||
@ -110,7 +110,10 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
||||
WKContextSetPrimaryDataStore(context.get(), dataStore.get());
|
||||
|
||||
auto* mainWindow = new MainWindow();
|
||||
HRESULT hr = mainWindow->init(hInst, context.get(), dataStore.get());
|
||||
auto conf = adoptWK(WKPageConfigurationCreate());
|
||||
WKPageConfigurationSetContext(conf.get(), context.get());
|
||||
WKPageConfigurationSetWebsiteDataStore(conf.get(), dataStore.get());
|
||||
HRESULT hr = mainWindow->init(hInst, conf.get());
|
||||
if (FAILED(hr))
|
||||
goto exit;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user