Bug 1762733 - Wipe defunct plugin tests. r=IanN
This commit is contained in:
Родитель
247d46319e
Коммит
1f25ff2d82
|
@ -21,7 +21,7 @@ function reallyHandleRequest(request, response) {
|
|||
|
||||
var expected_user = "", expected_pass = "", realm = "mochitest";
|
||||
var proxy_expected_user = "", proxy_expected_pass = "", proxy_realm = "mochi-proxy";
|
||||
var huge = false, plugin = false, anonymous = false;
|
||||
var huge = false, anonymous = false;
|
||||
var authHeaderCount = 1;
|
||||
// user=xxx
|
||||
match = /[^_]user=([^&]*)/.exec(query);
|
||||
|
@ -58,11 +58,6 @@ function reallyHandleRequest(request, response) {
|
|||
if (match)
|
||||
huge = true;
|
||||
|
||||
// plugin=1
|
||||
match = /plugin=1/.exec(query);
|
||||
if (match)
|
||||
plugin = true;
|
||||
|
||||
// multiple=1
|
||||
match = /multiple=([^&]*)/.exec(query);
|
||||
if (match)
|
||||
|
@ -159,11 +154,6 @@ function reallyHandleRequest(request, response) {
|
|||
response.write("<span id='footnote'>This is a footnote after the huge content fill</span>");
|
||||
}
|
||||
|
||||
if (plugin) {
|
||||
response.write("<embed id='embedtest' style='width: 400px; height: 100px;' " +
|
||||
"type='application/x-test'></embed>\n");
|
||||
}
|
||||
|
||||
response.write("</html>");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310001">
|
||||
<emItems>
|
||||
</emItems>
|
||||
<pluginItems>
|
||||
</pluginItems>
|
||||
</blocklist>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
|
||||
<emItems>
|
||||
</emItems>
|
||||
<pluginItems>
|
||||
<pluginItem blockID="p9999">
|
||||
<match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
|
||||
<versionRange severity="2"></versionRange>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
</blocklist>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
|
||||
<emItems>
|
||||
</emItems>
|
||||
<pluginItems>
|
||||
<pluginItem blockID="p9999">
|
||||
<match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
|
||||
<versionRange severity="0" vulnerabilitystatus="2"></versionRange>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
</blocklist>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
|
||||
<emItems>
|
||||
</emItems>
|
||||
<pluginItems>
|
||||
<pluginItem blockID="p9999">
|
||||
<match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
|
||||
<versionRange severity="0" vulnerabilitystatus="1"></versionRange>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
</blocklist>
|
|
@ -1,7 +1,6 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
head.js
|
||||
plugin_test.html
|
||||
|
||||
[browser_alltabslistener.js]
|
||||
support-files = alltabslistener.html
|
||||
|
@ -28,27 +27,6 @@ support-files = page_style_sample.html
|
|||
support-files = file_dom_notifications.html
|
||||
[browser_pageInfo.js]
|
||||
support-files = feed_tab.html
|
||||
[browser_pluginCrashCommentAndURL.js]
|
||||
support-files = pluginCrashCommentAndURL.html
|
||||
[browser_pluginnotification.js]
|
||||
support-files =
|
||||
blockNoPlugins.xml
|
||||
blockPluginHard.xml
|
||||
blockPluginVulnerableNoUpdate.xml
|
||||
blockPluginVulnerableUpdatable.xml
|
||||
plugin_alternate_content.html
|
||||
plugin_both.html
|
||||
plugin_both2.html
|
||||
plugin_bug743421.html
|
||||
plugin_bug749455.html
|
||||
plugin_clickToPlayAllow.html
|
||||
plugin_clickToPlayDeny.html
|
||||
plugin_hidden_to_visible.html
|
||||
plugin_test2.html
|
||||
plugin_test3.html
|
||||
plugin_two_types.html
|
||||
plugin_unknown.html
|
||||
[browser_pluginplaypreview.js]
|
||||
[browser_popupNotification.js]
|
||||
[browser_privatebrowsing_protocolhandler.js]
|
||||
support-files = browser_privatebrowsing_protocolhandler_page.html
|
||||
|
|
|
@ -1,157 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const CRASH_URL = "http://example.com/browser/suite/browser/test/browser/pluginCrashCommentAndURL.html";
|
||||
|
||||
const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
|
||||
|
||||
function test() {
|
||||
// Crashing the plugin takes up a lot of time, so extend the test timeout.
|
||||
requestLongerTimeout(runs.length);
|
||||
waitForExplicitFinish();
|
||||
|
||||
// The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables plugin
|
||||
// crash reports. This test needs them enabled. The test also needs a mock
|
||||
// report server, and fortunately one is already set up by toolkit/
|
||||
// crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL,
|
||||
// which CrashSubmit.jsm uses as a server override.
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Ci.nsIEnvironment);
|
||||
let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
|
||||
let serverURL = env.get("MOZ_CRASHREPORTER_URL");
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
|
||||
env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
|
||||
|
||||
let tab = gBrowser.loadOneTab("about:blank", { inBackground: false });
|
||||
let browser = tab.linkedBrowser;
|
||||
browser.addEventListener("PluginCrashed", onCrash);
|
||||
Services.obs.addObserver(onSubmitStatus, "crash-report-status");
|
||||
|
||||
registerCleanupFunction(function cleanUp() {
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
|
||||
env.set("MOZ_CRASHREPORTER_URL", serverURL);
|
||||
gBrowser.selectedBrowser.removeEventListener("PluginCrashed", onCrash);
|
||||
Services.obs.removeObserver(onSubmitStatus, "crash-report-status");
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
doNextRun();
|
||||
}
|
||||
|
||||
var runs = [
|
||||
{
|
||||
shouldSubmissionUIBeVisible: true,
|
||||
comment: "",
|
||||
urlOptIn: false,
|
||||
},
|
||||
{
|
||||
shouldSubmissionUIBeVisible: true,
|
||||
comment: "a test comment",
|
||||
urlOptIn: true,
|
||||
},
|
||||
{
|
||||
width: 300,
|
||||
height: 300,
|
||||
shouldSubmissionUIBeVisible: false,
|
||||
},
|
||||
];
|
||||
|
||||
var currentRun = null;
|
||||
|
||||
function doNextRun() {
|
||||
try {
|
||||
if (!runs.length) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
currentRun = runs.shift();
|
||||
let args = ["width", "height"].reduce(function (memo, arg) {
|
||||
if (arg in currentRun)
|
||||
memo[arg] = currentRun[arg];
|
||||
return memo;
|
||||
}, {});
|
||||
gBrowser.loadURI(CRASH_URL + "?" +
|
||||
encodeURIComponent(JSON.stringify(args)));
|
||||
// And now wait for the crash.
|
||||
}
|
||||
catch (err) {
|
||||
failWithException(err);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
function onCrash() {
|
||||
try {
|
||||
let plugin = getBrowser().contentDocument.getElementById("plugin");
|
||||
let elt = plugin.ownerDocument.getAnonymousElementByAttribute.bind(plugin.ownerDocument, plugin, "anonid");
|
||||
let style =
|
||||
gBrowser.contentWindow.getComputedStyle(elt("pleaseSubmit"));
|
||||
is(style.display,
|
||||
currentRun.shouldSubmissionUIBeVisible ? "block" : "none",
|
||||
"Submission UI visibility should be correct");
|
||||
if (!currentRun.shouldSubmissionUIBeVisible) {
|
||||
// Done with this run.
|
||||
doNextRun();
|
||||
return;
|
||||
}
|
||||
elt("submitComment").value = currentRun.comment;
|
||||
elt("submitURLOptIn").checked = currentRun.urlOptIn;
|
||||
elt("submitButton").click();
|
||||
// And now wait for the submission status notification.
|
||||
}
|
||||
catch (err) {
|
||||
failWithException(err);
|
||||
doNextRun();
|
||||
}
|
||||
}
|
||||
|
||||
function onSubmitStatus(subj, topic, data) {
|
||||
try {
|
||||
// Wait for success or failed, doesn't matter which.
|
||||
if (data != "success" && data != "failed")
|
||||
return;
|
||||
|
||||
let extra = getPropertyBagValue(subj.QueryInterface(Ci.nsIPropertyBag),
|
||||
"extra");
|
||||
ok(extra instanceof Ci.nsIPropertyBag, "Extra data should be property bag");
|
||||
|
||||
let val = getPropertyBagValue(extra, "PluginUserComment");
|
||||
if (currentRun.comment)
|
||||
is(val, currentRun.comment,
|
||||
"Comment in extra data should match comment in textbox");
|
||||
else
|
||||
ok(val === undefined,
|
||||
"Comment should be absent from extra data when textbox is empty");
|
||||
|
||||
val = getPropertyBagValue(extra, "PluginContentURL");
|
||||
if (currentRun.urlOptIn)
|
||||
is(val, gBrowser.currentURI.spec,
|
||||
"URL in extra data should match browser URL when opt-in checked");
|
||||
else
|
||||
ok(val === undefined,
|
||||
"URL should be absent from extra data when opt-in not checked");
|
||||
}
|
||||
catch (err) {
|
||||
failWithException(err);
|
||||
}
|
||||
doNextRun();
|
||||
}
|
||||
|
||||
function getPropertyBagValue(bag, key) {
|
||||
try {
|
||||
var val = bag.getProperty(key);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.result != Cr.NS_ERROR_FAILURE) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
function failWithException(err) {
|
||||
ok(false, "Uncaught exception: " + err + "\n" + err.stack);
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,318 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var rootDir = getRootDirectory(gTestPath);
|
||||
const gTestRoot = rootDir;
|
||||
|
||||
var gTestBrowser = null;
|
||||
var gNextTest = null;
|
||||
var gNextTestSkip = 0;
|
||||
var gPlayPreviewPluginActualEvents = 0;
|
||||
var gPlayPreviewPluginExpectedEvents = 1;
|
||||
|
||||
var gPlayPreviewRegistration = null;
|
||||
|
||||
function registerPlayPreview(mimeType, targetUrl) {
|
||||
|
||||
function StreamConverterFactory() {}
|
||||
StreamConverterFactory.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]),
|
||||
_targetConstructor: null,
|
||||
|
||||
register: function register(targetConstructor) {
|
||||
this._targetConstructor = targetConstructor;
|
||||
var proto = targetConstructor.prototype;
|
||||
var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
registrar.registerFactory(proto.classID, proto.classDescription,
|
||||
proto.contractID, this);
|
||||
},
|
||||
|
||||
unregister: function unregister() {
|
||||
var proto = this._targetConstructor.prototype;
|
||||
var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
registrar.unregisterFactory(proto.classID, this);
|
||||
this._targetConstructor = null;
|
||||
},
|
||||
|
||||
// nsIFactory
|
||||
createInstance: function createInstance(aOuter, iid) {
|
||||
if (aOuter !== null)
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
return (new (this._targetConstructor)).QueryInterface(iid);
|
||||
},
|
||||
|
||||
// nsIFactory
|
||||
lockFactory: function lockFactory(lock) {
|
||||
// No longer used as of gecko 1.7.
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
};
|
||||
|
||||
function OverlayStreamConverter() {}
|
||||
OverlayStreamConverter.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIStreamConverter,
|
||||
Ci.nsIStreamListener,
|
||||
Ci.nsIRequestObserver
|
||||
]),
|
||||
|
||||
classID: Components.ID('{4c6030f7-e20a-264f-0f9b-ada3a9e97384}'),
|
||||
classDescription: 'overlay-test-data Component',
|
||||
contractID: '@mozilla.org/streamconv;1?from=application/x-moz-playpreview&to=*/*',
|
||||
|
||||
// nsIStreamConverter::convert
|
||||
convert: function(aFromStream, aFromType, aToType, aCtxt) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
// nsIStreamConverter::asyncConvertData
|
||||
asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
|
||||
var isValidRequest = false;
|
||||
try {
|
||||
var request = aCtxt;
|
||||
request.QueryInterface(Ci.nsIChannel);
|
||||
var spec = request.URI.spec;
|
||||
var expectedSpec = 'data:application/x-moz-playpreview;,' + mimeType;
|
||||
isValidRequest = (spec == expectedSpec);
|
||||
} catch (e) { }
|
||||
if (!isValidRequest)
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
// Store the listener passed to us
|
||||
this.listener = aListener;
|
||||
},
|
||||
|
||||
// nsIStreamListener::onDataAvailable
|
||||
onDataAvailable: function(aRequest, aContext, aInputStream, aOffset, aCount) {
|
||||
// Do nothing since all the data loading is handled by the viewer.
|
||||
ok(false, "onDataAvailable should not be called");
|
||||
},
|
||||
|
||||
// nsIRequestObserver::onStartRequest
|
||||
onStartRequest: function(aRequest, aContext) {
|
||||
|
||||
// Setup the request so we can use it below.
|
||||
aRequest.QueryInterface(Ci.nsIChannel);
|
||||
// Cancel the request so the viewer can handle it.
|
||||
aRequest.cancel(Cr.NS_BINDING_ABORTED);
|
||||
|
||||
// Create a new channel that is viewer loaded as a resource.
|
||||
var channel =
|
||||
Services.io.newChannelFromURI(Services.io.newURI(targetUrl),
|
||||
null,
|
||||
Services.scriptSecurityManager
|
||||
.getSystemPrincipal(),
|
||||
null,
|
||||
Ci.nsILoadInfo
|
||||
.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.asyncOpen2(this.listener);
|
||||
},
|
||||
|
||||
// nsIRequestObserver::onStopRequest
|
||||
onStopRequest: function(aRequest, aContext, aStatusCode) {
|
||||
// Do nothing.
|
||||
}
|
||||
};
|
||||
|
||||
var ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||
ph.registerPlayPreviewMimeType(mimeType);
|
||||
|
||||
var factory = new StreamConverterFactory();
|
||||
factory.register(OverlayStreamConverter);
|
||||
|
||||
return (gPlayPreviewRegistration = {
|
||||
unregister: function() {
|
||||
ph.unregisterPlayPreviewMimeType(mimeType);
|
||||
factory.unregister();
|
||||
gPlayPreviewRegistration = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function unregisterPlayPreview() {
|
||||
gPlayPreviewRegistration.unregister();
|
||||
}
|
||||
|
||||
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
registerCleanupFunction(function() {
|
||||
if (gPlayPreviewRegistration)
|
||||
gPlayPreviewRegistration.unregister();
|
||||
Services.prefs.clearUserPref("plugins.click_to_play");
|
||||
});
|
||||
|
||||
var newTab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = newTab;
|
||||
gTestBrowser = gBrowser.selectedBrowser;
|
||||
gTestBrowser.addEventListener("load", pageLoad, true);
|
||||
gTestBrowser.addEventListener("PluginBindingAttached", handleBindingAttached, true);
|
||||
|
||||
registerPlayPreview('application/x-test', 'about:');
|
||||
prepareTest(test1a, gTestRoot + "plugin_test.html", 1);
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
gTestBrowser.removeEventListener("load", pageLoad, true);
|
||||
gTestBrowser.removeEventListener("PluginBindingAttached", handleBindingAttached, true);
|
||||
gBrowser.removeCurrentTab();
|
||||
window.focus();
|
||||
finish();
|
||||
}
|
||||
|
||||
function handleBindingAttached(evt) {
|
||||
if (evt.target instanceof Ci.nsIObjectLoadingContent &&
|
||||
evt.target.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW)
|
||||
gPlayPreviewPluginActualEvents++;
|
||||
}
|
||||
|
||||
function pageLoad() {
|
||||
// The plugin events are async dispatched and can come after the load event
|
||||
// This just allows the events to fire before we then go on to test the states
|
||||
|
||||
// iframe might triggers load event as well, making sure we skip some to let
|
||||
// all iframes on the page be loaded as well
|
||||
if (gNextTestSkip) {
|
||||
gNextTestSkip--;
|
||||
return;
|
||||
}
|
||||
executeSoon(gNextTest);
|
||||
}
|
||||
|
||||
function prepareTest(nextTest, url, skip) {
|
||||
gNextTest = nextTest;
|
||||
gNextTestSkip = skip;
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
||||
|
||||
// Tests a page with normal play preview registration (1/2)
|
||||
function test1a() {
|
||||
var notificationBox = gBrowser.getNotificationBox(gTestBrowser);
|
||||
ok(!notificationBox.getNotificationWithValue("blocked-plugins"), "Test 1a, Should not have displayed the blocked plugin notification");
|
||||
|
||||
var pluginInfo = getTestPlugin();
|
||||
ok(pluginInfo, "Should have a test plugin");
|
||||
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 1a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
|
||||
ok(!objLoadingContent.activated, "Test 1a, Plugin should not be activated");
|
||||
|
||||
var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
|
||||
ok(overlay, "Test 1a, the overlay div is expected");
|
||||
|
||||
var iframe = overlay.getElementsByClassName("previewPluginContentFrame")[0];
|
||||
ok(iframe && iframe.localName == "iframe", "Test 1a, the overlay iframe is expected");
|
||||
var iframeHref = iframe.contentWindow.location.href;
|
||||
ok(iframeHref == "about:", "Test 1a, the overlay about: content is expected");
|
||||
|
||||
var rect = iframe.getBoundingClientRect();
|
||||
ok(rect.width == 200, "Test 1a, Plugin with id=" + plugin.id + " overlay rect should have 200px width before being replaced by actual plugin");
|
||||
ok(rect.height == 200, "Test 1a, Plugin with id=" + plugin.id + " overlay rect should have 200px height before being replaced by actual plugin");
|
||||
|
||||
var e = overlay.ownerDocument.createEvent("CustomEvent");
|
||||
e.initCustomEvent("MozPlayPlugin", true, true, null);
|
||||
overlay.dispatchEvent(e);
|
||||
var condition = () => objLoadingContent.activated;
|
||||
waitForCondition(condition, test1b, "Test 1a, Waited too long for plugin to stop play preview");
|
||||
}
|
||||
|
||||
// Tests that activating via MozPlayPlugin through the notification works (part 2/2)
|
||||
function test1b() {
|
||||
var plugin = gTestBrowser.contentDocument.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 1b, Plugin should be activated");
|
||||
|
||||
is(gPlayPreviewPluginActualEvents, gPlayPreviewPluginExpectedEvents,
|
||||
"There should be exactly one PluginPlayPreview event");
|
||||
|
||||
unregisterPlayPreview();
|
||||
|
||||
prepareTest(test2, gTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
// Tests a page with a working plugin in it -- the mime type was just unregistered.
|
||||
function test2() {
|
||||
var plugin = gTestBrowser.contentDocument.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 2, Plugin should be activated");
|
||||
|
||||
registerPlayPreview('application/x-unknown', 'about:');
|
||||
|
||||
prepareTest(test3, gTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
// Tests a page with a working plugin in it -- diffent play preview type is reserved.
|
||||
function test3() {
|
||||
var plugin = gTestBrowser.contentDocument.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 3, Plugin should be activated");
|
||||
|
||||
unregisterPlayPreview();
|
||||
|
||||
registerPlayPreview('application/x-test', 'about:');
|
||||
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
||||
prepareTest(test4a, gTestRoot + "plugin_test.html", 1);
|
||||
}
|
||||
|
||||
// Test a fallback to the click-to-play
|
||||
function test4a() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 4a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
|
||||
ok(!objLoadingContent.activated, "Test 4a, Plugin should not be activated");
|
||||
|
||||
var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
|
||||
ok(overlay, "Test 4a, the overlay div is expected");
|
||||
|
||||
var e = overlay.ownerDocument.createEvent("CustomEvent");
|
||||
e.initCustomEvent("MozPlayPlugin", true, true, true);
|
||||
overlay.dispatchEvent(e);
|
||||
var condition = () => objLoadingContent.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY;
|
||||
waitForCondition(condition, test4b, "Test 4a, Waited too long for plugin to stop play preview");
|
||||
}
|
||||
|
||||
function test4b() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.pluginFallbackType != Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 4b, plugin fallback type should not be PLUGIN_PLAY_PREVIEW");
|
||||
ok(!objLoadingContent.activated, "Test 4b, Plugin should not be activated");
|
||||
|
||||
prepareTest(test5a, gTestRoot + "plugin_test.html", 1);
|
||||
}
|
||||
|
||||
// Test a bypass of the click-to-play
|
||||
function test5a() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 5a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
|
||||
ok(!objLoadingContent.activated, "Test 5a, Plugin should not be activated");
|
||||
|
||||
var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
|
||||
ok(overlay, "Test 5a, the overlay div is expected");
|
||||
|
||||
var e = overlay.ownerDocument.createEvent("CustomEvent");
|
||||
e.initCustomEvent("MozPlayPlugin", true, true, false);
|
||||
overlay.dispatchEvent(e);
|
||||
var condition = () => objLoadingContent.activated;
|
||||
waitForCondition(condition, test5b, "Test 5a, Waited too long for plugin to stop play preview");
|
||||
}
|
||||
|
||||
function test5b() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 5b, Plugin should be activated");
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
@ -12,22 +12,6 @@ function findChromeWindowByURI(aURI) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function getTestPlugin(aName) {
|
||||
var pluginName = aName || "Test Plug-in";
|
||||
var ph = Cc["@mozilla.org/plugin/host;1"]
|
||||
.getService(Ci.nsIPluginHost);
|
||||
var tags = ph.getPluginTags();
|
||||
|
||||
// Find the test plugin
|
||||
for (var i = 0; i < tags.length; i++) {
|
||||
if (tags[i].name == pluginName)
|
||||
return tags[i];
|
||||
}
|
||||
|
||||
ok(false, "Unable to find plugin");
|
||||
return null;
|
||||
}
|
||||
|
||||
function waitForCondition(condition, nextTest, errorMsg) {
|
||||
var tries = 0;
|
||||
var interval = setInterval(function() {
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script>
|
||||
function crash() {
|
||||
var plugin = document.getElementById("plugin");
|
||||
var argStr = decodeURIComponent(window.location.search.substr(1));
|
||||
if (argStr) {
|
||||
var args = JSON.parse(argStr);
|
||||
for (var key in args)
|
||||
plugin.setAttribute(key, args[key]);
|
||||
}
|
||||
try {
|
||||
plugin.crash();
|
||||
}
|
||||
catch (err) {}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="crash();">
|
||||
<embed id="plugin" type="application/x-test"
|
||||
width="400" height="400"
|
||||
drawmode="solid" color="FF00FFFF">
|
||||
</embed>
|
||||
</body>
|
||||
</html>
|
|
@ -1,9 +0,0 @@
|
|||
<!-- bug 739575 -->
|
||||
<html>
|
||||
<head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
||||
</head>
|
||||
<body>
|
||||
<object id="test" type="application/x-test" style="height: 200px; width:200px">
|
||||
<p><a href="about:blank">you should not see this link when plugins are click-to-play</a></p>
|
||||
</object>
|
||||
</body></html>
|
|
@ -1,6 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<embed id="unknown" style="width: 100px; height: 100px" type="application/x-unknown">
|
||||
<embed id="test" style="width: 100px; height: 100px" type="application/x-test">
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<embed id="test" style="width: 100px; height: 100px" type="application/x-test">
|
||||
<embed id="unknown" style="width: 100px; height: 100px" type="application/x-unknown">
|
||||
</body>
|
||||
</html>
|
|
@ -1,17 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function addPlugin(callback) {
|
||||
var embed = document.createElement("embed");
|
||||
embed.style.width = "200px";
|
||||
embed.style.height = "200px";
|
||||
embed.setAttribute("type", "application/x-test");
|
||||
return document.body.appendChild(embed);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,8 +0,0 @@
|
|||
<!-- bug 749455 -->
|
||||
<html>
|
||||
<head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
||||
</head>
|
||||
<body>
|
||||
<embed src="plugin_bug749455.html" type="application/x-test" width="100px" height="100px"></embed>
|
||||
</body>
|
||||
</html>
|
|
@ -1,9 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<embed id="test" style="width: 200px; height: 200px" type="application/x-test">
|
||||
</body>
|
||||
</html>
|
|
@ -1,10 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<embed id="test" style="width: 200px; height: 200px" type="application/x-test">
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<div id="container" style="display: none">
|
||||
<object id="plugin" type="application/x-test" style="width: 200px; height: 200px;"></object>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,9 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<embed id="test" style="width: 200px; height: 200px" type="application/x-test">
|
||||
</body>
|
||||
</html>
|
|
@ -1,10 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<embed id="test1" style="width: 200px; height: 200px" type="application/x-test">
|
||||
<embed id="test2" style="width: 200px; height: 200px" type="application/x-test">
|
||||
</body>
|
||||
</html>
|
|
@ -1,9 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<embed id="test" style="width: 0px; height: 0px" type="application/x-test">
|
||||
</body>
|
||||
</html>
|
|
@ -1,9 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="utf-8"/></head>
|
||||
<body>
|
||||
<embed id="test" style="width: 200px; height: 200px" type="application/x-test"/>
|
||||
<embed id="secondtestA" style="width: 200px; height: 200px" type="application/x-second-test"/>
|
||||
<embed id="secondtestB" style="width: 200px; height: 200px" type="application/x-second-test"/>
|
||||
</body>
|
||||
</html>
|
|
@ -1,5 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<embed id="unknown" style="width: 100px; height: 100px" type="application/x-unknown">
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче