mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1600704 - Hardcode support for intent URIs so that they always get passed to onLoadRequest. r=snorp
Differential Revision: https://phabricator.services.mozilla.com/D64395 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
32800c141f
commit
20feb8ff78
@ -23,6 +23,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.hamcrest.MatcherAssert
|
||||
import org.hamcrest.Matchers.*
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assume.assumeThat
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@ -363,6 +364,26 @@ class NavigationDelegateTest : BaseSessionTest() {
|
||||
})
|
||||
}
|
||||
|
||||
@Test fun redirectIntentLoad() {
|
||||
assumeThat(sessionRule.env.isAutomation, equalTo(true))
|
||||
|
||||
val redirectUri = "intent://test"
|
||||
val uri = "http://example.org/tests/junit/simple_redirect.sjs?$redirectUri"
|
||||
|
||||
sessionRule.session.loadUri(uri)
|
||||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
|
||||
@AssertCalled(count = 2, order = [1, 2])
|
||||
override fun onLoadRequest(session: GeckoSession,
|
||||
request: LoadRequest):
|
||||
GeckoResult<AllowOrDeny>? {
|
||||
assertThat("URL should match", request.uri, equalTo(forEachCall(uri, redirectUri)))
|
||||
return null
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@Test fun bypassClassifier() {
|
||||
val phishingUri = "https://www.itisatrap.org/firefox/its-a-trap.html"
|
||||
|
@ -34,9 +34,11 @@ nsresult nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
|
||||
|
||||
nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char* aScheme,
|
||||
bool* aExists) {
|
||||
// We don't want to get protocol handlers from the OS in GV; the app
|
||||
// should take care of that in NavigationDelegate.onLoadRequest().
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
// Hard-code support for intent URIs until we have a more general solution
|
||||
// for letting the app decide which schemes to handle.
|
||||
nsAutoCString scheme(aScheme);
|
||||
*aExists = scheme.Equals(NS_LITERAL_CSTRING("intent"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
Loading…
x
Reference in New Issue
Block a user