diff --git a/App/Browser View/BrowserViewController+WebKitDelegate.swift b/App/Browser View/BrowserViewController+WebKitDelegate.swift index f9c6843..fff3b03 100644 --- a/App/Browser View/BrowserViewController+WebKitDelegate.swift +++ b/App/Browser View/BrowserViewController+WebKitDelegate.swift @@ -91,7 +91,7 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate var allowJavaScript = tab.javaScriptEnabled if !allowJavaScript, let host = navigationAction.request.url?.host { // Check origin policy - allowJavaScript = policyManager.allowedOriginsForScriptResources().contains(host) + allowJavaScript = policyManager.scriptPolicy(forOrigin: host).allowsEmbeddedJavaScript() } preferences.allowsContentJavaScript = allowJavaScript diff --git a/App/Web Process Bundle Bridge/SBRProcessBundleBridge.m b/App/Web Process Bundle Bridge/SBRProcessBundleBridge.m index 98cf639..6475ea7 100644 --- a/App/Web Process Bundle Bridge/SBRProcessBundleBridge.m +++ b/App/Web Process Bundle Bridge/SBRProcessBundleBridge.m @@ -84,9 +84,11 @@ _processPool = [[WKProcessPool alloc] _initWithConfiguration:poolConfiguration]; // Initialize allowed origins now + NSDictionary *policies = [_policyDataSource scriptPolicyTypeByOrigin]; NSArray *allowedOrigins = [[_policyDataSource allowedOriginsForScriptResources] allObjects]; [_processPool _setObject:allowedOrigins forBundleParameter:SBRGetAllowedOriginsKey()]; [_processPool _setObject:@(_allowAllScripts) forBundleParameter:SBRGetAllScriptsAllowedKey()]; + [_processPool _setObject:policies forBundleParameter:SBRGetPolicyTypeByOriginKey()]; webViewConfiguration.processPool = _processPool; } diff --git a/App/Web Process Bundle Bridge/SBRScriptPolicy.h b/App/Web Process Bundle Bridge/SBRScriptPolicy.h index 8fbcb61..673f647 100644 --- a/App/Web Process Bundle Bridge/SBRScriptPolicy.h +++ b/App/Web Process Bundle Bridge/SBRScriptPolicy.h @@ -35,6 +35,12 @@ NS_SWIFT_NAME(ScriptPolicy) - (instancetype)initWithSecurityOrigin:(NSString *)origin policyType:(SBRScriptOriginPolicyType)policyType; +/// Returns YES if policy type allows embedded (