fune/browser/base/content/test/general/browser_bug579872.js
Kashav Madan 41b03f2575 Bug 1578465 - Fix broken tests, r=kmag,mconley
Fixes:

  - browser_startup_content.js (the BrowserTestUtils actor gets instantiated earlier than before)
  - browser_window_open.js (create the browserStopped promise before awaiting the initial load)
  - browser_bug579872.js (uses browserLoaded incorrectly)
  - browser_delay_autoplay_notInTreeAudio.js (uses browserLoaded incorrectly)
  - browser_delay_autoplay_playAfterTabVisible.js (uses browserLoaded incorrectly)
  - browser_delay_autoplay_playMediaInMuteTab.js (uses browserLoaded incorrectly)
  - browser_resume_bkg_video_on_tab_hover.js (uses browserLoaded incorrectly)

Depends on D49002

Differential Revision: https://phabricator.services.mozilla.com/D49003

--HG--
extra : moz-landing-system : lando
2019-10-29 16:23:23 +00:00

23 lines
899 B
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function() {
let newTab = BrowserTestUtils.addTab(gBrowser, "http://example.com");
await BrowserTestUtils.browserLoaded(newTab.linkedBrowser);
gBrowser.pinTab(newTab);
gBrowser.selectedTab = newTab;
openTrustedLinkIn("javascript:var x=0;", "current");
is(gBrowser.tabs.length, 2, "Should open in current tab");
openTrustedLinkIn("http://example.com/1", "current");
is(gBrowser.tabs.length, 2, "Should open in current tab");
openTrustedLinkIn("http://example.org/", "current");
is(gBrowser.tabs.length, 3, "Should open in new tab");
await BrowserTestUtils.removeTab(newTab);
await BrowserTestUtils.removeTab(gBrowser.tabs[1]); // example.org tab
});