Skip to content

Commit f5911de

Browse files
authored
browser(webkit): release GTK app only if it has been referenced (#2885)
1 parent 83bba08 commit f5911de

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

browser_patches/webkit/BUILD_NUMBER

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
1304
2-
Changed: [email protected] Wed Jul 8 14:22:16 PDT 2020
1+
1305
2+
Changed: [email protected] Wed Jul 8 15:26:58 PDT 2020

browser_patches/webkit/patches/bootstrap.diff

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15037,7 +15037,7 @@ index 62629b4c1c25ae82bd797b39bbf9de0331f8eed2..5de7900a29b0e629f1ac404bbb0dc5b4
1503715037

1503815038
typedef struct _BrowserWindow BrowserWindow;
1503915039
diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c
15040-
index 61cb729e9e8e24d85c0d678c64a3dbae1c085f63..0efc11a6565ce3e4ec8e5bea6e12216f9d04e4c1 100644
15040+
index 61cb729e9e8e24d85c0d678c64a3dbae1c085f63..52f1f175cfd5c0e73cd74eca95a46b085ac98b37 100644
1504115041
--- a/Tools/MiniBrowser/gtk/main.c
1504215042
+++ b/Tools/MiniBrowser/gtk/main.c
1504315043
@@ -55,7 +55,12 @@ static const char *cookiesPolicy;
@@ -15064,7 +15064,7 @@ index 61cb729e9e8e24d85c0d678c64a3dbae1c085f63..0efc11a6565ce3e4ec8e5bea6e12216f
1506415064
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URL…]" },
1506515065
{ 0, 0, 0, 0, 0, 0, 0 }
1506615066
};
15067-
@@ -530,6 +539,41 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul
15067+
@@ -530,6 +539,48 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul
1506815068
g_main_loop_quit(data->mainLoop);
1506915069
}
1507015070

@@ -15094,28 +15094,34 @@ index 61cb729e9e8e24d85c0d678c64a3dbae1c085f63..0efc11a6565ce3e4ec8e5bea6e12216f
1509415094
+ g_application_release(G_APPLICATION(browserApplication));
1509515095
+}
1509615096
+
15097+
+static void keepApplicationAliveUntilQuit(GApplication *application)
15098+
+{
15099+
+ // Reference the application, it will be released in quitBroserApplication.
15100+
+ g_application_hold(application);
15101+
+ WebKitBrowserInspector* browserInspector = webkit_browser_inspector_get_default();
15102+
+ g_signal_connect(browserInspector, "quit-application", G_CALLBACK(quitBroserApplication), NULL);
15103+
+}
15104+
+
1509715105
+static void configureBrowserInspectorPipe()
1509815106
+{
1509915107
+ WebKitBrowserInspector* browserInspector = webkit_browser_inspector_get_default();
1510015108
+ g_signal_connect(browserInspector, "create-new-page", G_CALLBACK(createNewPage), NULL);
15101-
+ g_signal_connect(browserInspector, "quit-application", G_CALLBACK(quitBroserApplication), NULL);
1510215109
+
1510315110
+ webkit_browser_inspector_initialize_pipe(proxy, ignoreHosts);
1510415111
+}
1510515112
+
1510615113
static void startup(GApplication *application)
1510715114
{
1510815115
const char *actionAccels[] = {
15109-
@@ -560,23 +604,37 @@ static void startup(GApplication *application)
15116+
@@ -560,23 +611,36 @@ static void startup(GApplication *application)
1511015117

1511115118
static void activate(GApplication *application, WebKitSettings *webkitSettings)
1511215119
{
1511315120
+ if (inspectorPipe)
1511415121
+ configureBrowserInspectorPipe();
1511515122
+
1511615123
+ if (noStartupWindow) {
15117-
+ // Reference the application, it will be released in quitBroserApplication.
15118-
+ g_application_hold(application);
15124+
+ keepApplicationAliveUntilQuit(application);
1511915125
+ g_clear_object(&webkitSettings);
1512015126
+ return;
1512115127
+ }
@@ -15147,7 +15153,7 @@ index 61cb729e9e8e24d85c0d678c64a3dbae1c085f63..0efc11a6565ce3e4ec8e5bea6e12216f
1514715153
g_object_unref(manager);
1514815154

1514915155
if (cookiesPolicy) {
15150-
@@ -595,7 +653,7 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings)
15156+
@@ -595,7 +659,7 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings)
1515115157
}
1515215158

1515315159
if (proxy) {
@@ -15156,7 +15162,7 @@ index 61cb729e9e8e24d85c0d678c64a3dbae1c085f63..0efc11a6565ce3e4ec8e5bea6e12216f
1515615162
webkit_web_context_set_network_proxy_settings(webContext, WEBKIT_NETWORK_PROXY_MODE_CUSTOM, webkitProxySettings);
1515715163
webkit_network_proxy_settings_free(webkitProxySettings);
1515815164
}
15159-
@@ -661,9 +719,7 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings)
15165+
@@ -661,9 +725,7 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings)
1516015166
WebKitWebView *webView = createBrowserTab(mainWindow, webkitSettings, userContentManager, defaultWebsitePolicies);
1516115167
if (!i)
1516215168
firstTab = GTK_WIDGET(webView);
@@ -15167,7 +15173,7 @@ index 61cb729e9e8e24d85c0d678c64a3dbae1c085f63..0efc11a6565ce3e4ec8e5bea6e12216f
1516715173
}
1516815174
} else {
1516915175
WebKitWebView *webView = createBrowserTab(mainWindow, webkitSettings, userContentManager, defaultWebsitePolicies);
15170-
@@ -739,9 +795,11 @@ int main(int argc, char *argv[])
15176+
@@ -739,9 +801,11 @@ int main(int argc, char *argv[])
1517115177
}
1517215178

1517315179
GtkApplication *application = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE);

0 commit comments

Comments
 (0)