[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

andersca at apple.com andersca at apple.com
Wed Dec 22 18:20:55 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 15e0bb3db535d457044f2797cc29a882f51df702
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 10 01:54:17 2010 +0000

    Cannot use NSKeyedArchiver in WK2 for ResourceResponses
    https://bugs.webkit.org/show_bug.cgi?id=50792
    <rdar://problem/8741799>
    
    Reviewed by Sam Weinig.
    
    WebKit2:
    
    When encoding, first convert the requests and responses to the serializable dictionary representation
    and use the newly added CF CoreIPC encoders. When decoding, do the opposite.
    
    * Shared/mac/WebCoreArgumentCodersMac.mm:
    (CoreIPC::encodeResourceRequest):
    (CoreIPC::decodeResourceRequest):
    (CoreIPC::encodeResourceResponse):
    (CoreIPC::decodeResourceResponse):
    
    WebKitLibraries:
    
    * WebKitSystemInterface.h:
    * libWebKitSystemInterfaceLeopard.a:
    * libWebKitSystemInterfaceSnowLeopard.a:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73668 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index bc863da..c29c509 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -45,6 +45,23 @@
 
         Reviewed by Sam Weinig.
 
+        Cannot use NSKeyedArchiver in WK2 for ResourceResponses
+        https://bugs.webkit.org/show_bug.cgi?id=50792
+        <rdar://problem/8741799>
+
+        When encoding, first convert the requests and responses to the serializable dictionary representation
+        and use the newly added CF CoreIPC encoders. When decoding, do the opposite.
+
+        * Shared/mac/WebCoreArgumentCodersMac.mm:
+        (CoreIPC::encodeResourceRequest):
+        (CoreIPC::decodeResourceRequest):
+        (CoreIPC::encodeResourceResponse):
+        (CoreIPC::decodeResourceResponse):
+
+2010-12-09  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Add CoreIPC coders for CF types
         https://bugs.webkit.org/show_bug.cgi?id=50791
 
diff --git a/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
index 120dc34..8ffba8a 100644
--- a/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
+++ b/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
@@ -25,32 +25,24 @@
 
 #include "WebCoreArgumentCoders.h"
 
-namespace CoreIPC {
-
-static void encodeWithNSKeyedArchiver(ArgumentEncoder* encoder, id rootObject)
-{
-    NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rootObject];
-    encoder->encodeBytes(static_cast<const uint8_t*>([data bytes]), [data length]);
-}
+#include "ArgumentCodersCF.h"
+#include "WebKitSystemInterface.h"
 
-static id decodeWithNSKeyedArchiver(ArgumentDecoder* decoder)
-{
-    Vector<uint8_t> bytes;
-    if (!decoder->decodeBytes(bytes))
-        return nil;
-
-    RetainPtr<NSData> nsData(AdoptNS, [[NSData alloc] initWithBytesNoCopy:bytes.data() length:bytes.size() freeWhenDone:NO]);
-    return [NSKeyedUnarchiver unarchiveObjectWithData:nsData.get()];
-}
+namespace CoreIPC {
 
 void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
 {
-    encodeWithNSKeyedArchiver(encoder, resourceRequest.nsURLRequest());
+    RetainPtr<CFDictionaryRef> dictionary(AdoptCF, WKNSURLRequestCreateSerializableRepresentation(resourceRequest.nsURLRequest(), CoreIPC::tokenNullTypeRef()));
+    encode(encoder, dictionary.get());
 }
 
 bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
 {
-    NSURLRequest *nsURLRequest = decodeWithNSKeyedArchiver(decoder);
+    RetainPtr<CFDictionaryRef> dictionary;
+    if (!decode(decoder, dictionary))
+        return false;
+
+    NSURLRequest *nsURLRequest = WKNSURLRequestFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef());
     if (!nsURLRequest)
         return false;
 
@@ -62,24 +54,33 @@ void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceRes
 {
     bool responseIsPresent = resourceResponse.nsURLResponse();
     encoder->encode(responseIsPresent);
-    
-    // FIXME: <rdar://problem/8741799> - We can't use NSKeyedArchiver here.
-    encodeWithNSKeyedArchiver(encoder, resourceResponse.nsURLResponse());
+
+    if (!responseIsPresent)
+        return;
+
+    RetainPtr<CFDictionaryRef> dictionary(AdoptCF, WKNSURLResponseCreateSerializableRepresentation(resourceResponse.nsURLResponse(), CoreIPC::tokenNullTypeRef()));
+    encode(encoder, dictionary.get());
 }
 
 bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse)
 {
     bool responseIsPresent;
     decoder->decode(responseIsPresent);
-    
-    // FIXME: <rdar://problem/8741799> - We can't use NSKeyedArchiver here.
-    NSURLResponse *nsURLResponse = decodeWithNSKeyedArchiver(decoder);
-    if (responseIsPresent && !nsURLResponse)
+
+    if (!responseIsPresent) {
+        resourceResponse = WebCore::ResourceResponse();
+        return true;
+    }
+
+    RetainPtr<CFDictionaryRef> dictionary;
+    if (!decode(decoder, dictionary))
         return false;
 
-    if (responseIsPresent)
-        resourceResponse = WebCore::ResourceResponse(nsURLResponse);
+    NSURLResponse* nsURLResponse = WKNSURLResponseFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef());
+    if (!nsURLResponse)
+        return false;
 
+    resourceResponse = WebCore::ResourceResponse(nsURLResponse);
     return true;
 }
 
diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog
index e045333..fe0d79d 100644
--- a/WebKitLibraries/ChangeLog
+++ b/WebKitLibraries/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-09  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Cannot use NSKeyedArchiver in WK2 for ResourceResponses
+        https://bugs.webkit.org/show_bug.cgi?id=50792
+        <rdar://problem/8741799>
+
+        * WebKitSystemInterface.h:
+        * libWebKitSystemInterfaceLeopard.a:
+        * libWebKitSystemInterfaceSnowLeopard.a:
+
 2010-12-03  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKitLibraries/WebKitSystemInterface.h b/WebKitLibraries/WebKitSystemInterface.h
index 1989900..7030c60 100644
--- a/WebKitLibraries/WebKitSystemInterface.h
+++ b/WebKitLibraries/WebKitSystemInterface.h
@@ -330,6 +330,13 @@ void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScale
 void WKSyncSurfaceToView(NSView *view);
 
 void WKEnableSettingCursorWhenInBackground(void);
+
+CFDictionaryRef WKNSURLRequestCreateSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull);
+NSURLRequest *WKNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
+
+CFDictionaryRef WKNSURLResponseCreateSerializableRepresentation(NSURLResponse *response, CFTypeRef tokenNull);
+NSURLResponse *WKNSURLResponseFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
+    
 #endif
 
 #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
diff --git a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a
index 459ebe2..7efe2f9 100644
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ
diff --git a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a
index a136510..0875328 100644
Binary files a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a differ

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list