browser_link.js (1088B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test link helpers openDocLink, openTrustedLink. 7 8 // Use any valid test page here. 9 const TEST_URI = TEST_URI_ROOT_SSL + "dummy.html"; 10 11 const { 12 openDocLink, 13 openTrustedLink, 14 } = require("resource://devtools/client/shared/link.js"); 15 16 add_task(async function () { 17 // Open a link to a page that will not trigger any request. 18 info("Open web link to example.com test page"); 19 openDocLink(TEST_URI); 20 await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); 21 22 is( 23 gBrowser.selectedBrowser.currentURI.spec, 24 TEST_URI, 25 "openDocLink opened a tab with the expected url" 26 ); 27 28 info("Open trusted link to about:config"); 29 openTrustedLink("about:config"); 30 await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); 31 32 is( 33 gBrowser.selectedBrowser.currentURI.spec, 34 "about:config", 35 "openTrustedLink opened a tab with the expected url" 36 ); 37 38 await removeTab(gBrowser.selectedTab); 39 await removeTab(gBrowser.selectedTab); 40 });