Changeset 261506 in webkit
- Timestamp:
- May 11, 2020 4:59:40 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r261501 r261506 1 2020-05-11 Kate Cheney <katherine_cheney@apple.com> 2 3 Fail navigations to non app-bound domains after use of app-bound APIs 4 https://bugs.webkit.org/show_bug.cgi?id=211647 5 <rdar://problem/62978159> 6 7 Reviewed by Brent Fulgham. 8 9 Simplified in-app browser privacy protections check into one, better 10 named function. 11 12 * bindings/js/ScriptController.cpp: 13 (WebCore::ScriptController::executeScriptInWorld): 14 * loader/FrameLoaderClient.h: 15 * page/Frame.cpp: 16 (WebCore::Frame::injectUserScriptImmediately): 17 * page/Page.cpp: 18 (WebCore::Page::injectUserStyleSheet): 19 * page/WebKitNamespace.cpp: 20 (WebCore::WebKitNamespace::messageHandlers): 21 * style/StyleScopeRuleSets.cpp: 22 (WebCore::Style::ScopeRuleSets::initializeUserStyle): 23 Rearranged ordering so the message to WebPageProxy only gets sent to 24 indicate app-bound behavior if user style sheets actually exist. 25 1 26 2020-05-11 Peng Liu <peng.liu6@apple.com> 2 27 -
trunk/Source/WebCore/bindings/js/ScriptController.cpp
r260848 r261506 580 580 ValueOrException ScriptController::executeScriptInWorld(DOMWrapperWorld& world, RunJavaScriptParameters&& parameters) 581 581 { 582 if (m_frame.loader().client(). hasNavigatedAwayFromAppBoundDomain() && !m_frame.loader().client().needsInAppBrowserPrivacyQuirks()) {582 if (m_frame.loader().client().shouldEnableInAppBrowserPrivacyProtections()) { 583 583 if (auto* document = m_frame.document()) 584 584 document->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Ignoring user script injection for non-app bound domain."); … … 586 586 return makeUnexpected(ExceptionDetails { "Ignoring user script injection for non-app bound domain"_s }); 587 587 } 588 m_frame.loader().client().notifyPageOfAppBoundBehavior(); 588 589 589 590 UserGestureIndicator gestureIndicator(parameters.forceUserGesture == ForceUserGesture::Yes ? Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt); -
trunk/Source/WebCore/loader/FrameLoaderClient.h
r260751 r261506 380 380 virtual AllowsContentJavaScript allowsContentJavaScriptFromMostRecentNavigation() const { return AllowsContentJavaScript::Yes; } 381 381 382 virtual bool hasNavigatedAwayFromAppBoundDomain(){ return false; }383 virtual bool needsInAppBrowserPrivacyQuirks() const { return false;}382 virtual bool shouldEnableInAppBrowserPrivacyProtections() const { return false; } 383 virtual void notifyPageOfAppBoundBehavior() { } 384 384 }; 385 385 -
trunk/Source/WebCore/page/Frame.cpp
r261336 r261506 652 652 void Frame::injectUserScriptImmediately(DOMWrapperWorld& world, const UserScript& script) 653 653 { 654 if (loader().client(). hasNavigatedAwayFromAppBoundDomain() && !loader().client().needsInAppBrowserPrivacyQuirks()) {654 if (loader().client().shouldEnableInAppBrowserPrivacyProtections()) { 655 655 if (auto* document = this->document()) 656 656 document->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Ignoring user script injection for non-app bound domain."_s); … … 658 658 return; 659 659 } 660 loader().client().notifyPageOfAppBoundBehavior(); 660 661 661 662 auto* document = this->document(); -
trunk/Source/WebCore/page/Page.cpp
r261336 r261506 3163 3163 void Page::injectUserStyleSheet(UserStyleSheet& userStyleSheet) 3164 3164 { 3165 if (m_mainFrame->loader().client(). hasNavigatedAwayFromAppBoundDomain()) {3165 if (m_mainFrame->loader().client().shouldEnableInAppBrowserPrivacyProtections()) { 3166 3166 if (auto* document = m_mainFrame->document()) 3167 3167 document->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Ignoring user style sheet for non-app bound domain."_s); 3168 3168 return; 3169 3169 } 3170 m_mainFrame->loader().client().notifyPageOfAppBoundBehavior(); 3170 3171 3171 3172 // We need to wait until we're no longer displaying the initial empty document before we can inject the stylesheets. -
trunk/Source/WebCore/page/WebKitNamespace.cpp
r259331 r261506 51 51 UserMessageHandlersNamespace* WebKitNamespace::messageHandlers() 52 52 { 53 if (frame() && frame()->loader().client().hasNavigatedAwayFromAppBoundDomain()) { 54 RELEASE_LOG_ERROR_IF_ALLOWED(Loading, "Ignoring messageHandlers() request for non app-bound domain"); 55 return nullptr; 53 if (frame()) { 54 if (frame()->loader().client().shouldEnableInAppBrowserPrivacyProtections()) { 55 RELEASE_LOG_ERROR_IF_ALLOWED(Loading, "Ignoring messageHandlers() request for non app-bound domain"); 56 return nullptr; 57 } 58 frame()->loader().client().notifyPageOfAppBoundBehavior(); 56 59 } 57 60 -
trunk/Source/WebCore/style/StyleScopeRuleSets.cpp
r259062 r261506 93 93 tempUserStyle->addRulesFromSheet(pageUserSheet->contents(), nullptr, mediaQueryEvaluator, m_styleResolver); 94 94 auto* page = m_styleResolver.document().page(); 95 if ( page && page->mainFrame().loader().client().hasNavigatedAwayFromAppBoundDomain() && !extensionStyleSheets.injectedUserStyleSheets().isEmpty())95 if (!extensionStyleSheets.injectedUserStyleSheets().isEmpty() && page && page->mainFrame().loader().client().shouldEnableInAppBrowserPrivacyProtections()) 96 96 m_styleResolver.document().addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Ignoring user style sheet for non-app bound domain."_s); 97 else 97 else { 98 98 collectRulesFromUserStyleSheets(extensionStyleSheets.injectedUserStyleSheets(), tempUserStyle.get(), mediaQueryEvaluator); 99 if (page && !extensionStyleSheets.injectedUserStyleSheets().isEmpty()) 100 page->mainFrame().loader().client().notifyPageOfAppBoundBehavior(); 101 } 99 102 collectRulesFromUserStyleSheets(extensionStyleSheets.documentUserStyleSheets(), tempUserStyle.get(), mediaQueryEvaluator); 100 103 if (tempUserStyle->ruleCount() > 0 || tempUserStyle->pageRules().size() > 0) -
trunk/Source/WebKit/ChangeLog
r261500 r261506 1 2020-05-11 Kate Cheney <katherine_cheney@apple.com> 2 3 Fail navigations to non app-bound domains after use of app-bound APIs 4 https://bugs.webkit.org/show_bug.cgi?id=211647 5 <rdar://problem/62978159> 6 7 Reviewed by Brent Fulgham. 8 9 A lot of this patch is deleting the unnecessary variable/function 10 hasNavigatedAwayFromAppBoundDomain now that navigating away from an 11 app-bound domain is not possible. 12 13 To address the bug, this sets the default isNavigatingToAppBoundDomain 14 value to be WTF::nullopt. This will allow app-bound behaviors until 15 a navigation has been attempted, in which case it will fail or will 16 update isNavigatingToAppBoundDomain to the correct value. 17 18 19 * Shared/LoadParameters.cpp: 20 (WebKit::LoadParameters::encode const): 21 (WebKit::LoadParameters::decode): 22 * Shared/LoadParameters.h: 23 * Shared/PolicyDecision.h: 24 (WebKit::PolicyDecision::encode const): 25 (WebKit::PolicyDecision::decode): 26 * UIProcess/ProvisionalPageProxy.cpp: 27 (WebKit::ProvisionalPageProxy::loadData): 28 (WebKit::ProvisionalPageProxy::loadRequest): 29 (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync): 30 * UIProcess/ProvisionalPageProxy.h: 31 * UIProcess/WebPageProxy.cpp: 32 (WebKit::WebPageProxy::loadRequest): 33 (WebKit::WebPageProxy::loadRequestWithNavigationShared): 34 (WebKit::WebPageProxy::loadData): 35 (WebKit::WebPageProxy::loadDataWithNavigationShared): 36 (WebKit::WebPageProxy::receivedPolicyDecision): 37 (WebKit::WebPageProxy::continueNavigationInNewProcess): 38 (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared): 39 (WebKit::WebPageProxy::hasNavigatedAwayFromAppBoundDomain const): Deleted. 40 Remove hasNavigatedAwayFromAppBoundDomain. 41 42 (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): 43 Check for new m_hasExecutedAppBoundBehaviorBeforeNavigation parameter 44 and fail the navigation if a WebView has used app-bound behavior then 45 tries to navigate to a non app-bound domain. 46 47 (WebKit::WebPageProxy::decidePolicyForNavigationAction): 48 Update error message to be more general now that more than one error 49 can occur. 50 51 * UIProcess/WebPageProxy.h: 52 (WebKit::WebPageProxy::setHasExecutedAppBoundBehaviorBeforeNavigation): 53 * UIProcess/WebPageProxy.messages.in: 54 New parameter to indicate a WebView has used app-bound APIs before 55 navigating. 56 57 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 58 (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): 59 (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 60 (WebKit::WebFrameLoaderClient::shouldEnableInAppBrowserPrivacyProtections): 61 (WebKit::WebFrameLoaderClient::hasNavigatedAwayFromAppBoundDomain): Deleted. 62 (WebKit::WebFrameLoaderClient::needsInAppBrowserPrivacyQuirks const): Deleted. 63 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 64 Combined two functions into a simpler function: 65 shouldEnableInAppBrowserPrivacyProtections(). 66 67 * WebProcess/WebPage/WebPage.cpp: 68 (WebKit::m_limitsNavigationsToAppBoundDomains): 69 (WebKit::WebPage::updatePreferences): 70 Store the special app-bound domain flag to gate the service worker 71 API. This should be stored separately from 72 m_isNavigatingToAppBoundDomain, because in the WebPage constructor we 73 don't yet know whether the WKAppBoundDomains key exists. 74 75 (WebKit::WebPage::loadRequest): 76 (WebKit::WebPage::loadDataImpl): 77 (WebKit::WebPage::loadData): 78 (WebKit::WebPage::loadAlternateHTML): 79 (WebKit::WebPage::didReceivePolicyDecision): 80 Remove hasNavigatedAwayFromAppBoundDomain. 81 82 (WebKit::WebPage::runJavaScript): 83 (WebKit::WebPage::setIsNavigatingToAppBoundDomain): 84 (WebKit::WebPage::shouldEnableInAppBrowserPrivacyProtections): 85 If m_needsInAppBrowserPrivacyQuirks are on for testing, don't enable 86 protections. Only notify the WebPageProxy of app-bound behavior if 87 a navigation has not occured and we know the webView is not app-bound 88 (in order to limit IPC). 89 90 (WebKit::m_isNavigatingToAppBoundDomain): Deleted. 91 * WebProcess/WebPage/WebPage.h: 92 (WebKit::WebPage::isNavigatingToAppBoundDomain const): 93 (WebKit::WebPage::setIsNavigatingToAppBoundDomain): Deleted. 94 (WebKit::WebPage::hasNavigatedAwayFromAppBoundDomain const): Deleted. 95 (WebKit::WebPage::setHasNavigatedAwayFromAppBoundDomain): Deleted. 96 (WebKit::WebPage::needsInAppBrowserPrivacyQuirks const): Deleted. 97 1 98 2020-05-11 Wenson Hsieh <wenson_hsieh@apple.com> 2 99 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
r261242 r261506 63 63 #else 64 64 #define NETWORK_SESSION_COCOA_ADDITIONS_1 65 #define NETWORK_SESSION_COCOA_ADDITIONS_2 true 65 66 #endif 66 67 … … 1261 1262 { 1262 1263 auto shouldBeConsideredAppBound = isNavigatingToAppBoundDomain ? *isNavigatingToAppBoundDomain : NavigatingToAppBoundDomain::Yes; 1264 if (NETWORK_SESSION_COCOA_ADDITIONS_2) 1265 shouldBeConsideredAppBound = NavigatingToAppBoundDomain::No; 1263 1266 #if ENABLE(RESOURCE_LOAD_STATISTICS) 1264 1267 if (auto* storageSession = networkStorageSession()) { -
trunk/Source/WebKit/Shared/LoadParameters.cpp
r257780 r261506 58 58 encoder << clientRedirectSourceForHistory; 59 59 encoder << isNavigatingToAppBoundDomain; 60 encoder << hasNavigatedAwayFromAppBoundDomain;61 60 62 61 platformEncode(encoder); … … 139 138 return false; 140 139 141 if (!decoder.decode(data.hasNavigatedAwayFromAppBoundDomain))142 return false;143 144 140 if (!platformDecode(decoder, data)) 145 141 return false; -
trunk/Source/WebKit/Shared/LoadParameters.h
r260031 r261506 71 71 WebCore::LockBackForwardList lockBackForwardList { WebCore::LockBackForwardList::No }; 72 72 String clientRedirectSourceForHistory; 73 Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain { NavigatingToAppBoundDomain::No }; 74 NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain { NavigatedAwayFromAppBoundDomain::No }; 73 Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain; 75 74 76 75 #if PLATFORM(COCOA) -
trunk/Source/WebKit/Shared/PolicyDecision.h
r260295 r261506 34 34 namespace WebKit { 35 35 36 enum class NavigatedAwayFromAppBoundDomain : bool { Yes, No};37 38 36 struct PolicyDecision { 39 37 WebCore::PolicyCheckIdentifier identifier { }; 40 Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain { NavigatingToAppBoundDomain::No }; 41 NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain { NavigatedAwayFromAppBoundDomain::No }; 38 Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain { WTF::nullopt }; 42 39 WebCore::PolicyAction policyAction { WebCore::PolicyAction::Ignore }; 43 40 uint64_t navigationID { 0 }; … … 51 48 encoder << identifier; 52 49 encoder << isNavigatingToAppBoundDomain; 53 encoder << hasNavigatedAwayFromAppBoundDomain;54 50 encoder << policyAction; 55 51 encoder << navigationID; … … 70 66 decoder >> decodedIsNavigatingToAppBoundDomain; 71 67 if (!decodedIsNavigatingToAppBoundDomain) 72 return WTF::nullopt;73 74 Optional<NavigatedAwayFromAppBoundDomain> decodedHasNavigatedAwayFromAppBoundDomain;75 decoder >> decodedHasNavigatedAwayFromAppBoundDomain;76 if (!decodedHasNavigatedAwayFromAppBoundDomain)77 68 return WTF::nullopt; 78 69 … … 102 93 return WTF::nullopt; 103 94 104 return {{ WTFMove(*decodedIdentifier), WTFMove(*decodedIsNavigatingToAppBoundDomain), WTFMove(*decoded HasNavigatedAwayFromAppBoundDomain), WTFMove(*decodedPolicyAction), WTFMove(*decodedNavigationID), WTFMove(*decodedDownloadID), WTFMove(*decodedWebsitePoliciesData), WTFMove(*sandboxExtensionHandle)}};95 return {{ WTFMove(*decodedIdentifier), WTFMove(*decodedIsNavigatingToAppBoundDomain), WTFMove(*decodedPolicyAction), WTFMove(*decodedNavigationID), WTFMove(*decodedDownloadID), WTFMove(*decodedWebsitePoliciesData), WTFMove(*sandboxExtensionHandle)}}; 105 96 } 106 97 }; -
trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
r261254 r261506 157 157 } 158 158 159 void ProvisionalPageProxy::loadData(API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain,Optional<WebsitePoliciesData>&& websitePolicies)159 void ProvisionalPageProxy::loadData(API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, Optional<WebsitePoliciesData>&& websitePolicies) 160 160 { 161 161 RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "loadData: pageProxyID=%" PRIu64 " webPageID=%" PRIu64, m_page.identifier().toUInt64(), m_webPageID.toUInt64()); 162 162 163 m_page.loadDataWithNavigationShared(m_process.copyRef(), m_webPageID, navigation, data, MIMEType, encoding, baseURL, userData, WebCore::ShouldTreatAsContinuingLoad::Yes, isNavigatingToAppBoundDomain, hasNavigatedAwayFromAppBoundDomain,WTFMove(websitePolicies), navigation.lastNavigationAction().shouldOpenExternalURLsPolicy);164 } 165 166 void ProvisionalPageProxy::loadRequest(API::Navigation& navigation, WebCore::ResourceRequest&& request, API::Object* userData, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain,Optional<WebsitePoliciesData>&& websitePolicies)163 m_page.loadDataWithNavigationShared(m_process.copyRef(), m_webPageID, navigation, data, MIMEType, encoding, baseURL, userData, WebCore::ShouldTreatAsContinuingLoad::Yes, isNavigatingToAppBoundDomain, WTFMove(websitePolicies), navigation.lastNavigationAction().shouldOpenExternalURLsPolicy); 164 } 165 166 void ProvisionalPageProxy::loadRequest(API::Navigation& navigation, WebCore::ResourceRequest&& request, API::Object* userData, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, Optional<WebsitePoliciesData>&& websitePolicies) 167 167 { 168 168 RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "loadRequest: pageProxyID=%" PRIu64 " webPageID=%" PRIu64, m_page.identifier().toUInt64(), m_webPageID.toUInt64()); … … 174 174 navigation.fromItem()->setLastProcessIdentifier(m_process->coreProcessIdentifier()); 175 175 176 m_page.loadRequestWithNavigationShared(m_process.copyRef(), m_webPageID, navigation, WTFMove(request), navigation.lastNavigationAction().shouldOpenExternalURLsPolicy, userData, WebCore::ShouldTreatAsContinuingLoad::Yes, isNavigatingToAppBoundDomain, hasNavigatedAwayFromAppBoundDomain,WTFMove(websitePolicies));176 m_page.loadRequestWithNavigationShared(m_process.copyRef(), m_webPageID, navigation, WTFMove(request), navigation.lastNavigationAction().shouldOpenExternalURLsPolicy, userData, WebCore::ShouldTreatAsContinuingLoad::Yes, isNavigatingToAppBoundDomain, WTFMove(websitePolicies)); 177 177 } 178 178 … … 358 358 { 359 359 if (!isMainFrame || (m_mainFrame && m_mainFrame->frameID() != frameID) || navigationID != m_navigationID) { 360 reply(PolicyDecision { identifier, NavigatingToAppBoundDomain::No, NavigatedAwayFromAppBoundDomain::No, WebCore::PolicyAction::Ignore, navigationID, DownloadID(), WTF::nullopt });360 reply(PolicyDecision { identifier, WTF::nullopt, WebCore::PolicyAction::Ignore, navigationID, DownloadID(), WTF::nullopt }); 361 361 return; 362 362 } -
trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h
r260295 r261506 93 93 #endif 94 94 95 void loadData(API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, Optional<NavigatingToAppBoundDomain>, NavigatedAwayFromAppBoundDomain,Optional<WebsitePoliciesData>&& = WTF::nullopt);96 void loadRequest(API::Navigation&, WebCore::ResourceRequest&&, API::Object* userData, Optional<NavigatingToAppBoundDomain>, NavigatedAwayFromAppBoundDomain,Optional<WebsitePoliciesData>&& = WTF::nullopt);95 void loadData(API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, Optional<NavigatingToAppBoundDomain>, Optional<WebsitePoliciesData>&& = WTF::nullopt); 96 void loadRequest(API::Navigation&, WebCore::ResourceRequest&&, API::Object* userData, Optional<NavigatingToAppBoundDomain>, Optional<WebsitePoliciesData>&& = WTF::nullopt); 97 97 void goToBackForwardItem(API::Navigation&, WebBackForwardListItem&, RefPtr<API::WebsitePolicies>&&); 98 98 void cancel(); -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r261489 r261506 1282 1282 navigation->setClientNavigationActivity(process().throttler().foregroundActivity("Client navigation"_s)); 1283 1283 1284 loadRequestWithNavigationShared(m_process.copyRef(), m_webPageID, navigation.get(), WTFMove(request), shouldOpenExternalURLsPolicy, userData, ShouldTreatAsContinuingLoad::No, isNavigatingToAppBoundDomain() , hasNavigatedAwayFromAppBoundDomain());1284 loadRequestWithNavigationShared(m_process.copyRef(), m_webPageID, navigation.get(), WTFMove(request), shouldOpenExternalURLsPolicy, userData, ShouldTreatAsContinuingLoad::No, isNavigatingToAppBoundDomain()); 1285 1285 return navigation; 1286 1286 } 1287 1287 1288 void WebPageProxy::loadRequestWithNavigationShared(Ref<WebProcessProxy>&& process, WebCore::PageIdentifier webPageID, API::Navigation& navigation, ResourceRequest&& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain,Optional<WebsitePoliciesData>&& websitePolicies)1288 void WebPageProxy::loadRequestWithNavigationShared(Ref<WebProcessProxy>&& process, WebCore::PageIdentifier webPageID, API::Navigation& navigation, ResourceRequest&& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, Optional<WebsitePoliciesData>&& websitePolicies) 1289 1289 { 1290 1290 ASSERT(!m_isClosed); … … 1309 1309 loadParameters.clientRedirectSourceForHistory = navigation.clientRedirectSourceForHistory(); 1310 1310 loadParameters.isNavigatingToAppBoundDomain = isNavigatingToAppBoundDomain; 1311 loadParameters.hasNavigatedAwayFromAppBoundDomain = hasNavigatedAwayFromAppBoundDomain;1312 1311 maybeInitializeSandboxExtensionHandle(process, url, m_pageLoadState.resourceDirectoryURL(), loadParameters.sandboxExtensionHandle); 1313 1312 … … 1406 1405 navigation->setClientNavigationActivity(process().throttler().foregroundActivity("Client navigation"_s)); 1407 1406 1408 loadDataWithNavigationShared(m_process.copyRef(), m_webPageID, navigation, data, MIMEType, encoding, baseURL, userData, ShouldTreatAsContinuingLoad::No, isNavigatingToAppBoundDomain(), hasNavigatedAwayFromAppBoundDomain(),WTF::nullopt, shouldOpenExternalURLsPolicy);1407 loadDataWithNavigationShared(m_process.copyRef(), m_webPageID, navigation, data, MIMEType, encoding, baseURL, userData, ShouldTreatAsContinuingLoad::No, isNavigatingToAppBoundDomain(), WTF::nullopt, shouldOpenExternalURLsPolicy); 1409 1408 return navigation; 1410 1409 } 1411 1410 1412 void WebPageProxy::loadDataWithNavigationShared(Ref<WebProcessProxy>&& process, WebCore::PageIdentifier webPageID, API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain,Optional<WebsitePoliciesData>&& websitePolicies, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)1411 void WebPageProxy::loadDataWithNavigationShared(Ref<WebProcessProxy>&& process, WebCore::PageIdentifier webPageID, API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, Optional<WebsitePoliciesData>&& websitePolicies, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy) 1413 1412 { 1414 1413 RELEASE_LOG_IF_ALLOWED(Loading, "loadDataWithNavigation"); … … 1431 1430 loadParameters.shouldOpenExternalURLsPolicy = shouldOpenExternalURLsPolicy; 1432 1431 loadParameters.isNavigatingToAppBoundDomain = isNavigatingToAppBoundDomain; 1433 loadParameters.hasNavigatedAwayFromAppBoundDomain = hasNavigatedAwayFromAppBoundDomain;1434 1432 addPlatformLoadParameters(loadParameters); 1435 1433 … … 3132 3130 m_isNavigatingToAppBoundDomain = NavigatingToAppBoundDomain::Yes; 3133 3131 } else { 3132 if (m_hasExecutedAppBoundBehaviorBeforeNavigation) 3133 return false; 3134 3134 m_configuration->setWebViewCategory(WebViewCategory::InAppBrowser); 3135 3135 m_isNavigatingToAppBoundDomain = NavigatingToAppBoundDomain::No; 3136 m_hasNavigatedAwayFromAppBoundDomain = NavigatedAwayFromAppBoundDomain::Yes;3137 3136 } 3138 3137 } … … 3276 3275 { 3277 3276 if (!hasRunningProcess()) { 3278 sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), hasNavigatedAwayFromAppBoundDomain(),PolicyAction::Ignore, 0, DownloadID(), WTF::nullopt });3277 sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), PolicyAction::Ignore, 0, DownloadID(), WTF::nullopt }); 3279 3278 return; 3280 3279 } … … 3303 3302 websitePoliciesData = websitePolicies->data(); 3304 3303 3305 sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), hasNavigatedAwayFromAppBoundDomain(),action, navigation ? navigation->navigationID() : 0, downloadID, WTFMove(websitePoliciesData), WTFMove(sandboxExtensionHandle) });3304 sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), action, navigation ? navigation->navigationID() : 0, downloadID, WTFMove(websitePoliciesData), WTFMove(sandboxExtensionHandle) }); 3306 3305 } 3307 3306 … … 3384 3383 ASSERT(!navigation->currentRequest().isEmpty()); 3385 3384 if (auto& substituteData = navigation->substituteData()) 3386 m_provisionalPage->loadData(navigation, { substituteData->content.data(), substituteData->content.size() }, substituteData->MIMEType, substituteData->encoding, substituteData->baseURL, substituteData->userData.get(), isNavigatingToAppBoundDomain(), hasNavigatedAwayFromAppBoundDomain(),WTFMove(websitePoliciesData));3385 m_provisionalPage->loadData(navigation, { substituteData->content.data(), substituteData->content.size() }, substituteData->MIMEType, substituteData->encoding, substituteData->baseURL, substituteData->userData.get(), isNavigatingToAppBoundDomain(), WTFMove(websitePoliciesData)); 3387 3386 else 3388 m_provisionalPage->loadRequest(navigation, ResourceRequest { navigation->currentRequest() }, nullptr, isNavigatingToAppBoundDomain(), hasNavigatedAwayFromAppBoundDomain(),WTFMove(websitePoliciesData));3387 m_provisionalPage->loadRequest(navigation, ResourceRequest { navigation->currentRequest() }, nullptr, isNavigatingToAppBoundDomain(), WTFMove(websitePoliciesData)); 3389 3388 }; 3390 3389 if (m_inspectorController->shouldPauseLoading(*m_provisionalPage)) … … 5108 5107 if (!checkURLReceivedFromCurrentOrPreviousWebProcess(process, request.url())) { 5109 5108 RELEASE_LOG_ERROR_IF_ALLOWED(Process, "Ignoring request to load this main resource because it is outside the sandbox"); 5110 sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), hasNavigatedAwayFromAppBoundDomain(),PolicyAction::Ignore, 0, DownloadID(), WTF::nullopt });5109 sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), PolicyAction::Ignore, 0, DownloadID(), WTF::nullopt }); 5111 5110 return; 5112 5111 } … … 5182 5181 if (policyAction != PolicyAction::Ignore) { 5183 5182 if (!setIsNavigatingToAppBoundDomainAndCheckIfPermitted(frame->isMainFrame(), navigation->currentRequest().url(), isAppBoundDomain)) { 5184 auto error = ResourceError { String { }, 0, navigation->currentRequest().url(), "A ttempted navigation away from app-bound domain"_s };5183 auto error = ResourceError { String { }, 0, navigation->currentRequest().url(), "App-bound domain failure"_s }; 5185 5184 m_navigationClient->didFailProvisionalNavigationWithError(*this, FrameInfoData { frameInfo }, navigation.get(), error, userDataObject); 5186 RELEASE_LOG_ERROR_IF_ALLOWED(Loading, "Ignoring request to load this main resource because it is attempting to navigate away from an app-bound domain ");5185 RELEASE_LOG_ERROR_IF_ALLOWED(Loading, "Ignoring request to load this main resource because it is attempting to navigate away from an app-bound domain or navigate after using restricted APIs"); 5187 5186 completionHandler(PolicyAction::Ignore); 5188 5187 return; … … 5356 5355 5357 5356 // If the client did not respond synchronously, proceed with the load. 5358 sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), hasNavigatedAwayFromAppBoundDomain(),PolicyAction::Use, navigationID, DownloadID(), WTF::nullopt });5357 sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), PolicyAction::Use, navigationID, DownloadID(), WTF::nullopt }); 5359 5358 } 5360 5359 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r261457 r261506 1651 1651 void decidePolicyForResponseShared(Ref<WebProcessProxy>&&, WebCore::PageIdentifier, WebCore::FrameIdentifier, FrameInfoData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, const String& downloadAttribute, uint64_t listenerID, const UserData&); 1652 1652 void startURLSchemeTaskShared(Ref<WebProcessProxy>&&, WebCore::PageIdentifier, URLSchemeTaskParameters&&); 1653 void loadDataWithNavigationShared(Ref<WebProcessProxy>&&, WebCore::PageIdentifier, API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<NavigatingToAppBoundDomain>, NavigatedAwayFromAppBoundDomain,Optional<WebsitePoliciesData>&& = WTF::nullopt, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow);1654 void loadRequestWithNavigationShared(Ref<WebProcessProxy>&&, WebCore::PageIdentifier, API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<NavigatingToAppBoundDomain>, NavigatedAwayFromAppBoundDomain,Optional<WebsitePoliciesData>&& = WTF::nullopt);1653 void loadDataWithNavigationShared(Ref<WebProcessProxy>&&, WebCore::PageIdentifier, API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<NavigatingToAppBoundDomain>, Optional<WebsitePoliciesData>&& = WTF::nullopt, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow); 1654 void loadRequestWithNavigationShared(Ref<WebProcessProxy>&&, WebCore::PageIdentifier, API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<NavigatingToAppBoundDomain>, Optional<WebsitePoliciesData>&& = WTF::nullopt); 1655 1655 void backForwardGoToItemShared(Ref<WebProcessProxy>&&, const WebCore::BackForwardItemIdentifier&, CompletionHandler<void(const WebBackForwardListCounts&)>&&); 1656 1656 void decidePolicyForNavigationActionSyncShared(Ref<WebProcessProxy>&&, WebCore::FrameIdentifier, bool isMainFrame, FrameInfoData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&, FrameInfoData&& originatingFrameInfo, Optional<WebPageProxyIdentifier> originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody, WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSyncDelayedReply&&); … … 1764 1764 #endif 1765 1765 1766 void setHasExecutedAppBoundBehaviorBeforeNavigation() { m_hasExecutedAppBoundBehaviorBeforeNavigation = true; } 1767 1766 1768 private: 1767 1769 WebPageProxy(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&); … … 2318 2320 2319 2321 bool setIsNavigatingToAppBoundDomainAndCheckIfPermitted(bool isMainFrame, const URL&, Optional<NavigatingToAppBoundDomain>); 2320 NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain() const { return m_hasNavigatedAwayFromAppBoundDomain; }2321 2322 2322 2323 const Identifier m_identifier; … … 2812 2813 #endif 2813 2814 2814 Optional<NavigatingToAppBoundDomain> m_isNavigatingToAppBoundDomain { NavigatingToAppBoundDomain::No }; 2815 NavigatedAwayFromAppBoundDomain m_hasNavigatedAwayFromAppBoundDomain { NavigatedAwayFromAppBoundDomain::No }; 2815 Optional<NavigatingToAppBoundDomain> m_isNavigatingToAppBoundDomain; 2816 2816 bool m_ignoresAppBoundDomains { false }; 2817 2817 bool m_userScriptsNotified { false }; 2818 2818 bool m_limitsNavigationsToAppBoundDomains { false }; 2819 bool m_hasExecutedAppBoundBehaviorBeforeNavigation { false }; 2819 2820 2820 2821 #if ENABLE(ROUTING_ARBITRATION) -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r261457 r261506 600 600 #endif 601 601 602 SetHasExecutedAppBoundBehaviorBeforeNavigation() 602 603 } -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r261323 r261506 831 831 if (!webPage->send(Messages::WebPageProxy::DecidePolicyForResponse(m_frame->frameID(), m_frame->info(), identifier, navigationID, response, request, canShowResponse, downloadAttribute, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())))) { 832 832 WEBFRAMELOADERCLIENT_RELEASE_LOG(Network, "dispatchDecidePolicyForResponse: ignoring because WebPageProxy::DecidePolicyForResponse failed"); 833 m_frame->didReceivePolicyDecision(listenerID, PolicyDecision { identifier, NavigatingToAppBoundDomain::No, NavigatedAwayFromAppBoundDomain::No, PolicyAction::Ignore, 0, { }, { } });833 m_frame->didReceivePolicyDecision(listenerID, PolicyDecision { identifier, WTF::nullopt, PolicyAction::Ignore, 0, { }, { } }); 834 834 } 835 835 } … … 993 993 994 994 if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationActionSync(m_frame->frameID(), m_frame->isMainFrame(), m_frame->info(), requestIdentifier, documentLoader->navigationID(), navigationActionData, originatingFrameInfoData, originatingPageID, navigationAction.resourceRequest(), request, IPC::FormDataReference { request.httpBody() }, redirectResponse, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForNavigationActionSync::Reply(policyDecision))) { 995 m_frame->didReceivePolicyDecision(listenerID, PolicyDecision { requestIdentifier, NavigatingToAppBoundDomain::No, NavigatedAwayFromAppBoundDomain::No, PolicyAction::Ignore, 0, { }, { } });995 m_frame->didReceivePolicyDecision(listenerID, PolicyDecision { requestIdentifier, WTF::nullopt, PolicyAction::Ignore, 0, { }, { } }); 996 996 return; 997 997 } 998 998 999 m_frame->didReceivePolicyDecision(listenerID, PolicyDecision { policyDecision.identifier, policyDecision.isNavigatingToAppBoundDomain, policyDecision. hasNavigatedAwayFromAppBoundDomain, policyDecision.policyAction, 0, policyDecision.downloadID, { }});999 m_frame->didReceivePolicyDecision(listenerID, PolicyDecision { policyDecision.identifier, policyDecision.isNavigatingToAppBoundDomain, policyDecision.policyAction, 0, policyDecision.downloadID, { }}); 1000 1000 return; 1001 1001 } … … 1003 1003 ASSERT(policyDecisionMode == PolicyDecisionMode::Asynchronous); 1004 1004 if (!webPage->send(Messages::WebPageProxy::DecidePolicyForNavigationActionAsync(m_frame->frameID(), m_frame->info(), requestIdentifier, documentLoader->navigationID(), navigationActionData, originatingFrameInfoData, originatingPageID, navigationAction.resourceRequest(), request, IPC::FormDataReference { request.httpBody() }, redirectResponse, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()), listenerID))) 1005 m_frame->didReceivePolicyDecision(listenerID, PolicyDecision { requestIdentifier, NavigatingToAppBoundDomain::No, NavigatedAwayFromAppBoundDomain::No, PolicyAction::Ignore, 0, { }, { } });1005 m_frame->didReceivePolicyDecision(listenerID, PolicyDecision { requestIdentifier, WTF::nullopt, PolicyAction::Ignore, 0, { }, { } }); 1006 1006 } 1007 1007 … … 1922 1922 #endif // ENABLE(APPLICATION_MANIFEST) 1923 1923 1924 bool WebFrameLoaderClient:: hasNavigatedAwayFromAppBoundDomain()1924 bool WebFrameLoaderClient::shouldEnableInAppBrowserPrivacyProtections() const 1925 1925 { 1926 1926 if (!m_frame->isMainFrame()) … … 1930 1930 if (!webPage) 1931 1931 return false; 1932 1933 return webPage->hasNavigatedAwayFromAppBoundDomain() == NavigatedAwayFromAppBoundDomain::Yes; 1934 } 1935 1936 bool WebFrameLoaderClient::needsInAppBrowserPrivacyQuirks() const 1937 { 1932 1933 return webPage->shouldEnableInAppBrowserPrivacyProtections(); 1934 } 1935 1936 void WebFrameLoaderClient::notifyPageOfAppBoundBehavior() 1937 { 1938 if (!m_frame->isMainFrame()) 1939 return; 1940 1938 1941 auto* webPage = m_frame->page(); 1939 1942 if (!webPage) 1940 return false; 1941 1942 return webPage->needsInAppBrowserPrivacyQuirks(); 1943 } 1944 1943 return; 1944 1945 webPage->notifyPageOfAppBoundBehavior(); 1946 } 1945 1947 1946 1948 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r260751 r261506 289 289 #endif 290 290 291 bool hasNavigatedAwayFromAppBoundDomain()final;292 bool needsInAppBrowserPrivacyQuirks() constfinal;291 bool shouldEnableInAppBrowserPrivacyProtections() const final; 292 void notifyPageOfAppBoundBehavior() final; 293 293 }; 294 294 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r261398 r261506 476 476 , m_overriddenMediaType(parameters.overriddenMediaType) 477 477 , m_processDisplayName(parameters.processDisplayName) 478 , m_ isNavigatingToAppBoundDomain(parameters.limitsNavigationsToAppBoundDomains ? NavigatingToAppBoundDomain::Yes : NavigatingToAppBoundDomain::No)478 , m_limitsNavigationsToAppBoundDomains(parameters.limitsNavigationsToAppBoundDomains) 479 479 { 480 480 ASSERT(m_identifier); … … 1528 1528 { 1529 1529 setIsNavigatingToAppBoundDomain(loadParameters.isNavigatingToAppBoundDomain); 1530 setHasNavigatedAwayFromAppBoundDomain(loadParameters.hasNavigatedAwayFromAppBoundDomain);1531 1530 1532 1531 SendStopResponsivenessTimer stopper; … … 1564 1563 } 1565 1564 1566 void WebPage::loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& websitePolicies, Ref<SharedBuffer>&& sharedBuffer, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& unreachableURL, const UserData& userData, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain,ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)1565 void WebPage::loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& websitePolicies, Ref<SharedBuffer>&& sharedBuffer, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& unreachableURL, const UserData& userData, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy) 1567 1566 { 1568 1567 setIsNavigatingToAppBoundDomain(isNavigatingToAppBoundDomain); 1569 setHasNavigatedAwayFromAppBoundDomain(hasNavigatedAwayFromAppBoundDomain);1570 1568 1571 1569 SendStopResponsivenessTimer stopper; … … 1596 1594 auto sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(loadParameters.data.data()), loadParameters.data.size()); 1597 1595 URL baseURL = loadParameters.baseURLString.isEmpty() ? aboutBlankURL() : URL(URL(), loadParameters.baseURLString); 1598 loadDataImpl(loadParameters.navigationID, loadParameters.shouldTreatAsContinuingLoad, WTFMove(loadParameters.websitePolicies), WTFMove(sharedBuffer), loadParameters.MIMEType, loadParameters.encodingName, baseURL, URL(), loadParameters.userData, loadParameters.isNavigatingToAppBoundDomain, loadParameters. hasNavigatedAwayFromAppBoundDomain, loadParameters.shouldOpenExternalURLsPolicy);1596 loadDataImpl(loadParameters.navigationID, loadParameters.shouldTreatAsContinuingLoad, WTFMove(loadParameters.websitePolicies), WTFMove(sharedBuffer), loadParameters.MIMEType, loadParameters.encodingName, baseURL, URL(), loadParameters.userData, loadParameters.isNavigatingToAppBoundDomain, loadParameters.shouldOpenExternalURLsPolicy); 1599 1597 } 1600 1598 … … 1608 1606 auto sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(loadParameters.data.data()), loadParameters.data.size()); 1609 1607 m_mainFrame->coreFrame()->loader().setProvisionalLoadErrorBeingHandledURL(provisionalLoadErrorURL); 1610 loadDataImpl(loadParameters.navigationID, loadParameters.shouldTreatAsContinuingLoad, WTFMove(loadParameters.websitePolicies), WTFMove(sharedBuffer), loadParameters.MIMEType, loadParameters.encodingName, baseURL, unreachableURL, loadParameters.userData, loadParameters.isNavigatingToAppBoundDomain , loadParameters.hasNavigatedAwayFromAppBoundDomain);1608 loadDataImpl(loadParameters.navigationID, loadParameters.shouldTreatAsContinuingLoad, WTFMove(loadParameters.websitePolicies), WTFMove(sharedBuffer), loadParameters.MIMEType, loadParameters.encodingName, baseURL, unreachableURL, loadParameters.userData, loadParameters.isNavigatingToAppBoundDomain); 1611 1609 m_mainFrame->coreFrame()->loader().setProvisionalLoadErrorBeingHandledURL({ }); 1612 1610 } … … 3254 3252 { 3255 3253 setIsNavigatingToAppBoundDomain(policyDecision.isNavigatingToAppBoundDomain); 3256 setHasNavigatedAwayFromAppBoundDomain(policyDecision.hasNavigatedAwayFromAppBoundDomain);3257 3254 3258 3255 WebFrame* frame = WebProcess::singleton().webFrame(frameID); … … 3427 3424 send(Messages::WebPageProxy::ScriptValueCallback(dataReference, details, callbackID)); 3428 3425 }; 3429 3430 if (hasNavigatedAwayFromAppBoundDomain() == NavigatedAwayFromAppBoundDomain::Yes && !m_needsInAppBrowserPrivacyQuirks) { 3426 if (shouldEnableInAppBrowserPrivacyProtections()) { 3431 3427 send(Messages::WebPageProxy::ScriptValueCallback({ }, ExceptionDetails { "Unable to execute JavaScript"_s }, callbackID)); 3432 3428 if (auto* document = m_page->mainFrame().document()) … … 3684 3680 3685 3681 if (store.getBoolValueForKey(WebPreferencesKey::serviceWorkersEnabledKey())) { 3686 ASSERT(parentProcessHasServiceWorkerEntitlement() || m_ isNavigatingToAppBoundDomain);3687 if (!parentProcessHasServiceWorkerEntitlement() && !m_ isNavigatingToAppBoundDomain)3682 ASSERT(parentProcessHasServiceWorkerEntitlement() || m_limitsNavigationsToAppBoundDomains); 3683 if (!parentProcessHasServiceWorkerEntitlement() && !m_limitsNavigationsToAppBoundDomains) 3688 3684 RuntimeEnabledFeatures::sharedFeatures().setServiceWorkerEnabled(false); 3689 3685 } … … 7103 7099 #endif 7104 7100 7101 void WebPage::setIsNavigatingToAppBoundDomain(Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain) 7102 { 7103 m_isNavigatingToAppBoundDomain = isNavigatingToAppBoundDomain; 7104 7105 m_navigationHasOccured = true; 7106 } 7107 7108 void WebPage::notifyPageOfAppBoundBehavior() 7109 { 7110 if (!m_navigationHasOccured && !m_limitsNavigationsToAppBoundDomains) 7111 send(Messages::WebPageProxy::SetHasExecutedAppBoundBehaviorBeforeNavigation()); 7112 } 7113 7114 bool WebPage::shouldEnableInAppBrowserPrivacyProtections() 7115 { 7116 if (m_needsInAppBrowserPrivacyQuirks) 7117 return false; 7118 7119 return isNavigatingToAppBoundDomain() && isNavigatingToAppBoundDomain() == NavigatingToAppBoundDomain::No; 7120 } 7121 7105 7122 } // namespace WebKit 7106 7123 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r261457 r261506 1316 1316 void getAllFrames(CompletionHandler<void(FrameTreeNodeData&&)>&&); 1317 1317 1318 void setIsNavigatingToAppBoundDomain(Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain) { m_isNavigatingToAppBoundDomain = isNavigatingToAppBoundDomain; } 1318 void notifyPageOfAppBoundBehavior(); 1319 bool shouldEnableInAppBrowserPrivacyProtections(); 1320 void setIsNavigatingToAppBoundDomain(Optional<NavigatingToAppBoundDomain>); 1319 1321 Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain() const { return m_isNavigatingToAppBoundDomain; } 1320 NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain() const { return m_hasNavigatedAwayFromAppBoundDomain; }1321 void setHasNavigatedAwayFromAppBoundDomain(NavigatedAwayFromAppBoundDomain navigatedAwayFromAppBoundDomain) { m_hasNavigatedAwayFromAppBoundDomain = navigatedAwayFromAppBoundDomain; }1322 bool needsInAppBrowserPrivacyQuirks() const { return m_needsInAppBrowserPrivacyQuirks; }1323 1322 1324 1323 bool shouldUseRemoteRenderingFor(WebCore::RenderingPurpose); … … 1420 1419 String sourceForFrame(WebFrame*); 1421 1420 1422 void loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&, Ref<WebCore::SharedBuffer>&&, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& failingURL, const UserData&, Optional<NavigatingToAppBoundDomain>, NavigatedAwayFromAppBoundDomain,WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow);1421 void loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&, Ref<WebCore::SharedBuffer>&&, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& failingURL, const UserData&, Optional<NavigatingToAppBoundDomain>, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow); 1423 1422 1424 1423 // Actions … … 2105 2104 #endif 2106 2105 2107 Optional<NavigatingToAppBoundDomain> m_isNavigatingToAppBoundDomain { NavigatingToAppBoundDomain::No }; 2108 NavigatedAwayFromAppBoundDomain m_hasNavigatedAwayFromAppBoundDomain { NavigatedAwayFromAppBoundDomain::No }; 2106 Optional<NavigatingToAppBoundDomain> m_isNavigatingToAppBoundDomain; 2107 bool m_limitsNavigationsToAppBoundDomains { false }; 2108 bool m_navigationHasOccured { false }; 2109 2109 }; 2110 2110 -
trunk/Tools/ChangeLog
r261496 r261506 1 2020-05-11 Kate Cheney <katherine_cheney@apple.com> 2 3 Fail navigations to non app-bound domains after use of app-bound APIs 4 https://bugs.webkit.org/show_bug.cgi?id=211647 5 <rdar://problem/62978159> 6 7 Reviewed by Brent Fulgham. 8 9 Added a new test to confirm a non-app bound navigation fails after 10 using script injection. 11 12 This fix also required changing any test which uses a restricted API 13 to confirm behavior of another restricted API. Tests can set 14 _setNeedsInAppBrowserPrivacyQuirks in the configuration to indicate 15 APIs should not be blocked, then toggle it to test actual behavior. 16 17 Also, we can remove any calls to _setInAppBrowserPrivacyEnabled 18 now that this is just an internal test flag. 19 20 * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm: 21 (-[AppBoundDomainDelegate webView:didFinishNavigation:]): 22 (-[AppBoundDomainDelegate webView:didFailProvisionalNavigation:withError:]): 23 (-[AppBoundDomainDelegate waitForDidFinishNavigation]): 24 (-[AppBoundDomainDelegate waitForDidFailProvisionalNavigationError]): 25 (TEST): 26 1 27 2020-05-11 Alex Christensen <achristensen@webkit.org> 2 28 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm
r260968 r261506 49 49 static bool isDone; 50 50 51 @interface AppBoundDomainDelegate : NSObject <WKNavigationDelegate> 52 - (void)waitForDidFinishNavigation; 53 - (NSError *)waitForDidFailProvisionalNavigationError; 54 @end 55 56 @implementation AppBoundDomainDelegate { 57 bool _navigationFinished; 58 RetainPtr<NSError> _provisionalNavigationFailedError; 59 } 60 61 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation 62 { 63 _navigationFinished = true; 64 } 65 66 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error 67 { 68 _provisionalNavigationFailedError = error; 69 } 70 71 - (void)waitForDidFinishNavigation 72 { 73 TestWebKitAPI::Util::run(&_navigationFinished); 74 } 75 76 - (NSError *)waitForDidFailProvisionalNavigationError 77 { 78 while (!_provisionalNavigationFailedError) 79 TestWebKitAPI::Util::spinRunLoop(); 80 return _provisionalNavigationFailedError.autorelease(); 81 } 82 83 @end 84 51 85 static NSString * const userScriptSource = @"window.wkUserScriptInjected = true"; 52 86 … … 104 138 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"in-app-browser"]; 105 139 [configuration.userContentController addUserScript:userScript.get()]; 106 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:NO];107 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES];108 140 109 141 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration]); … … 122 154 TestWebKitAPI::Util::run(&isDone); 123 155 124 // Turn back on In-App Browser Privacy quirks to check that original attempt to set this variable was rejected. 125 isDone = false; 156 // Disable script injection blocking to check that original attempt to set this variable was rejected. 126 157 [[[webView configuration] preferences] _setNeedsInAppBrowserPrivacyQuirks:YES]; 127 158 [webView evaluateJavaScript:@"window.wkUserScriptInjected" completionHandler:^(id _Nullable result, NSError * _Nullable error) { … … 146 177 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"in-app-browser"]; 147 178 [configuration.userContentController addUserScript:userScript.get()]; 148 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:NO];149 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES];150 179 151 180 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration]); … … 164 193 TestWebKitAPI::Util::run(&isDone); 165 194 166 // Turn back on In-App Browser Privacy quirks to check that original attempt to set this variable was rejected. 167 isDone = false; 195 // Disable script injection blocking to check that original attempt to set this variable was rejected. 168 196 [[[webView configuration] preferences] _setNeedsInAppBrowserPrivacyQuirks:YES]; 169 197 [webView evaluateJavaScript:@"window.wkUserScriptInjected" completionHandler:^(id _Nullable result, NSError * _Nullable error) { … … 180 208 TEST(InAppBrowserPrivacy, NonAppBoundDomainFailedUserAgentScripts) 181 209 { 210 initializeInAppBrowserPrivacyTestSettings(); 211 182 212 WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES]; 213 // Disable blocking of restricted APIs for test setup. 183 214 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:YES]; 184 [[configuration preferences] _setInAppBrowserPrivacyEnabled:NO];185 215 186 216 auto schemeHandler = adoptNS([[InAppBrowserSchemeHandler alloc] init]); … … 199 229 isDone = false; 200 230 TestWebKitAPI::Util::run(&isDone); 201 202 initializeInAppBrowserPrivacyTestSettings();231 232 // Enable blocking of restricted APIs. 203 233 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:NO]; 204 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES];205 234 206 235 auto webView2 = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration]); 207 208 236 isDone = false; 209 237 [webView2 loadRequest:request]; … … 245 273 initializeInAppBrowserPrivacyTestSettings(); 246 274 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 247 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES];248 275 [configuration setLimitsNavigationsToAppBoundDomains:YES]; 249 276 … … 266 293 initializeInAppBrowserPrivacyTestSettings(); 267 294 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 268 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES];269 295 [configuration setLimitsNavigationsToAppBoundDomains:YES]; 270 296 … … 286 312 initializeInAppBrowserPrivacyTestSettings(); 287 313 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 288 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES];289 314 [configuration setLimitsNavigationsToAppBoundDomains:YES]; 290 315 … … 304 329 static NSString *styleSheetSource = @"body { background-color: green !important; }"; 305 330 static NSString *backgroundColorScript = @"window.getComputedStyle(document.body, null).getPropertyValue('background-color')"; 306 static NSString *frameBackgroundColorScript = @"window.getComputedStyle(document.getElementsByTagName('iframe')[0].contentDocument.body, null).getPropertyValue('background-color')";307 331 static const char* redInRGB = "rgb(255, 0, 0)"; 308 332 static const char* blackInRGB = "rgba(0, 0, 0, 0)"; … … 330 354 auto schemeHandler = adoptNS([[InAppBrowserSchemeHandler alloc] init]); 331 355 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"in-app-browser"]; 332 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES]; 333 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:YES]; 356 RetainPtr<_WKUserContentWorld> world = [_WKUserContentWorld worldWithName:@"TestWorld"]; 334 357 335 358 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]); 336 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"in-app-browser:///in-app-browser-privacy-test-user-style-sheets"]];337 [webView loadRequest:request];338 [webView _test_waitForDidFinishNavigation];339 340 RetainPtr<_WKUserContentWorld> world = [_WKUserContentWorld worldWithName:@"TestWorld"];341 359 RetainPtr<_WKUserStyleSheet> styleSheet = adoptNS([[_WKUserStyleSheet alloc] initWithSource:styleSheetSource forWKWebView:webView.get() forMainFrameOnly:YES level:_WKUserStyleUserLevel userContentWorld:world.get()]); 342 360 [[configuration userContentController] _addUserStyleSheet:styleSheet.get()]; 343 361 344 expectScriptEvaluatesToColor(webView.get(), backgroundColorScript, redInRGB); 362 auto delegate = adoptNS([AppBoundDomainDelegate new]); 363 [webView setNavigationDelegate:delegate.get()]; 364 365 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"in-app-browser:///in-app-browser-privacy-test-user-style-sheets"]]; 366 [webView loadRequest:request]; 367 NSError *error = [delegate waitForDidFailProvisionalNavigationError]; 368 EXPECT_WK_STREQ(error.localizedDescription, @"App-bound domain failure"); 345 369 cleanUpInAppBrowserPrivacyTestSettings(); 346 370 } … … 354 378 auto schemeHandler = adoptNS([[InAppBrowserSchemeHandler alloc] init]); 355 379 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"in-app-browser"]; 356 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES]; 357 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:YES]; 358 359 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]); 360 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"in-app-browser:///in-app-browser-privacy-test-user-style-sheets"]]; 361 [webView loadRequest:request]; 362 [webView _test_waitForDidFinishNavigation]; 363 380 364 381 RetainPtr<_WKUserStyleSheet> styleSheet = adoptNS([[_WKUserStyleSheet alloc] initWithSource:styleSheetSource forMainFrameOnly:YES]); 365 382 [[configuration userContentController] _addUserStyleSheet:styleSheet.get()]; 366 367 expectScriptEvaluatesToColor(webView.get(), backgroundColorScript, redInRGB); 383 384 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]); 385 auto delegate = adoptNS([AppBoundDomainDelegate new]); 386 [webView setNavigationDelegate:delegate.get()]; 387 388 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"in-app-browser:///in-app-browser-privacy-test-user-style-sheets"]]; 389 [webView loadRequest:request]; 390 NSError *error = [delegate waitForDidFailProvisionalNavigationError]; 391 EXPECT_WK_STREQ(error.localizedDescription, @"App-bound domain failure"); 368 392 cleanUpInAppBrowserPrivacyTestSettings(); 369 393 } … … 377 401 auto schemeHandler = adoptNS([[InAppBrowserSchemeHandler alloc] init]); 378 402 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"in-app-browser"]; 379 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES];380 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:YES];381 382 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);383 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"in-app-browser:///in-app-browser-privacy-test-user-style-sheets-iframe"]];384 [webView loadRequest:request];385 [webView _test_waitForDidFinishNavigation];386 387 403 RetainPtr<_WKUserStyleSheet> styleSheet = adoptNS([[_WKUserStyleSheet alloc] initWithSource:styleSheetSource forMainFrameOnly:NO]); 388 404 [[configuration userContentController] _addUserStyleSheet:styleSheet.get()]; 389 405 390 // The main frame should be affected. 391 expectScriptEvaluatesToColor(webView.get(), backgroundColorScript, redInRGB); 392 393 // The subframe should also be affected. 394 expectScriptEvaluatesToColor(webView.get(), frameBackgroundColorScript, redInRGB); 406 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]); 407 auto delegate = adoptNS([AppBoundDomainDelegate new]); 408 [webView setNavigationDelegate:delegate.get()]; 409 410 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"in-app-browser:///in-app-browser-privacy-test-user-style-sheets-iframe"]]; 411 [webView loadRequest:request]; 412 NSError *error = [delegate waitForDidFailProvisionalNavigationError]; 413 EXPECT_WK_STREQ(error.localizedDescription, @"App-bound domain failure"); 395 414 cleanUpInAppBrowserPrivacyTestSettings(); 396 415 } … … 405 424 auto schemeHandler = adoptNS([[InAppBrowserSchemeHandler alloc] init]); 406 425 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"in-app-browser"]; 407 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES];408 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:YES];409 426 410 427 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]); … … 417 434 [webView loadRequest:request]; 418 435 [webView _test_waitForDidFinishNavigation]; 436 437 // Disable script injection blocking to check that the request for message 438 // handlers returned null. 439 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:YES]; 419 440 420 441 // Set the background color to red if message handlers returned null so we can … … 433 454 auto schemeHandler = adoptNS([[InAppBrowserSchemeHandler alloc] init]); 434 455 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"in-app-browser"]; 435 [[configuration preferences] _setInAppBrowserPrivacyEnabled:YES];436 456 [configuration setLimitsNavigationsToAppBoundDomains:YES]; 437 457 … … 834 854 } 835 855 836 @interface AppBoundDomainDelegate : NSObject <WKNavigationDelegate>837 - (void)waitForDidFinishNavigation;838 - (NSError *)waitForDidFailProvisionalNavigationError;839 @end840 841 @implementation AppBoundDomainDelegate {842 bool _navigationFinished;843 RetainPtr<NSError> _provisionalNavigationFailedError;844 }845 846 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation847 {848 _navigationFinished = true;849 }850 851 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error852 {853 _provisionalNavigationFailedError = error;854 }855 856 - (void)waitForDidFinishNavigation857 {858 TestWebKitAPI::Util::run(&_navigationFinished);859 }860 861 - (NSError *)waitForDidFailProvisionalNavigationError862 {863 while (!_provisionalNavigationFailedError)864 TestWebKitAPI::Util::spinRunLoop();865 return _provisionalNavigationFailedError.autorelease();866 }867 868 @end869 870 856 TEST(InAppBrowserPrivacy, AppBoundFlagForNonAppBoundDomainFails) 871 857 { … … 886 872 [webView loadRequest:request]; 887 873 NSError *error = [delegate waitForDidFailProvisionalNavigationError]; 888 EXPECT_WK_STREQ(error.localizedDescription, @"A ttempted navigation away from app-bound domain");874 EXPECT_WK_STREQ(error.localizedDescription, @"App-bound domain failure"); 889 875 890 876 // Make sure the load didn't complete by checking the background color. … … 917 903 [webView loadRequest:request]; 918 904 NSError *error = [delegate waitForDidFailProvisionalNavigationError]; 919 EXPECT_WK_STREQ(error.localizedDescription, @"A ttempted navigation away from app-bound domain");905 EXPECT_WK_STREQ(error.localizedDescription, @"App-bound domain failure"); 920 906 921 907 // Make sure the load didn't complete by checking the background color. … … 992 978 993 979 // Navigation should be successful, but this WebView should not get app-bound domain 994 // privileges like user style sheets. Set quirks to true so we can evaluate script 995 // to check. 996 [[[webView configuration] preferences] _setNeedsInAppBrowserPrivacyQuirks:YES]; 997 expectScriptEvaluatesToColor(webView.get(), backgroundColorScript, blackInRGB); 998 cleanUpInAppBrowserPrivacyTestSettings(); 980 // privileges like script injection. 981 isDone = false; 982 [webView evaluateJavaScript:@"window.wkUserScriptInjected" completionHandler:^(id _Nullable result, NSError * _Nullable error) { 983 EXPECT_TRUE(!!error); 984 isDone = true; 985 }]; 986 987 TestWebKitAPI::Util::run(&isDone); 999 988 } 1000 989 … … 1030 1019 [webView loadRequest:request]; 1031 1020 NSError *error = [delegate waitForDidFailProvisionalNavigationError]; 1032 EXPECT_WK_STREQ(error.localizedDescription, @"A ttempted navigation away from app-bound domain");1021 EXPECT_WK_STREQ(error.localizedDescription, @"App-bound domain failure"); 1033 1022 1034 1023 cleanUpInAppBrowserPrivacyTestSettings(); 1024 } 1025 1026 TEST(InAppBrowserPrivacy, InjectScriptThenNavigateToNonAppBoundDomainFails) 1027 { 1028 isDone = false; 1029 initializeInAppBrowserPrivacyTestSettings(); 1030 auto userScript = adoptNS([[WKUserScript alloc] initWithSource:userScriptSource injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES]); 1031 1032 WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES]; 1033 auto schemeHandler = adoptNS([[InAppBrowserSchemeHandler alloc] init]); 1034 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"in-app-browser"]; 1035 [configuration.userContentController addUserScript:userScript.get()]; 1036 [[configuration preferences] _setNeedsInAppBrowserPrivacyQuirks:NO]; 1037 1038 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration]); 1039 auto delegate = adoptNS([AppBoundDomainDelegate new]); 1040 [webView setNavigationDelegate:delegate.get()]; 1041 1042 isDone = false; 1043 [webView evaluateJavaScript:@"window.wkUserScriptInjected" completionHandler:^(id _Nullable result, NSError * _Nullable error) { 1044 EXPECT_FALSE(!!error); 1045 isDone = true; 1046 }]; 1047 1048 TestWebKitAPI::Util::run(&isDone); 1049 1050 // Load a non-app bound domain. 1051 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"in-app-browser:///in-app-browser-privacy-test-user-agent-script"]]; 1052 [webView loadRequest:request]; 1053 NSError *error = [delegate waitForDidFailProvisionalNavigationError]; 1054 EXPECT_WK_STREQ(error.localizedDescription, @"App-bound domain failure"); 1035 1055 } 1036 1056
Note: See TracChangeset
for help on using the changeset viewer.