Loading netwerk/ipc/DocumentLoadListener.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -909,7 +909,9 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState, if (documentContext && aLoadState->LoadType() != LOAD_ERROR_PAGE && !(aLoadState->HasInternalLoadFlags( nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE)) && !(aLoadState->LoadType() & LOAD_HISTORY)) { !(aLoadState->LoadType() & LOAD_HISTORY) && !nsExternalHelperAppService::ExternalProtocolIsBlockedBySandbox( documentContext, aLoadState->HasValidUserGestureActivation())) { nsCOMPtr<nsIWidget> widget = documentContext->GetParentProcessWidgetContaining(); RefPtr<nsWindow> window = nsWindow::From(widget); Loading Loading @@ -3091,7 +3093,8 @@ DocumentLoadListener::AsyncOnChannelRedirect( bc ? bc->GetParentProcessWidgetContaining() : nullptr; RefPtr<nsWindow> window = nsWindow::From(widget); if (window) { if (window && !nsExternalHelperAppService::ExternalProtocolIsBlockedBySandbox( bc, false)) { promise = window->OnLoadRequest(uriBeingLoaded, nsIBrowserDOMWindow::OPEN_CURRENTWINDOW, nsIWebNavigation::LOAD_FLAGS_IS_REDIRECT, Loading uriloader/exthandler/nsExternalHelperAppService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -967,7 +967,7 @@ nsresult nsExternalHelperAppService::EscapeURI(nsIURI* aURI, nsIURI** aResult) { return ios->NewURI(escapedSpec, nullptr, nullptr, aResult); } bool ExternalProtocolIsBlockedBySandbox( bool nsExternalHelperAppService::ExternalProtocolIsBlockedBySandbox( BrowsingContext* aBrowsingContext, const bool aHasValidUserGestureActivation) { if (!StaticPrefs::dom_block_external_protocol_navigation_from_sandbox()) { Loading uriloader/exthandler/nsExternalHelperAppService.h +8 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,14 @@ class nsExternalHelperAppService : public nsIExternalHelperAppService, // Internal method. Only called directly from tests. static nsresult EscapeURI(nsIURI* aURI, nsIURI** aResult); /** * Check whether `aBrowsingContext` is sandboxed such that external * protocol navigations performed in that context would be blocked. */ static bool ExternalProtocolIsBlockedBySandbox( mozilla::dom::BrowsingContext* aBrowsingContext, const bool aHasValidUserGestureActivation); /** * Logging Module. Usage: set MOZ_LOG=HelperAppService:level, where level * should be 2 for errors, 3 for debug messages from the cross- platform Loading Loading
netwerk/ipc/DocumentLoadListener.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -909,7 +909,9 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState, if (documentContext && aLoadState->LoadType() != LOAD_ERROR_PAGE && !(aLoadState->HasInternalLoadFlags( nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE)) && !(aLoadState->LoadType() & LOAD_HISTORY)) { !(aLoadState->LoadType() & LOAD_HISTORY) && !nsExternalHelperAppService::ExternalProtocolIsBlockedBySandbox( documentContext, aLoadState->HasValidUserGestureActivation())) { nsCOMPtr<nsIWidget> widget = documentContext->GetParentProcessWidgetContaining(); RefPtr<nsWindow> window = nsWindow::From(widget); Loading Loading @@ -3091,7 +3093,8 @@ DocumentLoadListener::AsyncOnChannelRedirect( bc ? bc->GetParentProcessWidgetContaining() : nullptr; RefPtr<nsWindow> window = nsWindow::From(widget); if (window) { if (window && !nsExternalHelperAppService::ExternalProtocolIsBlockedBySandbox( bc, false)) { promise = window->OnLoadRequest(uriBeingLoaded, nsIBrowserDOMWindow::OPEN_CURRENTWINDOW, nsIWebNavigation::LOAD_FLAGS_IS_REDIRECT, Loading
uriloader/exthandler/nsExternalHelperAppService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -967,7 +967,7 @@ nsresult nsExternalHelperAppService::EscapeURI(nsIURI* aURI, nsIURI** aResult) { return ios->NewURI(escapedSpec, nullptr, nullptr, aResult); } bool ExternalProtocolIsBlockedBySandbox( bool nsExternalHelperAppService::ExternalProtocolIsBlockedBySandbox( BrowsingContext* aBrowsingContext, const bool aHasValidUserGestureActivation) { if (!StaticPrefs::dom_block_external_protocol_navigation_from_sandbox()) { Loading
uriloader/exthandler/nsExternalHelperAppService.h +8 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,14 @@ class nsExternalHelperAppService : public nsIExternalHelperAppService, // Internal method. Only called directly from tests. static nsresult EscapeURI(nsIURI* aURI, nsIURI** aResult); /** * Check whether `aBrowsingContext` is sandboxed such that external * protocol navigations performed in that context would be blocked. */ static bool ExternalProtocolIsBlockedBySandbox( mozilla::dom::BrowsingContext* aBrowsingContext, const bool aHasValidUserGestureActivation); /** * Logging Module. Usage: set MOZ_LOG=HelperAppService:level, where level * should be 2 for errors, 3 for debug messages from the cross- platform Loading