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.
michael@0 | 1 | /* vim:set ts=2 sw=2 sts=2 et: */ |
michael@0 | 2 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 4 | |
michael@0 | 5 | // Tests that if a link in console is double clicked, the console frame doesn't |
michael@0 | 6 | // navigate to that destination (bug 975707). |
michael@0 | 7 | |
michael@0 | 8 | function test() { |
michael@0 | 9 | let originalNetPref = Services.prefs.getBoolPref("devtools.webconsole.filter.networkinfo"); |
michael@0 | 10 | registerCleanupFunction(() => { |
michael@0 | 11 | Services.prefs.setBoolPref("devtools.webconsole.filter.networkinfo", originalNetPref); |
michael@0 | 12 | }); |
michael@0 | 13 | Services.prefs.setBoolPref("devtools.webconsole.filter.networkinfo", true); |
michael@0 | 14 | Task.spawn(runner).then(finishTest); |
michael@0 | 15 | |
michael@0 | 16 | function* runner() { |
michael@0 | 17 | const TEST_PAGE_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html" + "?_uniq=" + Date.now(); |
michael@0 | 18 | |
michael@0 | 19 | const {tab} = yield loadTab("data:text/html;charset=utf8,<p>hello</p>"); |
michael@0 | 20 | const hud = yield openConsole(tab); |
michael@0 | 21 | |
michael@0 | 22 | content.location = TEST_PAGE_URI; |
michael@0 | 23 | |
michael@0 | 24 | let messages = yield waitForMessages({ |
michael@0 | 25 | webconsole: hud, |
michael@0 | 26 | messages: [{ |
michael@0 | 27 | name: "Network request message", |
michael@0 | 28 | url: TEST_PAGE_URI, |
michael@0 | 29 | category: CATEGORY_NETWORK |
michael@0 | 30 | }] |
michael@0 | 31 | }); |
michael@0 | 32 | |
michael@0 | 33 | let networkEventMessage = messages[0].matched.values().next().value; |
michael@0 | 34 | let urlNode = networkEventMessage.querySelector(".url"); |
michael@0 | 35 | |
michael@0 | 36 | let deferred = promise.defer(); |
michael@0 | 37 | urlNode.addEventListener("click", function onClick(aEvent) { |
michael@0 | 38 | urlNode.removeEventListener("click", onClick); |
michael@0 | 39 | ok(aEvent.defaultPrevented, "The default action was prevented."); |
michael@0 | 40 | |
michael@0 | 41 | deferred.resolve(); |
michael@0 | 42 | }); |
michael@0 | 43 | |
michael@0 | 44 | EventUtils.synthesizeMouseAtCenter(urlNode, {clickCount: 2}, hud.iframeWindow); |
michael@0 | 45 | |
michael@0 | 46 | yield deferred.promise; |
michael@0 | 47 | } |
michael@0 | 48 | } |