Changeset 244508 in webkit
- Timestamp:
- Apr 22, 2019 12:51:38 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r244502 r244508 1 2019-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 1 14 2019-04-22 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h
r244437 r244508 1 1 /* 2 * Copyright (C) 2012 -2019Apple Inc. All rights reserved.2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 38 38 - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController; 39 39 - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController willDestroyBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController; 40 - (NSArray *)additionalClassesForParameterCoder;41 40 @end 42 41 -
trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h
r244437 r244508 1 1 /* 2 * Copyright (C) 2010-201 9Apple Inc. All rights reserved.2 * Copyright (C) 2010-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 168 168 explicit InjectedBundle(const WebProcessCreationParameters&); 169 169 170 #if PLATFORM(COCOA)171 bool decodeBundleParameters(API::Data*);172 #endif173 174 170 String m_path; 175 171 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 1 1 /* 2 * Copyright (C) 2010-201 9Apple Inc. All rights reserved.2 * Copyright (C) 2010-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 74 74 #endif 75 75 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 99 76 bool InjectedBundle::initialize(const WebProcessCreationParameters& parameters, API::Object* initializationUserData) 100 77 { … … 144 121 } 145 122 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 148 140 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 149 141 // Swizzle [NSEvent modiferFlags], since it always returns 0 when the WindowServer is blocked. … … 158 150 if (initializeFunction) { 159 151 initializeFunction(toAPI(this), toAPI(initializationUserData)); 160 if (!successfullyDecoded)161 decodeBundleParameters(parameters.bundleParameterData.get());162 152 return true; 163 153 } … … 183 173 WKWebProcessPlugInController* plugInController = WebKit::wrapper(*this); 184 174 [plugInController _setPrincipalClassInstance:instance]; 185 186 if ([instance respondsToSelector:@selector(additionalClassesForParameterCoder)]) {187 [plugInController extendClassesForParameterCoder:[instance additionalClassesForParameterCoder]];188 decodeBundleParameters(parameters.bundleParameterData.get());189 }190 175 191 176 if ([instance respondsToSelector:@selector(webProcessPlugIn:initializeWithObject:)]) { … … 271 256 NSDictionary *parameters = nil; 272 257 @try { 273 parameters = [unarchiver decodeObjectOfClass es:classesForCoder()forKey:@"parameters"];258 parameters = [unarchiver decodeObjectOfClass:[NSDictionary class] forKey:@"parameters"]; 274 259 } @catch (NSException *exception) { 275 260 LOG_ERROR("Failed to decode bundle parameter: %@", exception); … … 278 263 if (!parameters) 279 264 return; 280 281 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION([parameters isKindOfClass:[NSDictionary class]]);282 265 283 266 if (!m_bundleParameters) { -
trunk/Tools/ChangeLog
r244504 r244508 1 2019-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 1 14 2019-04-22 Aakash Jain <aakash_jain@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm
r244437 r244508 37 37 } 38 38 39 - (NSArray *)additionalClassesForParameterCoder40 {41 return @[@"MockContentFilterEnabler"];42 }43 44 39 - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController initializeWithObject:(id)initializationObject 45 40 {
Note: See TracChangeset
for help on using the changeset viewer.