Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 function test() {
2 waitForExplicitFinish();
3 testNext();
4 }
6 var pairs = [
7 ["example", "http://www.example.net/"],
8 ["ex-ample", "http://www.ex-ample.net/"],
9 [" example ", "http://www.example.net/"],
10 [" example/foo ", "http://www.example.net/foo"],
11 [" example/foo bar ", "http://www.example.net/foo%20bar"],
12 ["example.net", "http://example.net/"],
13 ["http://example", "http://example/"],
14 ["example:8080", "http://example:8080/"],
15 ["ex-ample.foo", "http://ex-ample.foo/"],
16 ["example.foo/bar ", "http://example.foo/bar"],
17 ["1.1.1.1", "http://1.1.1.1/"],
18 ["ftp://example", "ftp://example/"],
19 ["ftp.example.bar", "ftp://ftp.example.bar/"],
20 ["ex ample", Services.search.defaultEngine.getSubmission("ex ample", null, "keyword").uri.spec],
21 ];
23 function testNext() {
24 if (!pairs.length) {
25 finish();
26 return;
27 }
29 let [inputValue, expectedURL] = pairs.shift();
31 gBrowser.addProgressListener({
32 onStateChange: function onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
33 if (aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
34 aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
35 is(aRequest.originalURI.spec, expectedURL,
36 "entering '" + inputValue + "' loads expected URL");
38 gBrowser.removeProgressListener(this);
39 gBrowser.stop();
41 executeSoon(testNext);
42 }
43 }
44 });
46 gURLBar.addEventListener("focus", function onFocus() {
47 gURLBar.removeEventListener("focus", onFocus);
48 EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
49 });
51 gBrowser.selectedBrowser.focus();
52 gURLBar.inputField.value = inputValue;
53 gURLBar.focus();
54 }