Changeset 244508 in webkit


Ignore:
Timestamp:
Apr 22, 2019 12:51:38 PM (5 years ago)
Author:
Ryan Haddad
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

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r244502 r244508  
     12019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r244437.
     4
     5        Still breaks internal tests.
     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/244437
     13
    1142019-04-22  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h

    r244437 r244508  
    11/*
    2  * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3838- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController;
    3939- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController willDestroyBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController;
    40 - (NSArray *)additionalClassesForParameterCoder;
    4140@end
    4241
  • trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h

    r244437 r244508  
    11/*
    2  * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    168168    explicit InjectedBundle(const WebProcessCreationParameters&);
    169169
    170 #if PLATFORM(COCOA)
    171     bool decodeBundleParameters(API::Data*);
    172 #endif
    173 
    174170    String m_path;
    175171    PlatformBundle m_platformBundle; // This is leaked right now, since we never unload the bundle/module.
  • trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm

    r244437 r244508  
    11/*
    2  * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7474#endif
    7575
    76 bool InjectedBundle::decodeBundleParameters(API::Data* bundleParameterDataPtr)
    77 {
    78     if (!bundleParameterDataPtr)
    79         return true;
    80 
    81     auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(bundleParameterDataPtr->bytes())) length:bundleParameterDataPtr->size() freeWhenDone:NO]);
    82    
    83     auto unarchiver = secureUnarchiverFromData(bundleParameterData.get());
    84    
    85     NSDictionary *dictionary = nil;
    86     @try {
    87         dictionary = [unarchiver.get() decodeObjectOfClasses:classesForCoder() forKey:@"parameters"];
    88         ASSERT([dictionary isKindOfClass:[NSDictionary class]]);
    89     } @catch (NSException *exception) {
    90         LOG_ERROR("Failed to decode bundle parameters: %@", exception);
    91         return false;
    92     }
    93    
    94     ASSERT(!m_bundleParameters || m_bundleParameters.get());
    95     m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:dictionary]);
    96     return true;
    97 }
    98 
    9976bool InjectedBundle::initialize(const WebProcessCreationParameters& parameters, API::Object* initializationUserData)
    10077{
     
    144121    }
    145122
    146     bool successfullyDecoded = decodeBundleParameters(parameters.bundleParameterData.get());
    147 
     123    if (parameters.bundleParameterData) {
     124        auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(parameters.bundleParameterData->bytes())) length:parameters.bundleParameterData->size() freeWhenDone:NO]);
     125
     126        auto unarchiver = secureUnarchiverFromData(bundleParameterData.get());
     127
     128        NSDictionary *dictionary = nil;
     129        @try {
     130            dictionary = [unarchiver.get() decodeObjectOfClass:[NSObject class] forKey:@"parameters"];
     131            ASSERT([dictionary isKindOfClass:[NSDictionary class]]);
     132        } @catch (NSException *exception) {
     133            LOG_ERROR("Failed to decode bundle parameters: %@", exception);
     134        }
     135
     136        ASSERT(!m_bundleParameters);
     137        m_bundleParameters = adoptNS([[WKWebProcessBundleParameters alloc] initWithDictionary:dictionary]);
     138    }
     139   
    148140#if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
    149141    // Swizzle [NSEvent modiferFlags], since it always returns 0 when the WindowServer is blocked.
     
    158150    if (initializeFunction) {
    159151        initializeFunction(toAPI(this), toAPI(initializationUserData));
    160         if (!successfullyDecoded)
    161             decodeBundleParameters(parameters.bundleParameterData.get());
    162152        return true;
    163153    }
     
    183173    WKWebProcessPlugInController* plugInController = WebKit::wrapper(*this);
    184174    [plugInController _setPrincipalClassInstance:instance];
    185 
    186     if ([instance respondsToSelector:@selector(additionalClassesForParameterCoder)]) {
    187         [plugInController extendClassesForParameterCoder:[instance additionalClassesForParameterCoder]];
    188         decodeBundleParameters(parameters.bundleParameterData.get());
    189     }
    190175
    191176    if ([instance respondsToSelector:@selector(webProcessPlugIn:initializeWithObject:)]) {
     
    271256    NSDictionary *parameters = nil;
    272257    @try {
    273         parameters = [unarchiver decodeObjectOfClasses:classesForCoder() forKey:@"parameters"];
     258        parameters = [unarchiver decodeObjectOfClass:[NSDictionary class] forKey:@"parameters"];
    274259    } @catch (NSException *exception) {
    275260        LOG_ERROR("Failed to decode bundle parameter: %@", exception);
     
    278263    if (!parameters)
    279264        return;
    280 
    281     RELEASE_ASSERT_WITH_SECURITY_IMPLICATION([parameters isKindOfClass:[NSDictionary class]]);
    282265
    283266    if (!m_bundleParameters) {
  • trunk/Tools/ChangeLog

    r244504 r244508  
     12019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r244437.
     4
     5        Still breaks internal tests.
     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/244437
     13
    1142019-04-22  Aakash Jain  <aakash_jain@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm

    r244437 r244508  
    3737}
    3838
    39 - (NSArray *)additionalClassesForParameterCoder
    40 {
    41     return @[@"MockContentFilterEnabler"];
    42 }
    43 
    4439- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController initializeWithObject:(id)initializationObject
    4540{
Note: See TracChangeset for help on using the changeset viewer.