Title: [261781] trunk/Source/WebKit
Revision
261781
Author
yu...@chromium.org
Date
2020-05-16 02:21:33 -0700 (Sat, 16 May 2020)

Log Message

[GTK] Do not leak pages created by window.open
https://bugs.webkit.org/show_bug.cgi?id=211970

Reviewed by Carlos Garcia Campos.

Previously webkitWebViewCreateNewPage created unbalanced refence to WebPageProxy and returned
it as a raw pointer. That raw pointer was later wrapped in a RefPtr in WebKitUIClient.
This change ensures that all refs are balanced by returnin RefPtr instead of
a raw pointer.

* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewCreateNewPage):
* UIProcess/API/glib/WebKitWebViewPrivate.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (261780 => 261781)


--- trunk/Source/WebKit/ChangeLog	2020-05-16 08:24:22 UTC (rev 261780)
+++ trunk/Source/WebKit/ChangeLog	2020-05-16 09:21:33 UTC (rev 261781)
@@ -1,3 +1,19 @@
+2020-05-16  Yury Semikhatsky  <yu...@chromium.org>
+
+        [GTK] Do not leak pages created by window.open
+        https://bugs.webkit.org/show_bug.cgi?id=211970
+
+        Reviewed by Carlos Garcia Campos.
+
+        Previously webkitWebViewCreateNewPage created unbalanced refence to WebPageProxy and returned
+        it as a raw pointer. That raw pointer was later wrapped in a RefPtr in WebKitUIClient.
+        This change ensures that all refs are balanced by returnin RefPtr instead of
+        a raw pointer.
+
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkitWebViewCreateNewPage):
+        * UIProcess/API/glib/WebKitWebViewPrivate.h:
+
 2020-05-15  Alex Christensen  <achristen...@webkit.org>
 
         Use enum serialization instead of casting to/from uint32_t

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (261780 => 261781)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2020-05-16 08:24:22 UTC (rev 261780)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2020-05-16 09:21:33 UTC (rev 261781)
@@ -2320,7 +2320,7 @@
 }
 #endif
 
-WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView* webView, const WindowFeatures& windowFeatures, WebKitNavigationAction* navigationAction)
+RefPtr<WebPageProxy> webkitWebViewCreateNewPage(WebKitWebView* webView, const WindowFeatures& windowFeatures, WebKitNavigationAction* navigationAction)
 {
     WebKitWebView* newWebView;
     g_signal_emit(webView, signals[CREATE], 0, navigationAction, &newWebView);
@@ -2334,8 +2334,7 @@
 
     webkitWindowPropertiesUpdateFromWebWindowFeatures(newWebView->priv->windowProperties.get(), windowFeatures);
 
-    RefPtr<WebPageProxy> newPage = &getPage(newWebView);
-    return newPage.leakRef();
+    return makeRefPtr(getPage(newWebView));
 }
 
 void webkitWebViewReadyToShowPage(WebKitWebView* webView)

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h (261780 => 261781)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h	2020-05-16 08:24:22 UTC (rev 261780)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h	2020-05-16 09:21:33 UTC (rev 261781)
@@ -52,7 +52,7 @@
 void webkitWebViewGetLoadDecisionForIcon(WebKitWebView*, const WebCore::LinkIcon&, Function<void(bool)>&&);
 void webkitWebViewSetIcon(WebKitWebView*, const WebCore::LinkIcon&, API::Data&);
 #endif
-WebKit::WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView*, const WebCore::WindowFeatures&, WebKitNavigationAction*);
+RefPtr<WebKit::WebPageProxy> webkitWebViewCreateNewPage(WebKitWebView*, const WebCore::WindowFeatures&, WebKitNavigationAction*);
 void webkitWebViewReadyToShowPage(WebKitWebView*);
 void webkitWebViewRunAsModal(WebKitWebView*);
 void webkitWebViewClosePage(WebKitWebView*);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to