DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
<html>
<head>
  <title>Testing Browser</title>
  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">

test_Browser();

function test_Browser() {
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

  var browsers = Application.browsers;
  ok(browsers, "Check access to browser windows");
  ok(browsers.length, "There should be at least one browser window open");
  
  var activeBrowser = Application.activeBrowser;
  var moz = activeBrowser.open("http://mozilla.org/");
  var goog = activeBrowser.open("http://google.com/");
  goog.focus();

  is(activeBrowser.tabs.length, 3, "Checking length of 'Browser.tabs' after opening 2 additional tabs");
  is(activeBrowser.activeTab.index, goog.index, "Checking 'Browser.activeTab' after setting focus");
  
  // need to wait for the url's to be refreshed during the load
  function checkURL() {
    is(moz.url, "http://mozilla.org/", "Checking 'BrowserTab.url' after opening");  
    is(goog.url, "http://google.com/", "Checking 'BrowserTab.url' after opening");  
  }
  setTimeout(checkURL, 50);
}
</script>
</pre>
</body>
</html>