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 | const TEST_BASE = "chrome://mochitests/content/browser/browser/devtools/eyedropper/test/"; |
michael@0 | 5 | const TEST_HOST = 'mochi.test:8888'; |
michael@0 | 6 | |
michael@0 | 7 | let { devtools } = Components.utils.import("resource://gre/modules/devtools/Loader.jsm", {}); |
michael@0 | 8 | const { Eyedropper, EyedropperManager } = devtools.require("devtools/eyedropper/eyedropper"); |
michael@0 | 9 | |
michael@0 | 10 | let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/")); |
michael@0 | 11 | Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this); |
michael@0 | 12 | |
michael@0 | 13 | waitForExplicitFinish(); |
michael@0 | 14 | |
michael@0 | 15 | function cleanup() |
michael@0 | 16 | { |
michael@0 | 17 | while (gBrowser.tabs.length > 1) { |
michael@0 | 18 | gBrowser.removeCurrentTab(); |
michael@0 | 19 | } |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | registerCleanupFunction(cleanup); |
michael@0 | 23 | |
michael@0 | 24 | function addTab(uri) { |
michael@0 | 25 | let deferred = promise.defer(); |
michael@0 | 26 | |
michael@0 | 27 | let tab = gBrowser.addTab(); |
michael@0 | 28 | |
michael@0 | 29 | gBrowser.selectedTab = tab; |
michael@0 | 30 | gBrowser.selectedBrowser.addEventListener("load", function onLoad() { |
michael@0 | 31 | gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); |
michael@0 | 32 | deferred.resolve(tab); |
michael@0 | 33 | }, true); |
michael@0 | 34 | |
michael@0 | 35 | content.location = uri; |
michael@0 | 36 | |
michael@0 | 37 | return deferred.promise; |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | function dropperLoaded(dropper) { |
michael@0 | 41 | if (dropper.loaded) { |
michael@0 | 42 | return promise.resolve(); |
michael@0 | 43 | } |
michael@0 | 44 | return dropper.once("load"); |
michael@0 | 45 | } |