From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../content-policy/browser_generalContentPolicy.js | 908 +++++++++++++++++++++ 1 file changed, 908 insertions(+) create mode 100644 comm/mail/test/browser/content-policy/browser_generalContentPolicy.js (limited to 'comm/mail/test/browser/content-policy/browser_generalContentPolicy.js') diff --git a/comm/mail/test/browser/content-policy/browser_generalContentPolicy.js b/comm/mail/test/browser/content-policy/browser_generalContentPolicy.js new file mode 100644 index 0000000000..eacb8fb309 --- /dev/null +++ b/comm/mail/test/browser/content-policy/browser_generalContentPolicy.js @@ -0,0 +1,908 @@ +/* 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/. */ + +/** + * Checks various remote content policy workings, including: + * + * - Images + * - Video + * + * In: + * + * - Messages + * - Reply email compose window + * - Forward email compose window + * - Content tab + * - Feed message + */ + +"use strict"; + +var utils = ChromeUtils.import("resource://testing-common/mozmill/utils.jsm"); +var { + close_compose_window, + open_compose_new_mail, + open_compose_with_forward, + open_compose_with_reply, +} = ChromeUtils.import("resource://testing-common/mozmill/ComposeHelpers.jsm"); +var { open_content_tab_with_url } = ChromeUtils.import( + "resource://testing-common/mozmill/ContentTabHelpers.jsm" +); +var { + assert_nothing_selected, + assert_selected_and_displayed, + be_in_folder, + close_message_window, + create_folder, + get_about_message, + mc, + open_message_from_file, + open_selected_message, + plan_for_message_display, + select_click_row, + set_open_message_behavior, + wait_for_message_display_completion, +} = ChromeUtils.import( + "resource://testing-common/mozmill/FolderDisplayHelpers.jsm" +); +var { input_value } = ChromeUtils.import( + "resource://testing-common/mozmill/KeyboardHelpers.jsm" +); +var { + get_notification_button, + wait_for_notification_to_show, + wait_for_notification_to_stop, +} = ChromeUtils.import( + "resource://testing-common/mozmill/NotificationBoxHelpers.jsm" +); +var { + async_plan_for_new_window, + click_menus_in_sequence, + plan_for_modal_dialog, + wait_for_modal_dialog, + wait_for_new_window, + wait_for_window_close, +} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm"); + +var { MailServices } = ChromeUtils.import( + "resource:///modules/MailServices.jsm" +); + +var folder = null; +var gMsgNo = -1; // msg index in folder + +var url = + "http://mochi.test:8888/browser/comm/mail/test/browser/content-policy/html/"; + +/** + * The TESTS array is constructed from objects containing the following: + * + * type: The type of the test being run. + * body: The html to be inserted into the body of the message under + * test. Note: the element under test for content + * allowed/disallowed should have id 'testelement'. + * webPage: The web page to load during the content tab part of the + * test. + * checkForAllowed: A function that is passed the element with id 'testelement' + * to check for remote content being allowed/disallowed. + * This function should return true if remote content was + * allowed, false otherwise. + */ +var TESTS = [ + { + type: "Iframe-Image", + description: "iframe img served over http should be blocked", + shouldBeBlocked: true, + + // Blocked from showing by other means. Network request can happen. + neverAllowed: true, + body: `