Bug 1885449 - Move GV code shared between Android and iOS to a shared directory. r=geckoview-reviewers,frontend-codestyle-reviewers,nalexander,owlish

And hook them up to the iOS build.

Differential Revision: https://phabricator.services.mozilla.com/D204711
This commit is contained in:
Mike Hommey 2024-05-16 22:08:51 +00:00
Родитель baca95a7c3
Коммит 21bcae940a
186 изменённых файлов: 347 добавлений и 198 удалений

Просмотреть файл

@ -298,7 +298,7 @@ module.exports = {
"devtools/shared/tests/xpcshell/test_console_filtering.js",
"devtools/shared/webconsole/test/chrome/test_consoleapi_innerID.html",
"dom/push/Push*.sys.mjs",
"mobile/android/modules/geckoview/GeckoViewUtils.sys.mjs",
"mobile/shared/modules/geckoview/GeckoViewUtils.sys.mjs",
"remote/shared/**",
"security/manager/ssl/RemoteSecuritySettings.sys.mjs",
"services/**",
@ -358,9 +358,10 @@ module.exports = {
"intl/locale/tests/unit/test_localeService.js",
"layout/tools/layout-debug/LayoutDebugChild.sys.mjs",
"layout/tools/reftest/reftest.sys.mjs",
"mobile/android/actors/**",
"mobile/android/components/geckoview/GeckoViewStartup.sys.mjs",
"mobile/android/modules/geckoview/**",
"mobile/shared/actors/**",
"mobile/shared/components/geckoview/GeckoViewStartup.sys.mjs",
"mobile/shared/modules/geckoview/**",
"netwerk/test/browser/browser_test_data_channel_observer.js",
"netwerk/test/unit/test_proxyconnect.js",
"remote/**",
@ -435,8 +436,8 @@ module.exports = {
"layout/style/test/property_database.js",
"layout/style/test/test_computed_style_grid_with_pseudo.html",
"layout/style/test/test_visited_reftests.html",
"mobile/android/components/extensions/test/mochitest/test_ext_tabs_events.html",
"mobile/android/geckoview/src/androidTest/assets/www/getusermedia_xorigin_container.html",
"mobile/shared/components/extensions/test/mochitest/test_ext_tabs_events.html",
"modules/libjar/test/unit/test_fault_handler.js",
"netwerk/test/httpserver/httpd.sys.mjs",
"netwerk/test/unit/**",
@ -574,6 +575,7 @@ module.exports = {
"js/xpconnect/**",
"layout/**",
"mobile/android/**",
"mobile/shared/**",
"modules/**",
"netwerk/**",
"parser/htmlparser/**",
@ -709,6 +711,7 @@ module.exports = {
"js/xpconnect/**",
"layout/**",
"mobile/android/**",
"mobile/shared/**",
"modules/**",
"netwerk/**",
"parser/htmlparser/**",
@ -2073,13 +2076,13 @@ module.exports = {
"layout/svg/tests/file_context_fill_fallback_red.html",
"layout/svg/tests/test_embed_sizing.html",
"layout/xul/test/test_bug386386.html",
"mobile/android/components/extensions/test/mochitest/test_ext_tabs_create.html",
"mobile/android/components/extensions/test/mochitest/test_ext_tabs_events.html",
"mobile/android/components/extensions/test/mochitest/test_ext_tabs_executeScript.html",
"mobile/android/components/extensions/test/mochitest/test_ext_tabs_executeScript_bad.html",
"mobile/android/components/extensions/test/mochitest/test_ext_tabs_query.html",
"mobile/android/components/extensions/test/mochitest/test_ext_tabs_sendMessage.html",
"mobile/android/components/extensions/test/mochitest/test_ext_tabs_update_url.html",
"mobile/shared/components/extensions/test/mochitest/test_ext_tabs_create.html",
"mobile/shared/components/extensions/test/mochitest/test_ext_tabs_events.html",
"mobile/shared/components/extensions/test/mochitest/test_ext_tabs_executeScript.html",
"mobile/shared/components/extensions/test/mochitest/test_ext_tabs_executeScript_bad.html",
"mobile/shared/components/extensions/test/mochitest/test_ext_tabs_query.html",
"mobile/shared/components/extensions/test/mochitest/test_ext_tabs_sendMessage.html",
"mobile/shared/components/extensions/test/mochitest/test_ext_tabs_update_url.html",
"netwerk/cookie/test/browser/browser_cookies_ipv6.js",
"netwerk/cookie/test/browser/browser_originattributes.js",
"netwerk/cookie/test/browser/browser_oversize.js",

Просмотреть файл

@ -908,7 +908,6 @@ layout/tables/test/test_bug337124.html
mobile/android/android-components/docs/_includes/footer.html
mobile/android/android-components/docs/_includes/head.html
mobile/android/android-components/docs/_layouts/home.html
mobile/android/components/extensions/test/mochitest/file_dummy.html
mobile/android/fenix/app/src/androidTest/assets/pages/htmlControls.html
mobile/android/fenix/app/src/androidTest/assets/pages/trackingPage.html
mobile/android/geckoview/src/androidTest/assets/www/accessibility/test-headings.html
@ -917,6 +916,7 @@ mobile/android/geckoview/src/androidTest/assets/www/badVideoPath.html
mobile/android/geckoview/src/androidTest/assets/www/context_menu_video.html
mobile/android/geckoview/src/androidTest/assets/www/mp4.html
mobile/android/geckoview/src/androidTest/assets/www/webm.html
mobile/shared/components/extensions/test/mochitest/file_dummy.html
netwerk/test/browser/103_preload_iframe.html
netwerk/test/browser/post.html
netwerk/test/mochitests/file_domain_hierarchy_inner.html

Просмотреть файл

@ -457,7 +457,7 @@ export var Sanitizer = {
// When making any changes to the sanitize implementations here,
// please check whether the changes are applicable to Android
// (mobile/android/modules/geckoview/GeckoViewStorageController.sys.mjs) as well.
// (mobile/shared/modules/geckoview/GeckoViewStorageController.sys.mjs) as well.
items: {
cache: {

Просмотреть файл

@ -13,7 +13,7 @@ Classes = [
},
]
if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'android':
if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] not in ('android', 'uikit'):
Classes += [
{
'cid': '{daaa8d73-677e-4233-8acd-2c404bd01658}',

Просмотреть файл

@ -5,68 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
Classes = [
{
'cid': '{3e30d2a0-9934-11ea-bb37-0242ac130002}',
'contract_ids': ['@mozilla.org/embedcomp/prompt-collection;1'],
'esModule': 'resource://gre/modules/PromptCollection.sys.mjs',
'constructor': 'PromptCollection',
},
{
'js_name': 'prompt',
'cid': '{076ac188-23c1-4390-aa08-7ef1f78ca5d9}',
'contract_ids': [
'@mozilla.org/prompter;1',
],
'interfaces': ['nsIPromptService'],
'esModule': 'resource://gre/modules/GeckoViewPrompt.sys.mjs',
'constructor': 'PromptFactory',
},
{
'cid': '{8e993c34-fdd6-432c-967e-f995d888777f}',
'contract_ids': ['@mozilla.org/geckoview/startup;1'],
'esModule': 'resource://gre/modules/GeckoViewStartup.sys.mjs',
'constructor': 'GeckoViewStartup',
},
{
'cid': '{42f3c238-e8e8-4015-9ca2-148723a8afcf}',
'contract_ids': ['@mozilla.org/content-permission/prompt;1'],
'esModule': 'resource://gre/modules/GeckoViewPermission.sys.mjs',
'constructor': 'GeckoViewPermission',
},
{
'cid': '{a54d84d7-98a4-4fec-b664-e42e512ae9cc}',
'contract_ids': ['@mozilla.org/push/Service;1'],
'esModule': 'resource://gre/modules/GeckoViewPush.sys.mjs',
'constructor': 'PushService',
},
{
'cid': '{fc4bec74-ddd0-4ea8-9a66-9a5081258e32}',
'contract_ids': ['@mozilla.org/parent/colorpicker;1'],
'esModule': 'resource://gre/modules/ColorPickerDelegate.sys.mjs',
'constructor': 'ColorPickerDelegate',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
{
'cid': '{25fdbae6-f684-4bf0-b773-ff2b7a6273c8}',
'contract_ids': ['@mozilla.org/parent/filepicker;1'],
'esModule': 'resource://gre/modules/FilePickerDelegate.sys.mjs',
'constructor': 'FilePickerDelegate',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
{
'cid': '{1201d357-8417-4926-a694-e6408fbedcf8}',
'contract_ids': ['@mozilla.org/sharepicker;1'],
'esModule': 'resource://gre/modules/ShareDelegate.sys.mjs',
'constructor': 'ShareDelegate',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
{
'cid': '{3d765750-1c3d-11ea-aaef-0800200c9a66}',
'contract_ids': ['@mozilla.org/login-manager/prompter;1'],
'esModule': 'resource://gre/modules/LoginStorageDelegate.sys.mjs',
'constructor': 'LoginStorageDelegate',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
{
'cid': '{91455c77-64a1-4c37-be00-f94eb9c7b8e1}',
'contract_ids': [
@ -91,23 +29,4 @@ Classes = [
],
},
},
{
'cid': '{ad643d9e-52e3-4385-a57c-b42deb2f5daf}',
'contract_ids': ['@mozilla.org/toolkit/sessionstore-functions;1'],
'esModule': 'resource://gre/modules/SessionStoreFunctions.sys.mjs',
'constructor': 'SessionStoreFunctions',
},
]
if defined('MOZ_ANDROID_HISTORY'):
Classes += [
{
'name': 'History',
'cid': '{0937a705-91a6-417a-8292-b22eb10da86c}',
'contract_ids': ['@mozilla.org/browser/history;1'],
'singleton': True,
'type': 'GeckoViewHistory',
'headers': ['GeckoViewHistory.h'],
'constructor': 'GeckoViewHistory::GetSingleton',
},
]

Просмотреть файл

@ -22,35 +22,10 @@ EXPORTS += [
"GeckoViewStreamListener.h",
]
if CONFIG["MOZ_ANDROID_HISTORY"]:
EXPORTS += [
"GeckoViewHistory.h",
]
SOURCES += [
"GeckoViewHistory.cpp",
]
include("/ipc/chromium/chromium-config.mozbuild")
include("/ipc/chromium/chromium-config.mozbuild")
XPCOM_MANIFESTS += [
"components.conf",
]
EXTRA_COMPONENTS += [
"GeckoView.manifest",
]
EXTRA_JS_MODULES += [
"ColorPickerDelegate.sys.mjs",
"FilePickerDelegate.sys.mjs",
"GeckoViewPermission.sys.mjs",
"GeckoViewPrompt.sys.mjs",
"GeckoViewPrompter.sys.mjs",
"GeckoViewPush.sys.mjs",
"GeckoViewStartup.sys.mjs",
"LoginStorageDelegate.sys.mjs",
"PromptCollection.sys.mjs",
"SessionStoreFunctions.sys.mjs",
"ShareDelegate.sys.mjs",
]
FINAL_LIBRARY = "xul"

Просмотреть файл

@ -7,10 +7,6 @@
with Files("**"):
BUG_COMPONENT = ("GeckoView", "General")
with Files("extensions/**"):
BUG_COMPONENT = ("WebExtensions", "Android")
DIRS += [
"extensions",
"geckoview",
]

Просмотреть файл

@ -4,7 +4,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Note: This file should only contain locale entries. All
# override and resource entries should go to mobile/android/chrome/jar.mn to avoid
# override and resource entries should go to mobile/shared/chrome/jar.mn to avoid
# having to create the same entry for each locale.
# Fluent files

Просмотреть файл

@ -6,40 +6,4 @@
EXTRA_JS_MODULES += [
"AndroidLog.sys.mjs",
"BrowserUsageTelemetry.sys.mjs",
"ChildCrashHandler.sys.mjs",
"DelayedInit.sys.mjs",
"GeckoViewActorChild.sys.mjs",
"GeckoViewActorManager.sys.mjs",
"GeckoViewActorParent.sys.mjs",
"GeckoViewAutocomplete.sys.mjs",
"GeckoViewAutofill.sys.mjs",
"GeckoViewChildModule.sys.mjs",
"GeckoViewClipboardPermission.sys.mjs",
"GeckoViewConsole.sys.mjs",
"GeckoViewContent.sys.mjs",
"GeckoViewContentBlocking.sys.mjs",
"GeckoViewIdentityCredential.sys.mjs",
"GeckoViewMediaControl.sys.mjs",
"GeckoViewModule.sys.mjs",
"GeckoViewNavigation.sys.mjs",
"GeckoViewProcessHangMonitor.sys.mjs",
"GeckoViewProgress.sys.mjs",
"GeckoViewPushController.sys.mjs",
"GeckoViewRemoteDebugger.sys.mjs",
"GeckoViewSelectionAction.sys.mjs",
"GeckoViewSessionStore.sys.mjs",
"GeckoViewSettings.sys.mjs",
"GeckoViewStorageController.sys.mjs",
"GeckoViewTab.sys.mjs",
"GeckoViewTelemetry.sys.mjs",
"GeckoViewTestUtils.sys.mjs",
"GeckoViewTranslations.sys.mjs",
"GeckoViewUtils.sys.mjs",
"GeckoViewWebExtension.sys.mjs",
"LoadURIDelegate.sys.mjs",
"MediaUtils.sys.mjs",
"Messaging.sys.mjs",
]
XPCSHELL_TESTS_MANIFESTS += ["test/xpcshell/xpcshell.toml"]

Просмотреть файл

@ -10,9 +10,4 @@ with Files("**"):
DIRS += [
"geckoview",
"test",
]
EXTRA_JS_MODULES += [
"dbg-browser-actors.js",
]

Просмотреть файл

@ -75,8 +75,7 @@ DIRS += [
]
DIRS += [
"actors",
"chrome",
"../shared",
"components",
"modules",
"themes/geckoview",

Просмотреть файл

@ -7,5 +7,5 @@
"id": "test-runner-support@tests.mozilla.org"
}
},
"description": "This extension pretends to be the sender of native messages from tests. See mobile/android/modules/test/AppUiTestDelegate.sys.mjs for actual usage."
"description": "This extension pretends to be the sender of native messages from tests. See mobile/shared/modules/test/AppUiTestDelegate.sys.mjs for actual usage."
}

Просмотреть файл

@ -11,7 +11,7 @@ import org.json.JSONObject;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.WebExtension;
// Receives API calls via mobile/android/modules/test/AppUiTestDelegate.sys.mjs
// Receives API calls via mobile/shared/modules/test/AppUiTestDelegate.sys.mjs
// and forwards the calls to the Api impl.
//
// This interface allows JS/HTML-based mochitests to invoke test-only logic

Просмотреть файл

@ -9,3 +9,7 @@ CONFIGURE_SUBST_FILES += ["installer/Makefile"]
with Files("**"):
BUG_COMPONENT = ("Core", "General")
SCHEDULES.exclusive = ["ios"]
DIRS += [
"../shared",
]

Просмотреть файл

@ -0,0 +1,73 @@
/* 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/. */
"use strict";
const {
globals,
} = require("../../toolkit/components/extensions/parent/.eslintrc.js");
module.exports = {
overrides: [
{
files: ["components/extensions/ext-*.js"],
excludedFiles: ["components/extensions/ext-c-*.js"],
globals: {
...globals,
// These globals are defined in ext-android.js and can only be used in
// the extension files that run in the parent process.
EventDispatcher: true,
ExtensionError: true,
makeGlobalEvent: true,
TabContext: true,
tabTracker: true,
windowTracker: true,
},
},
{
files: [
"chrome/geckoview/**",
"components/geckoview/**",
"modules/geckoview/**",
"actors/**",
],
rules: {
"no-unused-vars": [
"error",
{
args: "none",
vars: "local",
varsIgnorePattern: "(debug|warn)",
},
],
"no-restricted-syntax": [
"error",
{
selector: `CallExpression > \
Identifier.callee[name = /^debug$|^warn$/]`,
message:
"Use debug and warn with template literals, e.g. debug `foo`;",
},
{
selector: `BinaryExpression[operator = '+'] > \
TaggedTemplateExpression.left > \
Identifier.tag[name = /^debug$|^warn$/]`,
message:
"Use only one template literal with debug/warn instead of concatenating multiple expressions,\n" +
" e.g. (debug `foo ${42} bar`) instead of (debug `foo` + 42 + `bar`)",
},
{
selector: `TaggedTemplateExpression[tag.type = 'Identifier'][tag.name = /^debug$|^warn$/] > \
TemplateLiteral.quasi CallExpression > \
MemberExpression.callee[object.type = 'Identifier'][object.name = 'JSON'] > \
Identifier.property[name = 'stringify']`,
message:
"Don't call JSON.stringify within debug/warn literals,\n" +
" e.g. (debug `foo=${foo}`) instead of (debug `foo=${JSON.stringify(foo)}`)",
},
],
},
},
],
};

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -57,7 +57,7 @@ add_task(async function test_downloads_event_page() {
totalBytes: 5,
};
// Mocks DownloadItem from mobile/android/components/extensions/ext-downloads.js
// Mocks DownloadItem from mobile/shared/components/extensions/ext-downloads.js
const downloadItem = {
byExtensionId: "download-onChanged@tests.mozilla.org",
byExtensionName: "Download",

Просмотреть файл

@ -126,7 +126,7 @@ add_task(async function testTabRemovalEvent() {
});
try {
const url = "http://example.com/mochitest/mobile/android/components/extensions/test/mochitest/context.html";
const url = "http://example.com/mochitest/mobile/shared/components/extensions/test/mochitest/context.html";
const tab = await browser.tabs.create({url: url});
await awaitLoad(tab.id);

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function testExecuteScript() {
await SpecialPowers.pushPrefEnv({
set: [["dom.security.https_first", false]],
});
const BASE = "http://mochi.test:8888/tests/mobile/android/components/extensions/test/mochitest/";
const BASE = "http://mochi.test:8888/tests/mobile/shared/components/extensions/test/mochitest/";
const URL = BASE + "file_iframe_document.html";
const win = window.open(URL);

Просмотреть файл

@ -14,7 +14,7 @@
"use strict";
add_task(async function testExecuteScriptAtOnUpdated() {
const BASE = "http://mochi.test:8888/tests/mobile/android/components/extensions/test/mochitest/";
const BASE = "http://mochi.test:8888/tests/mobile/shared/components/extensions/test/mochitest/";
const URL = BASE + "file_iframe_document.html";
// This is a regression test for bug 1325830.
// The bug (executeScript not completing any more) occurred when executeScript

Просмотреть файл

@ -31,7 +31,7 @@ add_task(async function testExecuteScript() {
async function background(DEBUG) {
let tab;
const BASE = "http://mochi.test:8888/tests/mobile/android/components/extensions/test/mochitest/";
const BASE = "http://mochi.test:8888/tests/mobile/shared/components/extensions/test/mochitest/";
const URL = BASE + "file_slowed_document.sjs";
const MAX_TRIES = 30;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше