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 |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | var gTestBrowser = null; |
michael@0 | 6 | var gNumPluginBindingsAttached = 0; |
michael@0 | 7 | |
michael@0 | 8 | Components.utils.import("resource://gre/modules/Services.jsm"); |
michael@0 | 9 | |
michael@0 | 10 | function test() { |
michael@0 | 11 | waitForExplicitFinish(); |
michael@0 | 12 | registerCleanupFunction(function() { |
michael@0 | 13 | Services.prefs.clearUserPref("plugins.click_to_play"); |
michael@0 | 14 | gTestBrowser.removeEventListener("PluginBindingAttached", pluginBindingAttached, true, true); |
michael@0 | 15 | gBrowser.removeCurrentTab(); |
michael@0 | 16 | window.focus(); |
michael@0 | 17 | }); |
michael@0 | 18 | |
michael@0 | 19 | Services.prefs.setBoolPref("plugins.click_to_play", true); |
michael@0 | 20 | setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY); |
michael@0 | 21 | |
michael@0 | 22 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 23 | gTestBrowser = gBrowser.selectedBrowser; |
michael@0 | 24 | gTestBrowser.addEventListener("PluginBindingAttached", pluginBindingAttached, true, true); |
michael@0 | 25 | var gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/"); |
michael@0 | 26 | gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_bug744745.html"; |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | function pluginBindingAttached() { |
michael@0 | 30 | gNumPluginBindingsAttached++; |
michael@0 | 31 | |
michael@0 | 32 | if (gNumPluginBindingsAttached == 1) { |
michael@0 | 33 | var doc = gTestBrowser.contentDocument; |
michael@0 | 34 | var testplugin = doc.getElementById("test"); |
michael@0 | 35 | ok(testplugin, "should have test plugin"); |
michael@0 | 36 | var style = getComputedStyle(testplugin); |
michael@0 | 37 | ok('opacity' in style, "style should have opacity set"); |
michael@0 | 38 | is(style.opacity, 1, "opacity should be 1"); |
michael@0 | 39 | finish(); |
michael@0 | 40 | } else { |
michael@0 | 41 | ok(false, "if we've gotten here, something is quite wrong"); |
michael@0 | 42 | } |
michael@0 | 43 | } |