From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- dom/plugins/test/mochitest/block_all_plugins.html | 10 +++ dom/plugins/test/mochitest/browser.ini | 5 ++ .../test/mochitest/browser_blockallplugins.js | 64 +++++++++++++++++ dom/plugins/test/mochitest/large-pic.jpg | Bin 0 -> 98570 bytes dom/plugins/test/mochitest/mixed_case_mime.sjs | 7 ++ dom/plugins/test/mochitest/mochitest.ini | 10 +++ .../test/mochitest/test_mixed_case_mime.html | 25 +++++++ .../test/mochitest/test_plugin_fallback_focus.html | 80 +++++++++++++++++++++ 8 files changed, 201 insertions(+) create mode 100644 dom/plugins/test/mochitest/block_all_plugins.html create mode 100644 dom/plugins/test/mochitest/browser.ini create mode 100644 dom/plugins/test/mochitest/browser_blockallplugins.js create mode 100644 dom/plugins/test/mochitest/large-pic.jpg create mode 100644 dom/plugins/test/mochitest/mixed_case_mime.sjs create mode 100644 dom/plugins/test/mochitest/mochitest.ini create mode 100644 dom/plugins/test/mochitest/test_mixed_case_mime.html create mode 100644 dom/plugins/test/mochitest/test_plugin_fallback_focus.html (limited to 'dom/plugins/test/mochitest') 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 @@ + + + + + + + + + + diff --git a/dom/plugins/test/mochitest/browser.ini b/dom/plugins/test/mochitest/browser.ini new file mode 100644 index 0000000000..d5190abce7 --- /dev/null +++ b/dom/plugins/test/mochitest/browser.ini @@ -0,0 +1,5 @@ +[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..346db9d949 --- /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.loadURIString(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 Binary files /dev/null and b/dom/plugins/test/mochitest/large-pic.jpg 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.ini b/dom/plugins/test/mochitest/mochitest.ini new file mode 100644 index 0000000000..d4b4940ef1 --- /dev/null +++ b/dom/plugins/test/mochitest/mochitest.ini @@ -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] +skip-if = (processor == 'aarch64' && os == 'win') +reason = Plugins are not supported on Windows/AArch64 +[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 @@ + + + Test mixed case mimetype for plugins + + + + + +

+ + + + + 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..e89abb44df --- /dev/null +++ b/dom/plugins/test/mochitest/test_plugin_fallback_focus.html @@ -0,0 +1,80 @@ + + + + + Test that plugins reject focus + + + + + +
+ + + +
+ + + + + -- cgit v1.2.3