Bug 1609158 - Add a simple test for `window.open('file://...')` with GeckoView r=geckoview-reviewers,agi
authorJames Willcox <snorp@snorp.net>
Wed, 15 Jan 2020 14:20:26 +0000
changeset 510363 b548bcce41dc4d315dcbfc9a4eb3b252b2922f6a
parent 510362 6e16d9619d92382c29e9eaada54876d275a3fb37
child 510364 58df4e6bc1b682dc80fbe4cdbb00aa31e24ce5a6
push id37020
push userccoroiu@mozilla.com
push dateWed, 15 Jan 2020 21:36:21 +0000
treeherdermozilla-central@c35bb210b8ae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, agi
bugs1609158
milestone74.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1609158 - Add a simple test for `window.open('file://...')` with GeckoView r=geckoview-reviewers,agi This is covered in other test suites, but it may be possible for GeckoView to get this wrong, so add an explicit test. Differential Revision: https://phabricator.services.mozilla.com/D59935
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
@@ -997,16 +997,27 @@ class NavigationDelegateTest : BaseSessi
             @AssertCalled(count = 1, order = [2])
             override fun onNewSession(session: GeckoSession, uri: String): GeckoResult<GeckoSession>? {
                 assertThat("URI should be correct", uri, endsWith(NEW_SESSION_CHILD_HTML_PATH))
                 return null
             }
         })
     }
 
+    @Test(expected = GeckoSessionTestRule.RejectedPromiseException::class)
+    fun onNewSession_rejectLocal() {
+        // Disable popup blocker.
+        sessionRule.setPrefsUntilTestEnd(mapOf("dom.disable_open_during_load" to false))
+
+        sessionRule.session.loadTestPath(NEW_SESSION_HTML_PATH)
+        sessionRule.session.waitForPageStop()
+
+        sessionRule.session.evaluateJS("window.open('file:///data/local/tmp', '_blank')")
+    }
+
     @Test fun onNewSession_calledForTargetBlankLink() {
         // Disable popup blocker.
         sessionRule.setPrefsUntilTestEnd(mapOf("dom.disable_open_during_load" to false))
 
         sessionRule.session.loadTestPath(NEW_SESSION_HTML_PATH)
         sessionRule.session.waitForPageStop()
 
         sessionRule.session.evaluateJS("document.querySelector('#targetBlankLink').click()")