Really set URLRequestContextGetter inside CookieManager.
authorWojciech Wiśniewski <w.wisniewski@samsung.com>
Mon, 19 Jan 2015 16:44:35 +0000 (17:44 +0100)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
CookieManager has member pointer into URLRequestContextGetter (request_context_getter_),
but because of the way objects of these classes were created, this pointer was never
properly initialized (it was always set to NULL). This patch makes it initialize properly.
Reviewed by: Daniel Waślicki, Janusz Majnert, Kamil Klimek, Piotr Tworek, SeungSeop Park

Change-Id: I1b55be86288b82d34bc34edc1970c84c0a60af15
Signed-off-by: Wojciech Wiśniewski <w.wisniewski@samsung.com>
tizen_src/impl/API/ewk_cookie_manager_private.h
tizen_src/impl/cookie_manager.cc
tizen_src/impl/cookie_manager.h
tizen_src/impl/eweb_context.cc
tizen_src/impl/url_request_context_getter_efl.cc

index 171ab78c7951ee61e769300734bdeda44decfbd8..0a4d5a2ca1fd22cce8c5f133c74d58bbc2ada894 100644 (file)
@@ -7,14 +7,10 @@
 
 #include "cookie_manager.h"
 
-namespace content {
-class URLRequestCOntextGetterEfl;
-}
-
 class Ewk_Cookie_Manager {
  public:
-  static Ewk_Cookie_Manager* create(content::URLRequestContextGetterEfl* request_context_getter) {
-    return (new Ewk_Cookie_Manager(request_context_getter));
+  static Ewk_Cookie_Manager* create() {
+    return new Ewk_Cookie_Manager;
   }
 
   ~Ewk_Cookie_Manager() { }
@@ -24,8 +20,8 @@ class Ewk_Cookie_Manager {
   }
 
  private:
-  explicit Ewk_Cookie_Manager(content::URLRequestContextGetterEfl* request_context_getter)
-    : cookie_manager_(new CookieManager(request_context_getter)) {
+  Ewk_Cookie_Manager()
+    : cookie_manager_(new CookieManager) {
   }
 
   scoped_refptr<CookieManager> cookie_manager_;
index b368bb75cd295bc460cdd01fb704680eb7c567ba..fbd51696c2cd1af58d87138041e01623381e3ce3 100644 (file)
@@ -74,13 +74,16 @@ class CookieManager::EwkGetHostCallback {
     void* user_data_;
 };
 
-CookieManager::CookieManager(content::URLRequestContextGetterEfl* request_context_getter)
+CookieManager::CookieManager()
     : is_clearing_(false),
-      request_context_getter_(request_context_getter),
       cookie_policy_(TW_COOKIE_ACCEPT_POLICY_ALWAYS)
 {
 }
 
+void CookieManager::SetRequestContextGetter(content::URLRequestContextGetterEfl* getter) {
+  request_context_getter_ = getter;
+}
+
 void CookieManager::DeleteCookiesAsync(const std::string& url,
                                                        const std::string& cookie_name)
 {
index c13ecaf9200441bdf29a31a77fbccbdf4e20a1bf..6f5a15586bbaec40118c6f92703700c4e005a26f 100644 (file)
@@ -32,8 +32,7 @@ class CookieManager : public base::RefCountedThreadSafe<CookieManager> {
                                    void *);
   typedef void (*AsyncHostnamesGetCb)(Eina_List*, _Ewk_Error*, void *);
 
-  explicit CookieManager(
-      content::URLRequestContextGetterEfl* request_context_getter);
+  CookieManager();
   // Delete all cookies that match the specified parameters. If both |url| and
   // values |cookie_name| are specified all host and domain cookies matching
   // both will be deleted. If only |url| is specified all host cookies (but not
@@ -87,7 +86,7 @@ class CookieManager : public base::RefCountedThreadSafe<CookieManager> {
   bool ShouldBlockThirdPartyCookies();
   //This is synchronous call
   std::string GetCookiesForURL(const std::string& url);
-
+  void SetRequestContextGetter(content::URLRequestContextGetterEfl* getter);
  private:
   struct EwkGetHostCallback;
 
index 69e30244e8b5a0351df881726138a2710cf6175a..4d9d9cfbc516418589e61a74570a6e0d5971ec41 100644 (file)
@@ -335,7 +335,7 @@ EwkDidStartDownloadCallback* EWebContext::DidStartDownloadCallback() {
 
 Ewk_Cookie_Manager* EWebContext::ewkCookieManager() {
   if (!ewk_cookie_manager_)
-    ewk_cookie_manager_.reset(Ewk_Cookie_Manager::create(browser_context_->GetRequestContextEfl()));
+    ewk_cookie_manager_.reset(Ewk_Cookie_Manager::create());
   return ewk_cookie_manager_.get();
 }
 
index 8164bfc7cd089134d1ee9472ea5e04880344343e..f09228254232bac88dcde7328748b770a13103fe 100644 (file)
@@ -76,6 +76,8 @@ URLRequestContextGetterEfl::URLRequestContextGetterEfl(
   // Must first be created on the UI thread.
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
+  cookie_manager_->SetRequestContextGetter(this);
+
   if (protocol_handlers)
     std::swap(protocol_handlers_, *protocol_handlers);