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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | function test() { |
michael@0 | 6 | //initialization |
michael@0 | 7 | waitForExplicitFinish(); |
michael@0 | 8 | |
michael@0 | 9 | let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]. |
michael@0 | 10 | getService(Ci.mozIJSSubScriptLoader); |
michael@0 | 11 | let ChromeUtils = {}; |
michael@0 | 12 | scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils); |
michael@0 | 13 | |
michael@0 | 14 | function testOnWindow(aIsPrivate, aCallback) { |
michael@0 | 15 | whenNewWindowLoaded({private: aIsPrivate}, function(win) { |
michael@0 | 16 | executeSoon(function() aCallback(win)); |
michael@0 | 17 | }); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | testOnWindow(false, function(aNormalWindow) { |
michael@0 | 21 | testOnWindow(true, function(aPrivateWindow) { |
michael@0 | 22 | // Open a tab in each window |
michael@0 | 23 | let normalTab = aNormalWindow.gBrowser.addTab("about:blank", {skipAnimation: true}); |
michael@0 | 24 | let privateTab = aPrivateWindow.gBrowser.addTab("about:blank", {skipAnimation: true}); |
michael@0 | 25 | |
michael@0 | 26 | let effect = ChromeUtils.synthesizeDrop(normalTab, privateTab, |
michael@0 | 27 | [[{type: TAB_DROP_TYPE, data: normalTab}]], |
michael@0 | 28 | null, aNormalWindow, aPrivateWindow); |
michael@0 | 29 | is(effect, "none", "Should not be able to drag a normal tab to a private window"); |
michael@0 | 30 | |
michael@0 | 31 | effect = ChromeUtils.synthesizeDrop(privateTab, normalTab, |
michael@0 | 32 | [[{type: TAB_DROP_TYPE, data: privateTab}]], |
michael@0 | 33 | null, aPrivateWindow, aNormalWindow); |
michael@0 | 34 | is(effect, "none", "Should not be able to drag a private tab to a normal window"); |
michael@0 | 35 | |
michael@0 | 36 | aNormalWindow.gBrowser.swapBrowsersAndCloseOther(normalTab, privateTab); |
michael@0 | 37 | is(aNormalWindow.gBrowser.tabs.length, 2, "Prevent moving a normal tab to a private tabbrowser"); |
michael@0 | 38 | is(aPrivateWindow.gBrowser.tabs.length, 2, "Prevent accepting a normal tab in a private tabbrowser"); |
michael@0 | 39 | |
michael@0 | 40 | aPrivateWindow.gBrowser.swapBrowsersAndCloseOther(privateTab, normalTab); |
michael@0 | 41 | is(aPrivateWindow.gBrowser.tabs.length, 2, "Prevent moving a private tab to a normal tabbrowser"); |
michael@0 | 42 | is(aNormalWindow.gBrowser.tabs.length, 2, "Prevent accepting a private tab in a normal tabbrowser"); |
michael@0 | 43 | |
michael@0 | 44 | aNormalWindow.close(); |
michael@0 | 45 | aPrivateWindow.close(); |
michael@0 | 46 | finish(); |
michael@0 | 47 | }); |
michael@0 | 48 | }); |
michael@0 | 49 | } |
michael@0 | 50 |