Bug 1610850 - Part 2: Tests for replacing parent process BrowsingContext, r=smaug
authorNika Layzell <nika@thelayzells.com>
Thu, 26 Mar 2020 17:37:21 +0000
changeset 520615 eeb6b2a3ca38e0ecedd18db5d77315ba19c0b67a
parent 520614 42d7139b94be76a0db6862ae08033409f3c33d0d
child 520616 03fc2ea7048c15e40088c7f617e5ded13ab313d8
push id37254
push usernerli@mozilla.com
push dateFri, 27 Mar 2020 04:48:07 +0000
treeherdermozilla-central@2d758b42bd73 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1610850
milestone76.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 1610850 - Part 2: Tests for replacing parent process BrowsingContext, r=smaug Differential Revision: https://phabricator.services.mozilla.com/D67922
dom/tests/browser/browser.ini
dom/tests/browser/browser_navigate_replace_browsingcontext.js
--- a/dom/tests/browser/browser.ini
+++ b/dom/tests/browser/browser.ini
@@ -103,8 +103,9 @@ support-files =
   test_noopener_target.html
 [browser_noopener_null_uri.js]
 [browser_wakelock.js]
 [browser_keypressTelemetry.js]
 skip-if = webrender
 [browser_windowProxy_transplant.js]
 support-files =
   file_postMessage_parent.html
+[browser_navigate_replace_browsingcontext.js]
new file mode 100644
--- /dev/null
+++ b/dom/tests/browser/browser_navigate_replace_browsingcontext.js
@@ -0,0 +1,25 @@
+add_task(async function parent_to_remote() {
+  await BrowserTestUtils.withNewTab("about:mozilla", async browser => {
+    let originalBC = browser.browsingContext;
+
+    BrowserTestUtils.loadURI(browser, "https://example.com/");
+    await BrowserTestUtils.browserLoaded(browser);
+    let newBC = browser.browsingContext;
+
+    isnot(originalBC.id, newBC.id,
+          "Should have replaced the BrowsingContext");
+  });
+});
+
+add_task(async function remote_to_parent() {
+  await BrowserTestUtils.withNewTab("https://example.com/", async browser => {
+    let originalBC = browser.browsingContext;
+
+    BrowserTestUtils.loadURI(browser, "about:mozilla");
+    await BrowserTestUtils.browserLoaded(browser);
+    let newBC = browser.browsingContext;
+
+    isnot(originalBC.id, newBC.id,
+          "Should have replaced the BrowsingContext");
+  });
+});