зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1507324 - 2. Don't start in remote mode when there is opener; r=geckoview-reviewers,snorp
Gecko doesn't support creating a remote browser from a non-remote browser when there is an opener, so create a non-remote browser when there is an opener, even in multiprocess mode. Differential Revision: https://phabricator.services.mozilla.com/D11952 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
376d2464a2
Коммит
3b0544a8ad
|
@ -835,8 +835,8 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
})
|
||||
}
|
||||
|
||||
private fun delegateNewSession(): GeckoSession {
|
||||
val newSession = sessionRule.createClosedSession()
|
||||
private fun delegateNewSession(settings: GeckoSessionSettings = mainSession.settings): GeckoSession {
|
||||
val newSession = sessionRule.createClosedSession(settings)
|
||||
|
||||
sessionRule.session.delegateDuringNextWait(object : Callbacks.NavigationDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
|
@ -890,6 +890,28 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
equalTo(NEW_SESSION_HTML_PATH))
|
||||
}
|
||||
|
||||
@Setting(key = Setting.Key.USE_MULTIPROCESS, value = "false")
|
||||
@WithDevToolsAPI
|
||||
@Test fun onNewSession_openRemoteFromNonRemote() {
|
||||
// Disable popup blocker.
|
||||
sessionRule.setPrefsUntilTestEnd(mapOf("dom.disable_open_during_load" to false))
|
||||
|
||||
// Ensure a non-remote page can open a remote page, as needed by some tests.
|
||||
assertThat("Opening session should be non-remote",
|
||||
mainSession.settings.getBoolean(GeckoSessionSettings.USE_MULTIPROCESS),
|
||||
equalTo(false))
|
||||
|
||||
val newSession = delegateNewSession(
|
||||
GeckoSessionSettings(mainSession.settings).apply {
|
||||
setBoolean(GeckoSessionSettings.USE_MULTIPROCESS, true)
|
||||
})
|
||||
mainSession.evaluateJS("window.open('http://example.com')")
|
||||
newSession.waitForPageStop()
|
||||
|
||||
assertThat("window.opener should be set",
|
||||
newSession.evaluateJS("window.opener"), notNullValue())
|
||||
}
|
||||
|
||||
@WithDevToolsAPI
|
||||
@Test fun onNewSession_supportNoOpener() {
|
||||
// Disable popup blocker.
|
||||
|
|
|
@ -146,6 +146,11 @@ class GeckoViewNavigation extends GeckoViewModule {
|
|||
}
|
||||
|
||||
if (opener) {
|
||||
if (aSubject.browser.hasAttribute("remote")) {
|
||||
// We cannot start in remote mode when we have an opener.
|
||||
aSubject.browser.setAttribute("remote", "false");
|
||||
aSubject.browser.removeAttribute("remoteType");
|
||||
}
|
||||
aSubject.browser.presetOpenerWindow(opener);
|
||||
}
|
||||
Services.obs.removeObserver(handler, "geckoview-window-created");
|
||||
|
|
Загрузка…
Ссылка в новой задаче