Title: [190578] trunk
Revision
190578
Author
dba...@webkit.org
Date
2015-10-05 13:57:09 -0700 (Mon, 05 Oct 2015)

Log Message

DumpRenderTree built with public iOS SDK crashes under -[WebPreferences(WebPrivate) _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]
https://bugs.webkit.org/show_bug.cgi?id=149766

Reviewed by Alexey Proskuryakov.

Source/WebKit/mac:

Assert that we have a non-null pointer to a cookie storage.

* WebView/WebPreferences.mm:
(+[WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]):

Tools:

Create network storage testing session on iOS.

Currently we do not create a network storage testing session on iOS. A network storage testing session always
has an associated cookie store. When WebKit is built without USE(CFNETWORK), NetworkStorageSession::defaultStorageSession().cookieStorage()
returns nullptr because the caller is expected to interact with NSHTTPCookieStorage instead of querying
NetworkStorageSession for the cookie store. When WebKit is built with USE(CFNETWORK) accessing
NetworkStorageSession::defaultStorageSession().cookieStorage() returns a valid cookie store (creating one if
it does not exist). Instead we should make use of NetworkStorageSession::switchToNewTestingSession() to
create a network storage testing session when building DumpRenderTree for iOS so as to ensure a consistent
testing environment regardless of whether we built with USE(CFNETWORK). This will also make the behavior of
DumpRenderTree on iOS more consistent with the behavior of DumpRenderTree on Mac.

As a side effect of this change DumpRenderTree no longer crashes in -[WebPreferences(WebPrivate) _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]
when WebKit is built without USE(CFNETWORK) because NetworkStorageSession::defaultStorageSession().cookieStorage()
returns a non-null pointer to a cookie store.

* DumpRenderTree/mac/DumpRenderTree.mm:
(prepareConsistentTestingEnvironment):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (190577 => 190578)


--- trunk/Source/WebKit/mac/ChangeLog	2015-10-05 20:52:22 UTC (rev 190577)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-10-05 20:57:09 UTC (rev 190578)
@@ -1,3 +1,15 @@
+2015-10-05  Daniel Bates  <daba...@apple.com>
+
+        DumpRenderTree built with public iOS SDK crashes under -[WebPreferences(WebPrivate) _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]
+        https://bugs.webkit.org/show_bug.cgi?id=149766
+
+        Reviewed by Alexey Proskuryakov.
+
+        Assert that we have a non-null pointer to a cookie storage.
+
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]):
+
 2015-10-05  Andreas Kling  <akl...@apple.com>
 
         Remove unused HistoryItem::targetItem()

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (190577 => 190578)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2015-10-05 20:52:22 UTC (rev 190577)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2015-10-05 20:57:09 UTC (rev 190578)
@@ -1771,7 +1771,9 @@
 
 + (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
 {
-    WKSetHTTPCookieAcceptPolicy(NetworkStorageSession::defaultStorageSession().cookieStorage().get(), policy);
+    RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage();
+    ASSERT(cookieStorage); // Will fail when building without USE(CFNETWORK) and NetworkStorageSession::switchToNewTestingSession() was not called beforehand.
+    WKSetHTTPCookieAcceptPolicy(cookieStorage.get(), policy);
 }
 
 - (BOOL)isDOMPasteAllowed

Modified: trunk/Tools/ChangeLog (190577 => 190578)


--- trunk/Tools/ChangeLog	2015-10-05 20:52:22 UTC (rev 190577)
+++ trunk/Tools/ChangeLog	2015-10-05 20:57:09 UTC (rev 190578)
@@ -1,3 +1,29 @@
+2015-10-05  Daniel Bates  <daba...@apple.com>
+
+        DumpRenderTree built with public iOS SDK crashes under -[WebPreferences(WebPrivate) _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]
+        https://bugs.webkit.org/show_bug.cgi?id=149766
+
+        Reviewed by Alexey Proskuryakov.
+
+        Create network storage testing session on iOS.
+
+        Currently we do not create a network storage testing session on iOS. A network storage testing session always
+        has an associated cookie store. When WebKit is built without USE(CFNETWORK), NetworkStorageSession::defaultStorageSession().cookieStorage()
+        returns nullptr because the caller is expected to interact with NSHTTPCookieStorage instead of querying
+        NetworkStorageSession for the cookie store. When WebKit is built with USE(CFNETWORK) accessing
+        NetworkStorageSession::defaultStorageSession().cookieStorage() returns a valid cookie store (creating one if
+        it does not exist). Instead we should make use of NetworkStorageSession::switchToNewTestingSession() to
+        create a network storage testing session when building DumpRenderTree for iOS so as to ensure a consistent
+        testing environment regardless of whether we built with USE(CFNETWORK). This will also make the behavior of
+        DumpRenderTree on iOS more consistent with the behavior of DumpRenderTree on Mac.
+
+        As a side effect of this change DumpRenderTree no longer crashes in -[WebPreferences(WebPrivate) _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]
+        when WebKit is built without USE(CFNETWORK) because NetworkStorageSession::defaultStorageSession().cookieStorage()
+        returns a non-null pointer to a cookie store.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (prepareConsistentTestingEnvironment):
+
 2015-10-05  Simon Fraser  <simon.fra...@apple.com>
 
         Fix the iOS 8 build again, where -[UIApplication _enqueueHIDEvent:] is not

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (190577 => 190578)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2015-10-05 20:52:22 UTC (rev 190577)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2015-10-05 20:57:09 UTC (rev 190578)
@@ -1192,7 +1192,6 @@
 
     [[WebPreferences standardPreferences] setAutosaves:NO];
 
-#if !PLATFORM(IOS)
     // +[WebPreferences _switchNetworkLoaderToNewTestingSession] calls +[NSURLCache sharedURLCache], which initializes a default cache on disk.
     // Making the shared cache memory-only avoids touching the file system.
     RetainPtr<NSURLCache> sharedCache =
@@ -1203,6 +1202,7 @@
 
     [WebPreferences _switchNetworkLoaderToNewTestingSession];
 
+#if !PLATFORM(IOS)
     adjustFonts();
     registerMockScrollbars();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to