diff --git a/devtools/client/responsive/browser/tunnel.js b/devtools/client/responsive/browser/tunnel.js index da784366ca89..247706c0bfbc 100644 --- a/devtools/client/responsive/browser/tunnel.js +++ b/devtools/client/responsive/browser/tunnel.js @@ -102,16 +102,11 @@ function tunnelToInnerBrowser(outer, inner) { inner._documentURI = outer._documentURI; inner._documentContentType = outer._documentContentType; inner._characterSet = outer._characterSet; + inner._contentPrincipal = outer._contentPrincipal; inner._isSyntheticDocument = outer._isSyntheticDocument; inner._innerWindowID = outer._innerWindowID; inner._remoteWebNavigation._currentURI = outer._remoteWebNavigation._currentURI; - // mozbrowser elements do not support the `contentPrincipal` property. - // Because of this, we copy the outer browser's (xul:browser) - // `contentPrincipal` here. We need to do this because some event - // listeners on the browser tab try to access this property - // directly off the browser element. - inner.contentPrincipal = outer.contentPrincipal; } }, diff --git a/devtools/client/responsive/browser/web-navigation.js b/devtools/client/responsive/browser/web-navigation.js index 0a35bb85a94f..5845bfa97215 100644 --- a/devtools/client/responsive/browser/web-navigation.js +++ b/devtools/client/responsive/browser/web-navigation.js @@ -32,26 +32,11 @@ BrowserElementWebNavigation.prototype = { canGoForward: false, goBack() { - const cancelContentJSEpoch = this.maybeCancelContentJSExecution( - Ci.nsIRemoteTab.NAVIGATE_BACK - ); - this._sendMessage("WebNavigation:GoBack", { cancelContentJSEpoch }); + this._browser.goBack(); }, goForward() { - const cancelContentJSEpoch = this.maybeCancelContentJSExecution( - Ci.nsIRemoteTab.NAVIGATE_FORWARD - ); - this._sendMessage("WebNavigation:GoForward", { cancelContentJSEpoch }); - }, - - maybeCancelContentJSExecution(navigationType, options = {}) { - const epoch = this._cancelContentJSEpoch++; - this._browser.frameLoader.remoteTab.maybeCancelContentJSExecution( - navigationType, - { ...options, epoch } - ); - return epoch; + this._browser.goForward(); }, gotoIndex(index) { diff --git a/devtools/client/responsive/test/browser/browser.ini b/devtools/client/responsive/test/browser/browser.ini index 3ddacd71581a..8fca55d1d1fc 100644 --- a/devtools/client/responsive/test/browser/browser.ini +++ b/devtools/client/responsive/test/browser/browser.ini @@ -53,7 +53,6 @@ tags = devtools webextensions [browser_mouse_resize.js] [browser_navigation.js] [browser_network_throttling.js] -[browser_old-rdm_navigation.js] [browser_old-rdm_reload_conditions.js] [browser_orientationchange_event.js] [browser_page_redirection.js] diff --git a/devtools/client/responsive/test/browser/browser_old-rdm_navigation.js b/devtools/client/responsive/test/browser/browser_old-rdm_navigation.js deleted file mode 100644 index 8f8d71e90a25..000000000000 --- a/devtools/client/responsive/test/browser/browser_old-rdm_navigation.js +++ /dev/null @@ -1,100 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// Test the primary browser navigation in old-RDM is working. This is the same test as -// browser_navigation.js, except it runs against the browserUI pref being set to false. -// Bug 1585097: This test will be deleted once browser UI-enabled RDM is shipped to stable. - -const DUMMY_1_URL = "http://example.com/"; -const TEST_URL = `${URL_ROOT}doc_page_state.html`; -const DUMMY_2_URL = "http://example.com/browser/"; -const DUMMY_3_URL = "http://example.com/browser/devtools/"; - -addRDMTask( - null, - async function() { - // Load up a sequence of pages: - // 0. DUMMY_1_URL - // 1. TEST_URL - // 2. DUMMY_2_URL - const tab = await addTab(DUMMY_1_URL); - const browser = tab.linkedBrowser; - await load(browser, TEST_URL); - await load(browser, DUMMY_2_URL); - - // Check session history state - let history = await getSessionHistory(browser); - is(history.index - 1, 2, "At page 2 in history"); - is(history.entries.length, 3, "3 pages in history"); - is(history.entries[0].url, DUMMY_1_URL, "Page 0 URL matches"); - is(history.entries[1].url, TEST_URL, "Page 1 URL matches"); - is(history.entries[2].url, DUMMY_2_URL, "Page 2 URL matches"); - - // Go back one so we're at the test page - await back(browser); - - // Check session history state - history = await getSessionHistory(browser); - is(history.index - 1, 1, "At page 1 in history"); - is(history.entries.length, 3, "3 pages in history"); - is(history.entries[0].url, DUMMY_1_URL, "Page 0 URL matches"); - is(history.entries[1].url, TEST_URL, "Page 1 URL matches"); - is(history.entries[2].url, DUMMY_2_URL, "Page 2 URL matches"); - - const { ui } = await openRDM(tab); - await waitForDeviceAndViewportState(ui); - - ok(browser.webNavigation.canGoBack, "Going back is allowed"); - ok(browser.webNavigation.canGoForward, "Going forward is allowed"); - is(browser.documentURI.spec, TEST_URL, "documentURI matches page 1"); - is(browser.contentTitle, "Page State Test", "contentTitle matches page 1"); - - await forward(browser); - - ok(browser.webNavigation.canGoBack, "Going back is allowed"); - ok(!browser.webNavigation.canGoForward, "Going forward is not allowed"); - is(browser.documentURI.spec, DUMMY_2_URL, "documentURI matches page 2"); - is( - browser.contentTitle, - "mochitest index /browser/", - "contentTitle matches page 2" - ); - - await back(browser); - await back(browser); - - ok(!browser.webNavigation.canGoBack, "Going back is not allowed"); - ok(browser.webNavigation.canGoForward, "Going forward is allowed"); - is(browser.documentURI.spec, DUMMY_1_URL, "documentURI matches page 0"); - is( - browser.contentTitle, - "mochitest index /", - "contentTitle matches page 0" - ); - - await load(browser, DUMMY_3_URL); - - ok(browser.webNavigation.canGoBack, "Going back is allowed"); - ok(!browser.webNavigation.canGoForward, "Going forward is not allowed"); - is(browser.documentURI.spec, DUMMY_3_URL, "documentURI matches page 3"); - is( - browser.contentTitle, - "mochitest index /browser/devtools/", - "contentTitle matches page 3" - ); - - await closeRDM(tab); - - // Check session history state - history = await getSessionHistory(browser); - is(history.index - 1, 1, "At page 1 in history"); - is(history.entries.length, 2, "2 pages in history"); - is(history.entries[0].url, DUMMY_1_URL, "Page 0 URL matches"); - is(history.entries[1].url, DUMMY_3_URL, "Page 1 URL matches"); - - await removeTab(tab); - }, - { usingBrowserUI: false, onlyPrefAndTask: true } -);