[BlackBerry] PagePopupBlackBerry::closePopup() should always clear the pointer in...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Jul 2012 23:05:17 +0000 (23:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Jul 2012 23:05:17 +0000 (23:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90817

Patch by Yong Li <yoli@rim.com> on 2012-07-09
Reviewed by Rob Buis.

PR# 174085.
PagePopupBlackBerry::closePopup() should always clear the pointer in WebPagePrivate to avoid crashes.
This patch also removes unused variable m_parentPopup and its setter.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::WebPagePrivate): Remove m_parentPopup.
* Api/WebPage_p.h:
(WebPagePrivate):
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::closePagePopup):
* WebCoreSupport/PagePopupBlackBerry.cpp:
(WebCore::PagePopupBlackBerry::init): Remove the setParentPopup() call.
(WebCore::PagePopupBlackBerry::closePopup): Clear the reference in WebPagePrivate.
* WebCoreSupport/SelectPopupClient.cpp:
(WebCore::SelectPopupClient::setValueAndClosePopup): Add an assert for valid m_element.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@122162 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/Api/WebPage_p.h
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp
Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp
Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp

index 4fe6ca5..c68cc1d 100644 (file)
@@ -404,7 +404,6 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In
     , m_updateDelegatedOverlaysDispatched(false)
     , m_deferredTasksTimer(this, &WebPagePrivate::deferredTasksTimerFired)
     , m_selectPopup(0)
-    , m_parentPopup(0)
     , m_autofillManager(AutofillManager::create(this))
 {
     static bool isInitialized = false;
@@ -6666,11 +6665,6 @@ PagePopupBlackBerry* WebPage::popup()
     return d->m_selectPopup;
 }
 
-void WebPagePrivate::setParentPopup(PagePopupBlackBerry* webPopup)
-{
-    m_parentPopup = webPopup;
-}
-
 void WebPagePrivate::setInspectorOverlayClient(WebCore::InspectorOverlay::InspectorOverlayClient* inspectorOverlayClient)
 {
     if (inspectorOverlayClient) {
index 83e4a8c..a0ffce0 100644 (file)
@@ -622,8 +622,6 @@ public:
 
     // The popup that opened in this webpage
     WebCore::PagePopupBlackBerry* m_selectPopup;
-    // The popup that owned this webpage
-    WebCore::PagePopupBlackBerry* m_parentPopup;
 
     RefPtr<WebCore::AutofillManager> m_autofillManager;
 protected:
index f154e7e..3645889 100644 (file)
@@ -1,3 +1,26 @@
+2012-07-09  Yong Li  <yoli@rim.com>
+
+        [BlackBerry] PagePopupBlackBerry::closePopup() should always clear the pointer in WebPagePrivate
+        https://bugs.webkit.org/show_bug.cgi?id=90817
+
+        Reviewed by Rob Buis.
+
+        PR# 174085.
+        PagePopupBlackBerry::closePopup() should always clear the pointer in WebPagePrivate to avoid crashes.
+        This patch also removes unused variable m_parentPopup and its setter.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate): Remove m_parentPopup.
+        * Api/WebPage_p.h:
+        (WebPagePrivate):
+        * WebCoreSupport/ChromeClientBlackBerry.cpp:
+        (WebCore::ChromeClientBlackBerry::closePagePopup):
+        * WebCoreSupport/PagePopupBlackBerry.cpp:
+        (WebCore::PagePopupBlackBerry::init): Remove the setParentPopup() call.
+        (WebCore::PagePopupBlackBerry::closePopup): Clear the reference in WebPagePrivate.
+        * WebCoreSupport/SelectPopupClient.cpp:
+        (WebCore::SelectPopupClient::setValueAndClosePopup): Add an assert for valid m_element.
+
 2012-07-09  Mike Lattanzio  <mlattanzio@rim.com>
 
         [BlackBerry] meta viewport initial-scale doesn't factor in device pixel ratio
index 4fd8bf4..29de800 100644 (file)
@@ -316,11 +316,11 @@ PagePopup* ChromeClientBlackBerry::openPagePopup(PagePopupClient* client, const
 
 void ChromeClientBlackBerry::closePagePopup(PagePopup*)
 {
-    if (hasOpenedPopup()) {
-        PagePopupBlackBerry* webPopup = m_webPagePrivate->m_webPage->popup();
-        webPopup->closePopup();
-        m_webPagePrivate->m_webPage->popupClosed();
-    }
+    if (!hasOpenedPopup())
+        return;
+
+    PagePopupBlackBerry* webPopup = m_webPagePrivate->m_webPage->popup();
+    webPopup->closePopup();
 }
 
 void ChromeClientBlackBerry::setToolbarsVisible(bool)
index 354f128..5141a89 100644 (file)
@@ -68,8 +68,6 @@ bool PagePopupBlackBerry::init(WebPage* webpage)
 
     installDomFunction(webpage->d->mainFrame());
 
-    webpage->d->setParentPopup(this);
-
     return true;
 }
 
@@ -162,6 +160,7 @@ void PagePopupBlackBerry::closePopup()
 {
     m_client->didClosePopup();
     m_webPagePrivate->client()->closePopupWebView();
+    m_webPagePrivate->m_webPage->popupClosed();
 }
 
 }
index 3607664..00058ef 100644 (file)
@@ -144,7 +144,7 @@ String SelectPopupClient::htmlSource()
 
 void SelectPopupClient::setValueAndClosePopup(int, const String& stringValue)
 {
-
+    ASSERT(m_element);
     ASSERT(m_size == stringValue.length());
 
     if (m_size > 0) {