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 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | let { DebuggerServer } = |
michael@0 | 5 | Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {}); |
michael@0 | 6 | let { DebuggerClient } = |
michael@0 | 7 | Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {}); |
michael@0 | 8 | let { devtools } = |
michael@0 | 9 | Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); |
michael@0 | 10 | |
michael@0 | 11 | // Ensure target is closed if client is closed directly |
michael@0 | 12 | function test() { |
michael@0 | 13 | waitForExplicitFinish(); |
michael@0 | 14 | |
michael@0 | 15 | if (!DebuggerServer.initialized) { |
michael@0 | 16 | DebuggerServer.init(function () { return true; }); |
michael@0 | 17 | DebuggerServer.addBrowserActors(); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | var client = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 21 | client.connect(() => { |
michael@0 | 22 | client.listTabs(response => { |
michael@0 | 23 | let options = { |
michael@0 | 24 | form: response, |
michael@0 | 25 | client: client, |
michael@0 | 26 | chrome: true |
michael@0 | 27 | }; |
michael@0 | 28 | |
michael@0 | 29 | devtools.TargetFactory.forRemoteTab(options).then(target => { |
michael@0 | 30 | target.on("close", () => { |
michael@0 | 31 | ok(true, "Target was closed"); |
michael@0 | 32 | DebuggerServer.destroy(); |
michael@0 | 33 | finish(); |
michael@0 | 34 | }); |
michael@0 | 35 | client.close(); |
michael@0 | 36 | }); |
michael@0 | 37 | }); |
michael@0 | 38 | }); |
michael@0 | 39 | } |