browser_bug420160.js
Go to the documentation of this file.
1 var listener = {
2  testFunction : null,
3 
4  handleEvent : function (e) {
5  this.testFunction();
6  }
7 }
8 
9 var newBrowser;
10 
11 /* Tests for correct behaviour of getEffectiveHost on identity handler */
12 function test() {
13 
15 
16  ok(gIdentityHandler, "gIdentityHandler should exist");
17 
18  var newTab = gBrowser.addTab();
19  gBrowser.selectedTab = newTab;
20  newBrowser = gBrowser.getBrowserForTab(newTab);
21 
22  newBrowser.addEventListener("load", listener, true);
23  listener.testFunction = testNormalDomain;
24  newBrowser.contentWindow.location = 'http://test1.example.org/';
25 }
26 
27 function testNormalDomain() {
28  is(gIdentityHandler._lastLocation.host, 'test1.example.org', "Identity handler is getting the full location");
29  is(gIdentityHandler.getEffectiveHost(), 'example.org', "getEffectiveHost should return example.org for test1.example.org");
30 
31  listener.testFunction = testNormalDomainWithPort;
32  newBrowser.contentWindow.location = 'http://sub1.test1.example.org:8000/';
33 }
34 
36 
37  is(gIdentityHandler._lastLocation.host, 'sub1.test1.example.org:8000', "Identity handler is getting port information");
38  is(gIdentityHandler.getEffectiveHost(), 'example.org', "getEffectiveHost should return example.org for sub1.test1.example.org:8000");
39 
40  listener.testFunction = testIPWithPort;
41  newBrowser.contentWindow.location = 'http://127.0.0.1:8888/';
42 }
43 
44 function testIPWithPort() {
45  is(gIdentityHandler.getEffectiveHost(), '127.0.0.1', "getEffectiveHost should return 127.0.0.1 for 127.0.0.1:8888");
46  newBrowser.removeEventListener("load", listener, true);
47  gBrowser.removeCurrentTab();
48  finish();
49 }
function testNormalDomainWithPort()
function test()
var newBrowser
var listener
waitForExplicitFinish()
return null
Definition: FeedWriter.js:1143
function testNormalDomain()
function testIPWithPort()
var gIdentityHandler
Definition: browser.js:6449