Changeset 236304 in webkit


Ignore:
Timestamp:
Sep 20, 2018 8:47:37 PM (6 years ago)
Author:
Ryan Haddad
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

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r236291 r236304  
     12018-09-20  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r236289.
     4
     5        Caused 8 TestWebKitAPI.ContentFiltering test failures.
     6
     7        Reverted changeset:
     8
     9        "InjectedBundle parameters often need initialization function
     10        called before unarchiving"
     11        https://bugs.webkit.org/show_bug.cgi?id=189709
     12        https://trac.webkit.org/changeset/236289
     13
    1142018-09-20  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h

    r236289 r236304  
    169169    explicit InjectedBundle(const WebProcessCreationParameters&);
    170170
    171 #if PLATFORM(COCOA) && WK_API_ENABLED
    172     void decodeBundleParameters(API::Data*);
    173 #endif
    174 
    175171    String m_path;
    176172    PlatformBundle m_platformBundle; // This is leaked right now, since we never unload the bundle/module.
  • trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm

    r236289 r236304  
    9999    }
    100100
     101#if WK_API_ENABLED
     102    if (parameters.bundleParameterData) {
     103        auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(parameters.bundleParameterData->bytes())) length:parameters.bundleParameterData->size() freeWhenDone:NO]);
     104
     105        auto unarchiver = secureUnarchiverFromData(bundleParameterData.get());
     106
     107        NSDictionary *dictionary = nil;
     108        @try {
     109            dictionary = [unarchiver.get() decodeObjectOfClass:[NSObject class] forKey:@"parameters"];
     110            ASSERT([dictionary isKindOfClass:[NSDictionary class]]);
     111        } @catch (NSException *exception) {
     112            LOG_ERROR("Failed to decode bundle parameters: %@", exception);
     113        }
     114
     115        ASSERT(!m_bundleParameters);
     116        m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:dictionary]);
     117    }
     118#endif
     119   
    101120    if (!initializeFunction)
    102121        initializeFunction = bitwise_cast<WKBundleInitializeFunctionPtr>(CFBundleGetFunctionPointerForName([m_platformBundle _cfBundle], CFSTR("WKBundleInitialize")));
     
    105124    if (initializeFunction) {
    106125        initializeFunction(toAPI(this), toAPI(initializationUserData));
    107 #if WK_API_ENABLED
    108         decodeBundleParameters(parameters.bundleParameterData.get());
    109 #endif
    110126        return true;
    111127    }
    112128
    113129#if WK_API_ENABLED
    114     decodeBundleParameters(parameters.bundleParameterData.get());
    115 
    116130    // Otherwise, look to see if the bundle has a principal class
    117131    Class principalClass = [m_platformBundle principalClass];
     
    192206    return m_classesForCoder.get();
    193207}
    194 
    195 void InjectedBundle::decodeBundleParameters(API::Data* bundleParameterDataPtr)
    196 {
    197     if (!bundleParameterDataPtr)
    198         return;
    199 
    200     auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(bundleParameterDataPtr->bytes())) length:bundleParameterDataPtr->size() freeWhenDone:NO]);
    201    
    202     auto unarchiver = secureUnarchiverFromData(bundleParameterData.get());
    203    
    204     NSDictionary *dictionary = nil;
    205     @try {
    206         dictionary = [unarchiver.get() decodeObjectOfClasses:classesForCoder() forKey:@"parameters"];
    207         ASSERT([dictionary isKindOfClass:[NSDictionary class]]);
    208     } @catch (NSException *exception) {
    209         LOG_ERROR("Failed to decode bundle parameters: %@", exception);
    210         return;
    211     }
    212    
    213     ASSERT(!m_bundleParameters || m_bundleParameters.get());
    214     m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:dictionary]);
    215 }
    216 
    217208#endif
    218209
     
    248239    NSDictionary *parameters = nil;
    249240    @try {
    250         parameters = [unarchiver decodeObjectOfClasses:classesForCoder() forKey:@"parameters"];
     241        parameters = [unarchiver decodeObjectOfClass:[NSDictionary class] forKey:@"parameters"];
    251242    } @catch (NSException *exception) {
    252243        LOG_ERROR("Failed to decode bundle parameter: %@", exception);
     
    255246    if (!parameters)
    256247        return;
    257 
    258     RELEASE_ASSERT_WITH_SECURITY_IMPLICATION([parameters isKindOfClass:[NSDictionary class]]);
    259248
    260249    if (!m_bundleParameters) {
Note: See TracChangeset for help on using the changeset viewer.