Title: [244431] trunk
Revision
244431
Author
[email protected]
Date
2019-04-18 12:16:49 -0700 (Thu, 18 Apr 2019)

Log Message

Unreviewed, rolling out r244299.

Breaks internal tests.

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/244299

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (244430 => 244431)


--- trunk/Source/WebKit/ChangeLog	2019-04-18 18:12:38 UTC (rev 244430)
+++ trunk/Source/WebKit/ChangeLog	2019-04-18 19:16:49 UTC (rev 244431)
@@ -1,3 +1,16 @@
+2019-04-18  Ryan Haddad  <[email protected]>
+
+        Unreviewed, rolling out r244299.
+
+        Breaks internal tests.
+
+        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/244299
+
 2019-04-18  Shawn Roberts  <[email protected]>
 
         Unreviewed manual rollout of r244248 and r244409

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h (244430 => 244431)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h	2019-04-18 18:12:38 UTC (rev 244430)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h	2019-04-18 19:16:49 UTC (rev 244431)
@@ -37,7 +37,6 @@
 - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController initializeWithObject:(id)initializationObject;
 - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController;
 - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController willDestroyBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController;
-- (NSArray *)additionalClassesForParameterCoder;
 @end
 
 WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h (244430 => 244431)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h	2019-04-18 18:12:38 UTC (rev 244430)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h	2019-04-18 19:16:49 UTC (rev 244431)
@@ -167,10 +167,6 @@
 private:
     explicit InjectedBundle(const WebProcessCreationParameters&);
 
-#if PLATFORM(COCOA)
-    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 (244430 => 244431)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm	2019-04-18 18:12:38 UTC (rev 244430)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm	2019-04-18 19:16:49 UTC (rev 244431)
@@ -73,28 +73,6 @@
 }
 #endif
 
-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]);
-}
-
 bool InjectedBundle::initialize(const WebProcessCreationParameters& parameters, API::Object* initializationUserData)
 {
     if (m_sandboxExtension) {
@@ -142,6 +120,23 @@
         }
     }
 
+    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]);
+    }
+    
 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
     // Swizzle [NSEvent modiferFlags], since it always returns 0 when the WindowServer is blocked.
     Method method = class_getClassMethod([NSEvent class], @selector(modifierFlags));
@@ -154,7 +149,6 @@
     // First check to see if the bundle has a WKBundleInitialize function.
     if (initializeFunction) {
         initializeFunction(toAPI(this), toAPI(initializationUserData));
-        decodeBundleParameters(parameters.bundleParameterData.get());
         return true;
     }
 
@@ -179,11 +173,6 @@
     WKWebProcessPlugInController* plugInController = WebKit::wrapper(*this);
     [plugInController _setPrincipalClassInstance:instance];
 
-    if ([instance respondsToSelector:@selector(additionalClassesForParameterCoder)])
-        [plugInController extendClassesForParameterCoder:[instance additionalClassesForParameterCoder]];
-
-    decodeBundleParameters(parameters.bundleParameterData.get());
-
     if ([instance respondsToSelector:@selector(webProcessPlugIn:initializeWithObject:)]) {
         RetainPtr<id> objCInitializationUserData;
         if (initializationUserData && initializationUserData->type() == API::Object::Type::ObjCObjectGraph)
@@ -266,7 +255,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);
     }
@@ -274,8 +263,6 @@
     if (!parameters)
         return;
 
-    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION([parameters isKindOfClass:[NSDictionary class]]);
-
     if (!m_bundleParameters) {
         m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:parameters]);
         return;

Modified: trunk/Tools/ChangeLog (244430 => 244431)


--- trunk/Tools/ChangeLog	2019-04-18 18:12:38 UTC (rev 244430)
+++ trunk/Tools/ChangeLog	2019-04-18 19:16:49 UTC (rev 244431)
@@ -1,3 +1,16 @@
+2019-04-18  Ryan Haddad  <[email protected]>
+
+        Unreviewed, rolling out r244299.
+
+        Breaks internal tests.
+
+        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/244299
+
 2019-04-18  Yusuke Suzuki  <[email protected]>
 
         [WTF] StringBuilder should set correct m_is8Bit flag when merging

Modified: trunk/Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm (244430 => 244431)


--- trunk/Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm	2019-04-18 18:12:38 UTC (rev 244430)
+++ trunk/Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm	2019-04-18 19:16:49 UTC (rev 244431)
@@ -36,11 +36,6 @@
     RetainPtr<id <WKWebProcessPlugIn>> _testPlugIn;
 }
 
-- (NSArray *)additionalClassesForParameterCoder
-{
-    return @[@"MockContentFilterEnabler"];
-}
-
 - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController initializeWithObject:(id)initializationObject
 {
     NSString *testPlugInClassName = [plugInController.parameters valueForKey:TestWebKitAPI::Util::TestPlugInClassNameParameter];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to