OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
3 let server = null; | 3 let server = null; |
4 let frame = null; | 4 let frame = null; |
5 | 5 |
6 module("Pop-up blocker", { | 6 module("Pop-up blocker", { |
7 setup: function() | 7 setup: function() |
8 { | 8 { |
9 prepareFilterComponents.call(this, true); | 9 prepareFilterComponents.call(this, true); |
10 preparePrefs.call(this); | 10 preparePrefs.call(this); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 let tests = [ | 66 let tests = [ |
67 ["||127.0.0.1:1234/target$popup", false], | 67 ["||127.0.0.1:1234/target$popup", false], |
68 ["||127.0.0.1:1234/target$~subdocument", true], | 68 ["||127.0.0.1:1234/target$~subdocument", true], |
69 ["||127.0.0.1:1234/target$popup,domain=127.0.0.1", false], | 69 ["||127.0.0.1:1234/target$popup,domain=127.0.0.1", false], |
70 ["||127.0.0.1:1234/target$popup,domain=128.0.0.1", true], | 70 ["||127.0.0.1:1234/target$popup,domain=128.0.0.1", true], |
71 ["||127.0.0.1:1234/redirect$popup", false], | 71 ["||127.0.0.1:1234/redirect$popup", false], |
72 ["||127.0.0.1:1234/redirect$~subdocument", true], | 72 ["||127.0.0.1:1234/redirect$~subdocument", true], |
73 ["||127.0.0.1:1234/redirect$popup,domain=127.0.0.1", false], | 73 ["||127.0.0.1:1234/redirect$popup,domain=127.0.0.1", false], |
74 ["||127.0.0.1:1234/redirect$popup,domain=128.0.0.1", true], | 74 ["||127.0.0.1:1234/redirect$popup,domain=128.0.0.1", true], |
75 | |
76 // These are messed up by bug 467514 (a click inside a frame opening a new | |
77 // tab should be considered as type document, not subdocument). We cannot | |
78 // fix the bug but at least we can ensure consistent results. | |
79 ["||127.0.0.1:1234/target$subdocument", false], | |
80 ["||127.0.0.1:1234/target$subdocument,domain=127.0.0.1", false], | |
81 ["||127.0.0.1:1234/target$subdocument,domain=128.0.0.1", true], | |
82 ["||127.0.0.1:1234/redirect$subdocument", false], | |
83 ["||127.0.0.1:1234/redirect$subdocument,domain=127.0.0.1", false], | |
84 ["||127.0.0.1:1234/redirect$subdocument,domain=128.0.0.1", true], | |
85 ]; | 75 ]; |
86 | 76 |
87 function runTest(filter, result) | 77 function runTest(filter, result) |
88 { | 78 { |
89 FilterStorage.addFilter(filter); | 79 FilterStorage.addFilter(filter); |
90 | 80 |
91 let successful = false; | 81 let successful = false; |
92 let wnd = Utils.getChromeWindow(window); | 82 let wnd = Utils.getChromeWindow(window); |
93 | 83 |
94 function onTabOpen(event) | 84 function onTabOpen(event) |
(...skipping 15 matching lines...) Expand all Loading... |
110 }); | 100 }); |
111 } | 101 } |
112 | 102 |
113 function onTabClose(event) | 103 function onTabClose(event) |
114 { | 104 { |
115 wnd.gBrowser.tabContainer.removeEventListener("TabClose", onTabClose, fals
e); | 105 wnd.gBrowser.tabContainer.removeEventListener("TabClose", onTabClose, fals
e); |
116 ok(result == successful, "Opening tab with filter " + filter.text); | 106 ok(result == successful, "Opening tab with filter " + filter.text); |
117 var keys = []; | 107 var keys = []; |
118 for (key in defaultMatcher.blacklist.keywordByFilter) | 108 for (key in defaultMatcher.blacklist.keywordByFilter) |
119 keys.push(key); | 109 keys.push(key); |
120 Cu.reportError(filter instanceof RegExpFilter); | |
121 | 110 |
122 FilterStorage.removeFilter(filter); | 111 FilterStorage.removeFilter(filter); |
123 start(); | 112 start(); |
124 } | 113 } |
125 | 114 |
126 wnd.gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, false); | 115 wnd.gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, false); |
127 wnd.gBrowser.tabContainer.addEventListener("TabClose", onTabClose, false); | 116 wnd.gBrowser.tabContainer.addEventListener("TabClose", onTabClose, false); |
128 let timeout = window.setTimeout(onTabClose, 1000); // In case the tab isn
't opened | 117 let timeout = window.setTimeout(onTabClose, 1000); // In case the tab isn
't opened |
129 | 118 |
130 frame.contentDocument.getElementById("link").click(); | 119 frame.contentDocument.getElementById("link").click(); |
131 } | 120 } |
132 | 121 |
133 for (let [filter, result] of tests) | 122 for (let [filter, result] of tests) |
134 asyncTest(filter, runTest.bind(null, Filter.fromText(filter), result)); | 123 asyncTest(filter, runTest.bind(null, Filter.fromText(filter), result)); |
135 })(); | 124 })(); |
OLD | NEW |