Title: [244508] trunk
Revision
244508
Author
ryanhad...@apple.com
Date
2019-04-22 12:51:38 -0700 (Mon, 22 Apr 2019)

Log Message

Unreviewed, rolling out r244437.

Still 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/244437

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (244507 => 244508)


--- trunk/Source/WebKit/ChangeLog	2019-04-22 18:41:16 UTC (rev 244507)
+++ trunk/Source/WebKit/ChangeLog	2019-04-22 19:51:38 UTC (rev 244508)
@@ -1,3 +1,16 @@
+2019-04-22  Ryan Haddad  <ryanhad...@apple.com>
+
+        Unreviewed, rolling out r244437.
+
+        Still 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/244437
+
 2019-04-22  Chris Dumez  <cdu...@apple.com>
 
         Delayed WebProcessLaunch may break the _relatedWebView SPI

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


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h	2019-04-22 18:41:16 UTC (rev 244507)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h	2019-04-22 19:51:38 UTC (rev 244508)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -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 (244507 => 244508)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h	2019-04-22 18:41:16 UTC (rev 244507)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h	2019-04-22 19:51:38 UTC (rev 244508)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -167,10 +167,6 @@
 private:
     explicit InjectedBundle(const WebProcessCreationParameters&);
 
-#if PLATFORM(COCOA)
-    bool 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 (244507 => 244508)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm	2019-04-22 18:41:16 UTC (rev 244507)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm	2019-04-22 19:51:38 UTC (rev 244508)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -73,29 +73,6 @@
 }
 #endif
 
-bool InjectedBundle::decodeBundleParameters(API::Data* bundleParameterDataPtr)
-{
-    if (!bundleParameterDataPtr)
-        return true;
-
-    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 false;
-    }
-    
-    ASSERT(!m_bundleParameters || m_bundleParameters.get());
-    m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:dictionary]);
-    return true;
-}
-
 bool InjectedBundle::initialize(const WebProcessCreationParameters& parameters, API::Object* initializationUserData)
 {
     if (m_sandboxExtension) {
@@ -143,8 +120,23 @@
         }
     }
 
-    bool successfullyDecoded = decodeBundleParameters(parameters.bundleParameterData.get());
+    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));
@@ -157,8 +149,6 @@
     // First check to see if the bundle has a WKBundleInitialize function.
     if (initializeFunction) {
         initializeFunction(toAPI(this), toAPI(initializationUserData));
-        if (!successfullyDecoded)
-            decodeBundleParameters(parameters.bundleParameterData.get());
         return true;
     }
 
@@ -183,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)
@@ -270,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);
     }
@@ -278,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 (244507 => 244508)


--- trunk/Tools/ChangeLog	2019-04-22 18:41:16 UTC (rev 244507)
+++ trunk/Tools/ChangeLog	2019-04-22 19:51:38 UTC (rev 244508)
@@ -1,3 +1,16 @@
+2019-04-22  Ryan Haddad  <ryanhad...@apple.com>
+
+        Unreviewed, rolling out r244437.
+
+        Still 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/244437
+
 2019-04-22  Aakash Jain  <aakash_j...@apple.com>
 
         [ews-build] Use singular verb in failure description in case of single api test failure

Modified: trunk/Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm (244507 => 244508)


--- trunk/Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm	2019-04-22 18:41:16 UTC (rev 244507)
+++ trunk/Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm	2019-04-22 19:51:38 UTC (rev 244508)
@@ -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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to