browser/base/content/test/plugins/browser_bug797677.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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 rootDir = getRootDirectory(gTestPath);
michael@0 6 const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
michael@0 7 const Cc = Components.classes;
michael@0 8 const Ci = Components.interfaces;
michael@0 9 var gTestBrowser = null;
michael@0 10 var gConsoleErrors = 0;
michael@0 11
michael@0 12 function test() {
michael@0 13 waitForExplicitFinish();
michael@0 14 var newTab = gBrowser.addTab();
michael@0 15 gBrowser.selectedTab = newTab;
michael@0 16 gTestBrowser = gBrowser.selectedBrowser;
michael@0 17 gTestBrowser.addEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
michael@0 18 var consoleService = Cc["@mozilla.org/consoleservice;1"]
michael@0 19 .getService(Ci.nsIConsoleService);
michael@0 20 var errorListener = {
michael@0 21 observe: function(aMessage) {
michael@0 22 if (aMessage.message.contains("NS_ERROR"))
michael@0 23 gConsoleErrors++;
michael@0 24 }
michael@0 25 };
michael@0 26 consoleService.registerListener(errorListener);
michael@0 27 registerCleanupFunction(function() {
michael@0 28 gTestBrowser.removeEventListener("PluginBindingAttached", pluginBindingAttached, true);
michael@0 29 consoleService.unregisterListener(errorListener);
michael@0 30 gBrowser.removeCurrentTab();
michael@0 31 window.focus();
michael@0 32 });
michael@0 33 gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_bug797677.html";
michael@0 34 }
michael@0 35
michael@0 36 function pluginBindingAttached() {
michael@0 37 // Let browser-plugins.js handle the PluginNotFound event, then run the test
michael@0 38 executeSoon(runTest);
michael@0 39 }
michael@0 40
michael@0 41 function runTest() {
michael@0 42 var doc = gTestBrowser.contentDocument;
michael@0 43 var plugin = doc.getElementById("plugin");
michael@0 44 ok(plugin, "plugin should be in the page");
michael@0 45 is(gConsoleErrors, 0, "should have no console errors");
michael@0 46 finish();
michael@0 47 }

mercurial