summaryrefslogtreecommitdiffstats
path: root/dom/plugins/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /dom/plugins/test
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/plugins/test')
-rw-r--r--dom/plugins/test/crashtests/110650-1.html11
-rw-r--r--dom/plugins/test/crashtests/41276-1.html28
-rw-r--r--dom/plugins/test/crashtests/48856-1.html10
-rw-r--r--dom/plugins/test/crashtests/752340.html19
-rw-r--r--dom/plugins/test/crashtests/843086.xhtml1
-rw-r--r--dom/plugins/test/crashtests/crashtests.list5
-rw-r--r--dom/plugins/test/mochitest/block_all_plugins.html10
-rw-r--r--dom/plugins/test/mochitest/browser.toml4
-rw-r--r--dom/plugins/test/mochitest/browser_blockallplugins.js64
-rw-r--r--dom/plugins/test/mochitest/large-pic.jpgbin0 -> 98570 bytes
-rw-r--r--dom/plugins/test/mochitest/mixed_case_mime.sjs7
-rw-r--r--dom/plugins/test/mochitest/mochitest.toml10
-rw-r--r--dom/plugins/test/mochitest/test_mixed_case_mime.html25
-rw-r--r--dom/plugins/test/mochitest/test_plugin_fallback_focus.html80
-rw-r--r--dom/plugins/test/moz.build9
15 files changed, 283 insertions, 0 deletions
diff --git a/dom/plugins/test/crashtests/110650-1.html b/dom/plugins/test/crashtests/110650-1.html
new file mode 100644
index 0000000000..9826227b03
--- /dev/null
+++ b/dom/plugins/test/crashtests/110650-1.html
@@ -0,0 +1,11 @@
+<HTML>
+<HEAD>
+<TITLE>123246 testcase</TITLE>
+</HEAD>
+<BODY>
+<object align="right" width=100>
+</object>
+</BODY >
+</HTML>
+
+
diff --git a/dom/plugins/test/crashtests/41276-1.html b/dom/plugins/test/crashtests/41276-1.html
new file mode 100644
index 0000000000..ba35c34fa0
--- /dev/null
+++ b/dom/plugins/test/crashtests/41276-1.html
@@ -0,0 +1,28 @@
+<HTML><HEAD><TITLE>Plugin Limit</TITLE></HEAD>
+<BODY>
+
+Mozilla has a hardcoded limit of 10 simultaneously embedded plugins.<br>
+If that limit is exceeded, plugin instances are prematurely destroyed (see the empty boxes below).<br>
+Leave or reload a page that has a prematurely destroyed plugin and mozilla will crash.<br>
+Sometimes, just loading this page will cause mozilla to crash.<br>
+
+
+<br>
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player">
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player"><br>
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player">
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player"><br>
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player">
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player"><br>
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player">
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player"><br>
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player">
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player"><br>
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player">
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player"><br>
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player">
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player"><br>
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player">
+<embed TYPE=audio/x-pn-realaudio-plugin WIDTH=300 HEIGHT=75 CONTROLS="Default" AUTOSTART="FALSE" CONSOLE="RA_Player"><br>
+<br>
+</BODY></HTML>
diff --git a/dom/plugins/test/crashtests/48856-1.html b/dom/plugins/test/crashtests/48856-1.html
new file mode 100644
index 0000000000..cd0de2ab94
--- /dev/null
+++ b/dom/plugins/test/crashtests/48856-1.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+ <HEAD>
+ <TITLE>Mozilla Bug 48856</TITLE>
+ </HEAD>
+ <BODY>
+ <EMBED></EMBED>
+ </BODY>
+</HTML>
diff --git a/dom/plugins/test/crashtests/752340.html b/dom/plugins/test/crashtests/752340.html
new file mode 100644
index 0000000000..c4c8c464f5
--- /dev/null
+++ b/dom/plugins/test/crashtests/752340.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script type="text/javascript">
+ // Failures in this file can manifest as ###!!! ASSERTION: scope has non-empty map: '0 == mWrappedNativeMap->Count()'
+ // followed by an Assertion failure: allocated() crash during the next GC.
+ // It can also manifest as a leak.
+ function breakthings() {
+ var e = document.createElement("embed");
+ var i = document.getElementById("i");
+ i.contentDocument.body.appendChild(e);
+ i.src = "about:blank";
+ }
+ </script>
+</head>
+<body onload="javascript:breakthings();">
+<iframe id="i" />
+</body>
+</html>
diff --git a/dom/plugins/test/crashtests/843086.xhtml b/dom/plugins/test/crashtests/843086.xhtml
new file mode 100644
index 0000000000..a88e2193fc
--- /dev/null
+++ b/dom/plugins/test/crashtests/843086.xhtml
@@ -0,0 +1 @@
+<applet xmlns="http://www.w3.org/1999/xhtml" />
diff --git a/dom/plugins/test/crashtests/crashtests.list b/dom/plugins/test/crashtests/crashtests.list
new file mode 100644
index 0000000000..568cd8fca5
--- /dev/null
+++ b/dom/plugins/test/crashtests/crashtests.list
@@ -0,0 +1,5 @@
+HTTP load 41276-1.html
+HTTP load 48856-1.html
+HTTP load 110650-1.html
+HTTP load 752340.html
+HTTP load 843086.xhtml
diff --git a/dom/plugins/test/mochitest/block_all_plugins.html b/dom/plugins/test/mochitest/block_all_plugins.html
new file mode 100644
index 0000000000..3ccdda1373
--- /dev/null
+++ b/dom/plugins/test/mochitest/block_all_plugins.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+ <object id="object" type="application/x-shockwave-flash"></object>
+ <embed id="embed" type="application/x-shockwave-flash"></embed>
+</body>
+</html>
diff --git a/dom/plugins/test/mochitest/browser.toml b/dom/plugins/test/mochitest/browser.toml
new file mode 100644
index 0000000000..d90f54ba27
--- /dev/null
+++ b/dom/plugins/test/mochitest/browser.toml
@@ -0,0 +1,4 @@
+[DEFAULT]
+support-files = ["block_all_plugins.html"]
+
+["browser_blockallplugins.js"]
diff --git a/dom/plugins/test/mochitest/browser_blockallplugins.js b/dom/plugins/test/mochitest/browser_blockallplugins.js
new file mode 100644
index 0000000000..b0ad03a05f
--- /dev/null
+++ b/dom/plugins/test/mochitest/browser_blockallplugins.js
@@ -0,0 +1,64 @@
+var gTestRoot = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content/",
+ "http://127.0.0.1:8888/"
+);
+
+add_task(async function () {
+ registerCleanupFunction(function () {
+ gBrowser.removeCurrentTab();
+ window.focus();
+ });
+});
+
+// simple tab load helper, pilfered from browser plugin tests
+function promiseTabLoadEvent(tab, url) {
+ info("Wait tab event: load");
+
+ function handle(loadedUrl) {
+ if (loadedUrl === "about:blank" || (url && loadedUrl !== url)) {
+ info(`Skipping spurious load event for ${loadedUrl}`);
+ return false;
+ }
+
+ info("Tab event received: load");
+ return true;
+ }
+
+ let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle);
+
+ if (url) {
+ BrowserTestUtils.startLoadingURIString(tab.linkedBrowser, url);
+ }
+
+ return loaded;
+}
+
+add_task(async function () {
+ let pluginTab = (gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser));
+ await promiseTabLoadEvent(pluginTab, gTestRoot + "block_all_plugins.html");
+ await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () {
+ let doc = content.document;
+
+ let objectElt = doc.getElementById("object");
+ Assert.ok(!!objectElt, "object should exist");
+ Assert.ok(
+ objectElt instanceof Ci.nsIObjectLoadingContent,
+ "object should be an nsIObjectLoadingContent"
+ );
+ Assert.ok(
+ objectElt.displayedType == Ci.nsIObjectLoadingContent.TYPE_FALLBACK,
+ "object should be blocked"
+ );
+
+ let embedElt = doc.getElementById("embed");
+ Assert.ok(!!embedElt, "embed should exist");
+ Assert.ok(
+ embedElt instanceof Ci.nsIObjectLoadingContent,
+ "embed should be an nsIObjectLoadingContent"
+ );
+ Assert.ok(
+ embedElt.displayedType == Ci.nsIObjectLoadingContent.TYPE_FALLBACK,
+ "embed should be blocked"
+ );
+ });
+});
diff --git a/dom/plugins/test/mochitest/large-pic.jpg b/dom/plugins/test/mochitest/large-pic.jpg
new file mode 100644
index 0000000000..b167f6b9ba
--- /dev/null
+++ b/dom/plugins/test/mochitest/large-pic.jpg
Binary files differ
diff --git a/dom/plugins/test/mochitest/mixed_case_mime.sjs b/dom/plugins/test/mochitest/mixed_case_mime.sjs
new file mode 100644
index 0000000000..57b48b4b96
--- /dev/null
+++ b/dom/plugins/test/mochitest/mixed_case_mime.sjs
@@ -0,0 +1,7 @@
+function handleRequest(request, response) {
+ response.processAsync();
+ response.setHeader("Content-Type", "image/pNG", false);
+
+ response.write("Hello world.\n");
+ response.finish();
+}
diff --git a/dom/plugins/test/mochitest/mochitest.toml b/dom/plugins/test/mochitest/mochitest.toml
new file mode 100644
index 0000000000..674adb5413
--- /dev/null
+++ b/dom/plugins/test/mochitest/mochitest.toml
@@ -0,0 +1,10 @@
+[DEFAULT]
+skip-if = ["headless"] # crash on shutdown, no other failures
+support-files = [
+ "large-pic.jpg",
+ "mixed_case_mime.sjs",
+]
+
+["test_mixed_case_mime.html"]
+
+["test_plugin_fallback_focus.html"]
diff --git a/dom/plugins/test/mochitest/test_mixed_case_mime.html b/dom/plugins/test/mochitest/test_mixed_case_mime.html
new file mode 100644
index 0000000000..fac5e386f1
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_mixed_case_mime.html
@@ -0,0 +1,25 @@
+<body>
+<head>
+ <title>Test mixed case mimetype for plugins</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<script>
+ SimpleTest.expectAssertions(0, 1);
+
+ SimpleTest.waitForExplicitFinish();
+
+ function frameLoaded() {
+ var contentDocument = document.getElementById("testframe").contentDocument;
+ ok(contentDocument.body.innerHTML.length, "Frame content shouldn't be empty.");
+ ok(contentDocument.images.length, "Frame content should have an image.");
+ SimpleTest.finish();
+ }
+</script>
+</head>
+<body>
+ <p id="display"></p>
+
+ <iframe id="testframe" name="testframe" onload="frameLoaded()" src="mixed_case_mime.sjs"></iframe>
+
+</body>
+</html>
diff --git a/dom/plugins/test/mochitest/test_plugin_fallback_focus.html b/dom/plugins/test/mochitest/test_plugin_fallback_focus.html
new file mode 100644
index 0000000000..334d94455c
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_plugin_fallback_focus.html
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test that plugins reject focus</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<div id="content">
+ <object id="obj_elt" type="application/x-shockwave-flash"></object>
+ <object tabindex='0' id="obj_elt_with_idx" type="application/x-shockwave-flash"></object>
+ <embed id="embed_elt" type="application/x-shockwave-flash"></embed>
+</div>
+<script type="application/javascript">
+var objElt = document.getElementById('obj_elt');
+var objEltWithIdx = document.getElementById('obj_elt_with_idx');
+var embedElt = document.getElementById('embed_elt');
+
+function checkHasFocus(expected, typeOfElts, elt) {
+ ok((document.activeElement == elt) == expected,
+ typeOfElts + " element should " + (expected ? "" : "not ") + "accept focus");
+}
+
+function checkNoneHasFocus(typeOfElts) {
+ checkHasFocus(false, typeOfElts + " <object>", objElt);
+ checkHasFocus(false, typeOfElts + " <object> with tabindex", objEltWithIdx);
+ checkHasFocus(false, typeOfElts + " <embed>", embedElt);
+}
+
+function checkFocusable(expected, typeOfElts, elt) {
+ elt.focus();
+ checkHasFocus(expected, typeOfElts, elt);
+}
+
+// As plugins, object and embed elements are not given focus
+ok(objElt != null, "object element should exist");
+ok(objEltWithIdx != null, "object element with tabindex should exist");
+ok(embedElt != null, "embed element should exist");
+
+// As plugins, obj/embed_elt can not take focus
+checkNoneHasFocus("plugin");
+
+// Switch obj/embed_elt attributes from plugin to image
+objElt.data = "large-pic.jpg";
+objElt.width = 100;
+objElt.height = 100;
+objElt.type = "image/jpg";
+objEltWithIdx.data = "large-pic.jpg";
+objEltWithIdx.width = 100;
+objEltWithIdx.height = 100;
+objEltWithIdx.type = "image/jpg";
+embedElt.src = "large-pic.jpg";
+embedElt.width = 100;
+embedElt.height = 100;
+embedElt.type = "image/jpg";
+
+// As images, obj/embed_elt can take focus as image
+// object image elements require a tabindex to accept focus.
+// embed elements must be reparented before new type is recognized.
+checkFocusable(false, "<object> image", objElt);
+checkFocusable(true, "<object> image with tabindex", objEltWithIdx);
+checkFocusable(true, "<embed> plugin with image attribs before reparenting", embedElt);
+embedElt.parentNode.appendChild(embedElt);
+checkFocusable(true, "<embed> image", embedElt);
+
+// Switch obj/embed_elt attributes from image to plugin
+objElt.type = "application/x-shockwave-flash";
+embedElt.type = "application/x-shockwave-flash";
+
+// embed elements must be reparented before new type is recognized.
+checkFocusable(true, "<embed> image with plugin attribs", embedElt);
+embedElt.parentNode.appendChild(embedElt);
+checkNoneHasFocus("plugin");
+</script>
+</body>
+</html>
+
+
diff --git a/dom/plugins/test/moz.build b/dom/plugins/test/moz.build
new file mode 100644
index 0000000000..c6c9400450
--- /dev/null
+++ b/dom/plugins/test/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("gtk", "cocoa", "windows"):
+ MOCHITEST_MANIFESTS += ["mochitest/mochitest.toml"]
+ BROWSER_CHROME_MANIFESTS += ["mochitest/browser.toml"]