Title: [236304] trunk/Source/WebKit
Revision
236304
Author
[email protected]
Date
2018-09-20 20:47:37 -0700 (Thu, 20 Sep 2018)

Log Message

Unreviewed, rolling out r236289.

Caused 8 TestWebKitAPI.ContentFiltering test failures.

Reverted changeset:

"InjectedBundle parameters often need initialization function
called before unarchiving"
https://bugs.webkit.org/show_bug.cgi?id=189709
https://trac.webkit.org/changeset/236289

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (236303 => 236304)


--- trunk/Source/WebKit/ChangeLog	2018-09-21 03:15:36 UTC (rev 236303)
+++ trunk/Source/WebKit/ChangeLog	2018-09-21 03:47:37 UTC (rev 236304)
@@ -1,3 +1,16 @@
+2018-09-20  Ryan Haddad  <[email protected]>
+
+        Unreviewed, rolling out r236289.
+
+        Caused 8 TestWebKitAPI.ContentFiltering test failures.
+
+        Reverted changeset:
+
+        "InjectedBundle parameters often need initialization function
+        called before unarchiving"
+        https://bugs.webkit.org/show_bug.cgi?id=189709
+        https://trac.webkit.org/changeset/236289
+
 2018-09-20  Youenn Fablet  <[email protected]>
 
         Allow additional plug-ins to run unsandboxed

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h (236303 => 236304)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h	2018-09-21 03:15:36 UTC (rev 236303)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h	2018-09-21 03:47:37 UTC (rev 236304)
@@ -168,10 +168,6 @@
 private:
     explicit InjectedBundle(const WebProcessCreationParameters&);
 
-#if PLATFORM(COCOA) && WK_API_ENABLED
-    void decodeBundleParameters(API::Data*);
-#endif
-
     String m_path;
     PlatformBundle m_platformBundle; // This is leaked right now, since we never unload the bundle/module.
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm (236303 => 236304)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm	2018-09-21 03:15:36 UTC (rev 236303)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm	2018-09-21 03:47:37 UTC (rev 236304)
@@ -98,6 +98,25 @@
         }
     }
 
+#if WK_API_ENABLED
+    if (parameters.bundleParameterData) {
+        auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(parameters.bundleParameterData->bytes())) length:parameters.bundleParameterData->size() freeWhenDone:NO]);
+
+        auto unarchiver = secureUnarchiverFromData(bundleParameterData.get());
+
+        NSDictionary *dictionary = nil;
+        @try {
+            dictionary = [unarchiver.get() decodeObjectOfClass:[NSObject class] forKey:@"parameters"];
+            ASSERT([dictionary isKindOfClass:[NSDictionary class]]);
+        } @catch (NSException *exception) {
+            LOG_ERROR("Failed to decode bundle parameters: %@", exception);
+        }
+
+        ASSERT(!m_bundleParameters);
+        m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:dictionary]);
+    }
+#endif
+    
     if (!initializeFunction)
         initializeFunction = bitwise_cast<WKBundleInitializeFunctionPtr>(CFBundleGetFunctionPointerForName([m_platformBundle _cfBundle], CFSTR("WKBundleInitialize")));
 
@@ -104,15 +123,10 @@
     // First check to see if the bundle has a WKBundleInitialize function.
     if (initializeFunction) {
         initializeFunction(toAPI(this), toAPI(initializationUserData));
-#if WK_API_ENABLED
-        decodeBundleParameters(parameters.bundleParameterData.get());
-#endif
         return true;
     }
 
 #if WK_API_ENABLED
-    decodeBundleParameters(parameters.bundleParameterData.get());
-
     // Otherwise, look to see if the bundle has a principal class
     Class principalClass = [m_platformBundle principalClass];
     if (!principalClass) {
@@ -191,29 +205,6 @@
 
     return m_classesForCoder.get();
 }
-
-void InjectedBundle::decodeBundleParameters(API::Data* bundleParameterDataPtr)
-{
-    if (!bundleParameterDataPtr)
-        return;
-
-    auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(bundleParameterDataPtr->bytes())) length:bundleParameterDataPtr->size() freeWhenDone:NO]);
-    
-    auto unarchiver = secureUnarchiverFromData(bundleParameterData.get());
-    
-    NSDictionary *dictionary = nil;
-    @try {
-        dictionary = [unarchiver.get() decodeObjectOfClasses:classesForCoder() forKey:@"parameters"];
-        ASSERT([dictionary isKindOfClass:[NSDictionary class]]);
-    } @catch (NSException *exception) {
-        LOG_ERROR("Failed to decode bundle parameters: %@", exception);
-        return;
-    }
-    
-    ASSERT(!m_bundleParameters || m_bundleParameters.get());
-    m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:dictionary]);
-}
-
 #endif
 
 void InjectedBundle::setBundleParameter(const String& key, const IPC::DataReference& value)
@@ -247,7 +238,7 @@
 
     NSDictionary *parameters = nil;
     @try {
-        parameters = [unarchiver decodeObjectOfClasses:classesForCoder() forKey:@"parameters"];
+        parameters = [unarchiver decodeObjectOfClass:[NSDictionary class] forKey:@"parameters"];
     } @catch (NSException *exception) {
         LOG_ERROR("Failed to decode bundle parameter: %@", exception);
     }
@@ -255,8 +246,6 @@
     if (!parameters)
         return;
 
-    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION([parameters isKindOfClass:[NSDictionary class]]);
-
     if (!m_bundleParameters) {
         m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:parameters]);
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to