Script origins control inline policy, all scripts allowed for tab

This commit is contained in:
James Magahern
2020-07-29 17:46:53 -07:00
parent f330293606
commit 32cdcf71f7
14 changed files with 301 additions and 57 deletions

View File

@@ -37,6 +37,12 @@
// Set up process pool
WKProcessPool *processPool = [[WKProcessPool alloc] _initWithConfiguration:poolConfiguration];
// Initialize allowed origins now
NSArray<NSString *> *allowedOrigins = [[_policyDataSource allowedOriginsForScriptResources] allObjects];
[processPool _setObject:allowedOrigins forBundleParameter:SBRGetAllowedOriginsKey()];
[processPool _setObject:@(_allowAllScripts) forBundleParameter:SBRGetAllScriptsAllowedKey()];
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
configuration.processPool = processPool;
@@ -79,4 +85,9 @@
[_webProcessProxy syncAllowedResourceOrigins:allowedOrigins];
}
- (void)setAllowAllScripts:(BOOL)allowAllScripts
{
[_webProcessProxy setAllScriptsAllowed:allowAllScripts];
}
@end