ma1 pushed to branch mullvad-browser-153.7.0esr-16.0-1 at The Tor Project / Applications / Mullvad Browser Commits: 434c77a2 by Jeff Boek at 2026-11-09T10:39:10+01:00 Bug 1991276 - Only fill based on the currently focused node r=geckoview-reviewers,owlish Differential Revision: https://phabricator.services.mozilla.com/D272949 - - - - - 89fe8d45 by pollymce at 2026-11-09T10:39:11+01:00 Bug 2074123 - show recording notification for custom tabs as well as regular tabs. r=android-reviewers,mcarare Differential Revision: https://phabricator.services.mozilla.com/D332436 - - - - - e74a7d7a by Emilio Cobos Álvarez at 2026-11-09T10:39:11+01:00 Bug 2077035 - Remove untested and dubious visitedWeight target radius. r=masayuki I don't think it's worth it. It's pretty dubious to favor a visited link in that way anyway, specially in the modern web where lots of links are used as buttons and so on. It's also totally untested. Differential Revision: https://phabricator.services.mozilla.com/D332153 - - - - - 2d3db03e by Nicolas Silva at 2026-11-09T10:39:12+01:00 Bug 2081249 - Handle empty profile shmems from child processes in nsProfiler::StartGathering. r=profiler-reviewers,canova Differential Revision: https://phabricator.services.mozilla.com/D333246 - - - - - 39c0db5e by Nicolas Silva at 2026-11-09T10:39:12+01:00 Bug 2081249 - Bound the time CanvasTranslator::CheckAndSignalWriter waits for the writer to leave the AboutToWait state. r=gfx-reviewers,gw Differential Revision: https://phabricator.services.mozilla.com/D333248 - - - - - 7cbf6257 by Emilio Cobos Álvarez at 2026-11-09T10:39:13+01:00 Bug 2083733. r=arai Differential Revision: https://phabricator.services.mozilla.com/D335409 - - - - - 17 changed files: - gfx/layers/ipc/CanvasTranslator.cpp - layout/base/PositionedEventTargeting.cpp - layout/base/tests/test_event_target_radius.html - layout/style/Loader.cpp - mobile/android/android-components/components/feature/media/src/main/java/mozilla/components/feature/media/middleware/RecordingDevicesMiddleware.kt - mobile/android/android-components/components/feature/media/src/test/java/mozilla/components/feature/media/middleware/RecordingDevicesMiddlewareTest.kt - mobile/android/geckoview/src/androidTest/assets/www/forms_iframe.html - mobile/android/geckoview/src/androidTest/assets/www/forms_xorigin.html - mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoViewTest.kt - mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java - modules/libpref/init/StaticPrefList.yaml - + testing/web-platform/tests/resource-timing/no-entries-for-cached-import-of-cross-origin-css.html - + testing/web-platform/tests/resource-timing/resources/cacheable-import-child.css - + testing/web-platform/tests/resource-timing/resources/cacheable-import-child.css.headers - + testing/web-platform/tests/resource-timing/resources/no-store-importer.sub.css - + testing/web-platform/tests/resource-timing/resources/no-store-importer.sub.css.headers - tools/profiler/gecko/nsProfiler.cpp Changes: ===================================== gfx/layers/ipc/CanvasTranslator.cpp ===================================== @@ -660,6 +660,8 @@ void CanvasTranslator::BlockCanvas() { } void CanvasTranslator::CheckAndSignalWriter() { + uint32_t spinCount = mMaxSpinCount; + TimeStamp deadline; do { switch (mHeader->writerState) { case State::Processing: @@ -672,6 +674,20 @@ void CanvasTranslator::CheckAndSignalWriter() { if (mIPDLClosed) { return; } + if (spinCount > 0) { + --spinCount; + continue; + } + // The writer only stays in this state for a few instructions, so if it + // does not move on in a reasonable time it is misbehaving. + if (deadline.IsNull()) { + deadline = TimeStamp::Now() + TimeDuration::FromSeconds(1); + } else if (TimeStamp::Now() > deadline) { + gfxCriticalNote << "CanvasTranslator writer stuck in AboutToWait"; + Deactivate(); + return; + } + PR_Sleep(PR_INTERVAL_NO_WAIT); continue; case State::Waiting: if (mHeader->processedCount >= mHeader->writerWaitCount) { ===================================== layout/base/PositionedEventTargeting.cpp ===================================== @@ -104,8 +104,7 @@ enum class SearchType { }; struct EventRadiusPrefs { - bool mEnabled; // other fields are valid iff this field is true - uint32_t mVisitedWeight; // in percent, i.e. default is 100 + bool mEnabled; // other fields are valid iff this field is true uint32_t mRadiusTopmm; uint32_t mRadiusRightmm; uint32_t mRadiusBottommm; @@ -117,7 +116,6 @@ struct EventRadiusPrefs { explicit EventRadiusPrefs(WidgetGUIEvent* aMouseOrTouchEvent) { if (aMouseOrTouchEvent->mClass == eTouchEventClass) { mEnabled = StaticPrefs::ui_touch_radius_enabled(); - mVisitedWeight = StaticPrefs::ui_touch_radius_visitedWeight(); mRadiusTopmm = StaticPrefs::ui_touch_radius_topmm(); mRadiusRightmm = StaticPrefs::ui_touch_radius_rightmm(); mRadiusBottommm = StaticPrefs::ui_touch_radius_bottommm(); @@ -138,7 +136,6 @@ struct EventRadiusPrefs { } else if (aMouseOrTouchEvent->mClass == eMouseEventClass) { mEnabled = StaticPrefs::ui_mouse_radius_enabled(); - mVisitedWeight = StaticPrefs::ui_mouse_radius_visitedWeight(); mRadiusTopmm = StaticPrefs::ui_mouse_radius_topmm(); mRadiusRightmm = StaticPrefs::ui_mouse_radius_rightmm(); mRadiusBottommm = StaticPrefs::ui_mouse_radius_bottommm(); @@ -149,7 +146,6 @@ struct EventRadiusPrefs { } else { mEnabled = false; - mVisitedWeight = 0; mRadiusTopmm = 0; mRadiusRightmm = 0; mRadiusBottommm = 0; @@ -697,17 +693,6 @@ static nsIFrame* GetClosest(RelativeTo aRoot, // distance is in appunit double distance = ComputeDistanceFromRegion(aPointRelativeToRootFrame, region); - nsIContent* content = f->GetContent(); - // XXX Well, some users may want to tap unvisited link, however, some other - // users may not. For example, click a link, and go back, then, want to go - // forward, but click the visited link instead. This scenario may occur if - // clicking the link is easier to do "go forward" and I think it's true for - // the most users. So, it might be better to do this. - if (content && content->IsElement() && - content->AsElement()->State().HasState( - ElementState(ElementState::VISITED))) { - distance *= aPrefs.mVisitedWeight / 100.0; - } // XXX When we look for a touchable or clickable target, should we give // lower weight for clickable target? if (distance < bestDistance) { ===================================== layout/base/tests/test_event_target_radius.html ===================================== @@ -122,8 +122,8 @@ function startTest() { ["ui.mouse.radius.leftmm", 12], ["ui.mouse.radius.topmm", 4], ["ui.mouse.radius.rightmm", 4], - ["ui.mouse.radius.bottommm", 4], - ["ui.mouse.radius.visitedweight", 50]]}, runTest); + ["ui.mouse.radius.bottommm", 4] + ]}, runTest); } @@ -484,7 +484,6 @@ function test3() { setShowing("t3_6", false); // Not yet tested: - // -- visited link weight // -- "Closest" using Euclidean distance @@ -493,8 +492,8 @@ function test3() { ["ui.touch.radius.leftmm", 12], ["ui.touch.radius.topmm", 4], ["ui.touch.radius.rightmm", 4], - ["ui.touch.radius.bottommm", 4], - ["ui.touch.radius.visitedweight", 50]]}, testTouchable); + ["ui.touch.radius.bottommm", 4] + ]}, testTouchable); } async function testTouchable() { ===================================== layout/style/Loader.cpp ===================================== @@ -1548,14 +1548,13 @@ Loader::Completed Loader::ParseSheet( void Loader::AddPerformanceEntryForCachedSheet(SheetLoadData& aLoadData) { MOZ_ASSERT(aLoadData.mURI); - - if (!aLoadData.mNetworkMetadata) { + if (!mDocument || !aLoadData.mNetworkMetadata) { return; } - if (!mDocument) { + if (aLoadData.mParentData && + !aLoadData.mParentData->mSheet->IsOriginClean()) { return; } - nsAutoCString name; aLoadData.mURI->GetSpec(name); NS_ConvertUTF8toUTF16 entryName(name); ===================================== mobile/android/android-components/components/feature/media/src/main/java/mozilla/components/feature/media/middleware/RecordingDevicesMiddleware.kt ===================================== @@ -70,11 +70,12 @@ class RecordingDevicesMiddleware( store: Store<BrowserState, BrowserAction>, isReminder: Boolean, ) { - val devices = store.state.tabs - .map { tab -> tab.content.recordingDevices } - .flatten() - .filter { device -> device.status == RecordingDevice.Status.RECORDING } - .distinctBy { device -> device.type } + val devices = + (store.state.tabs + store.state.customTabs) + .map { tab -> tab.content.recordingDevices } + .flatten() + .filter { device -> device.status == RecordingDevice.Status.RECORDING } + .distinctBy { device -> device.type } val isUsingCamera = devices.find { it.type == RecordingDevice.Type.CAMERA } != null val isUsingMicrophone = devices.find { it.type == RecordingDevice.Type.MICROPHONE } != null ===================================== mobile/android/android-components/components/feature/media/src/test/java/mozilla/components/feature/media/middleware/RecordingDevicesMiddlewareTest.kt ===================================== @@ -12,7 +12,9 @@ import android.content.IntentFilter import androidx.core.app.NotificationManagerCompat import androidx.test.ext.junit.runners.AndroidJUnit4 import mozilla.components.browser.state.action.ContentAction +import mozilla.components.browser.state.action.CustomTabListAction import mozilla.components.browser.state.state.BrowserState +import mozilla.components.browser.state.state.createCustomTab import mozilla.components.browser.state.state.createTab import mozilla.components.browser.state.store.BrowserStore import mozilla.components.concept.engine.media.RecordingDevice @@ -131,4 +133,65 @@ class RecordingDevicesMiddlewareTest { assertEquals(0, notificationManager.size()) } + + @Test + fun `middleware shows notification when custom tab has a recording device then hides when recording devices become inactive`() { + val realNotificationManager = testContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + val notificationManager = Shadows.shadowOf(realNotificationManager) + + val middleware = RecordingDevicesMiddleware(testContext, notificationsDelegate) + val store = + BrowserStore( + initialState = + BrowserState(customTabs = listOf(createCustomTab("https://www.mozilla.org", id = "mozilla"))), + middleware = listOf(middleware), + ) + + assertEquals(0, notificationManager.size()) + + store.dispatch( + ContentAction.SetRecordingDevices( + sessionId = "mozilla", + devices = listOf(RecordingDevice(RecordingDevice.Type.MICROPHONE, RecordingDevice.Status.RECORDING)), + ) + ) + + assertEquals(1, notificationManager.size()) + + store.dispatch( + ContentAction.SetRecordingDevices( + sessionId = "mozilla", + devices = emptyList(), + ) + ) + + assertEquals(0, notificationManager.size()) + } + + @Test + fun `middleware hides notification when a recording custom tab is removed`() { + val realNotificationManager = testContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + val notificationManager = Shadows.shadowOf(realNotificationManager) + + val middleware = RecordingDevicesMiddleware(testContext, notificationsDelegate) + val store = + BrowserStore( + initialState = + BrowserState(customTabs = listOf(createCustomTab("https://www.mozilla.org", id = "mozilla"))), + middleware = listOf(middleware), + ) + + store.dispatch( + ContentAction.SetRecordingDevices( + sessionId = "mozilla", + devices = listOf(RecordingDevice(RecordingDevice.Type.MICROPHONE, RecordingDevice.Status.RECORDING)), + ) + ) + + assertEquals(1, notificationManager.size()) + + store.dispatch(CustomTabListAction.RemoveCustomTabAction(tabId = "mozilla")) + + assertEquals(0, notificationManager.size()) + } } ===================================== mobile/android/geckoview/src/androidTest/assets/www/forms_iframe.html ===================================== @@ -52,6 +52,10 @@ window.addEventListener("message", async event => { const { data, source, origin } = event; + if (data.type == "getValue") { + source.postMessage(document.querySelector(data.key).value, origin); + return; + } source.postMessage(await getData(data.key, data.value), origin); }); </script> ===================================== mobile/android/geckoview/src/androidTest/assets/www/forms_xorigin.html ===================================== @@ -73,5 +73,15 @@ data.push(getData(key, value)); return Promise.all(data); }; + + window.getIframeValue = function (key) { + const value = new Promise(resolve => + window.addEventListener("message", event => resolve(event.data), { + once: true, + }) + ); + iframe.postMessage({ type: "getValue", key }, "*"); + return value; + }; </script> </html> ===================================== mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoViewTest.kt ===================================== @@ -336,21 +336,24 @@ class GeckoViewTest : BaseSessionTest() { val autofills = mapOf( "#user1" to "username@example.com", - "#user2" to "username@example.com", "#pass1" to "test-password", - "#pass2" to "test-password", ) + val notFilled = listOf("#user2", "#pass2") + + // Only the form containing the focused field is filled. + val promises = autofills.map { entry -> + mainSession.evaluatePromiseJS( + """ + getData('${entry.key}', '${entry.value}') + """ + ) + } - // Set up promises to monitor the values changing. - val promises = - autofills.map { entry -> - // Repeat each test with both the top document and the iframe document. - mainSession.evaluatePromiseJS( - """ - window.getDataForAllFrames('${entry.key}', '${entry.value}') - """, - ) - } + mainSession.evaluateJS("document.querySelector('#user1').focus()") + UiThreadUtils.waitForCondition( + { mainSession.autofillSession.focused != null }, + env.defaultTimeoutMillis, + ) activityRule.scenario.onActivity { val root = MockViewStructure(View.NO_ID) @@ -374,19 +377,33 @@ class GeckoViewTest : BaseSessionTest() { it.view.setSession(session) // Wait on the promises and check for correct values. - for (values in promises.map { p -> p.value.asJsonArray() }) { - for (i in 0 until values.length()) { - val (key, actual, expected, eventInterface) = values.get(i).asJSList<String>() - - assertThat("Auto-filled value must match ($key)", actual, equalTo(expected)) - assertThat( - "input event should be dispatched with InputEvent interface", - eventInterface, - equalTo("InputEvent"), - ) - } + for (values in promises.map { p -> p.value.asJSList<String>() }) { + val (key, actual, expected, eventInterface) = values + + assertThat("Auto-filled value must match ($key)", actual, equalTo(expected)) + assertThat( + "input event should be dispatched with InputEvent interface", + eventInterface, + equalTo("InputEvent"), + ) } } + + for (key in autofills.keys + notFilled) { + assertThat( + "Field in the unfocused iframe must not be filled ($key)", + mainSession.evaluatePromiseJS("window.getIframeValue('$key')").value as String, + equalTo("foo"), + ) + } + + for (key in notFilled) { + assertThat( + "Field outside the focused form must not be filled ($key)", + mainSession.evaluateJS("document.querySelector('$key').value") as String, + equalTo("foo"), + ) + } } @Test ===================================== mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java ===================================== @@ -466,7 +466,9 @@ public class Autofill { public void fillViewStructure( @NonNull final View view, @NonNull final ViewStructure structure, final int flags) { ThreadUtils.assertOnUiThread(); - fillViewStructure(getRoot(), view, structure, flags); + final Node focused = getFocused(); + final Node root = focused != null ? focused.getRoot() : null; + fillViewStructure(root != null ? root : getRoot(), view, structure, flags); } /** ===================================== modules/libpref/init/StaticPrefList.yaml ===================================== @@ -19586,10 +19586,6 @@ # dispatched to nearby elements that are sensitive to the event. See # PositionedEventTargeting.cpp. The 'mm' prefs define a rectangle around the # nominal event target point within which we will search for suitable elements. -# 'visitedWeight' is a percentage weight; a value > 100 makes a visited link be -# treated as further away from the event target than it really is, while a -# value < 100 makes a visited link be treated as closer to the event target -# than it really is. - name: ui.touch.radius.enabled type: bool @@ -19639,11 +19635,6 @@ value: true mirror: always -- name: ui.touch.radius.visitedWeight - type: uint32_t - value: 120 - mirror: always - - name: ui.mouse.radius.enabled type: bool value: @IS_ANDROID@ @@ -19685,11 +19676,6 @@ #endif mirror: always -- name: ui.mouse.radius.visitedWeight - type: uint32_t - value: 120 - mirror: always - - name: ui.mouse.radius.reposition type: bool value: @IS_ANDROID@ ===================================== testing/web-platform/tests/resource-timing/no-entries-for-cached-import-of-cross-origin-css.html ===================================== @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Resource timing entries for cached @import children of stylesheets</title> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=2083733"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="/common/utils.js"></script> +<body> +<script> +const {ORIGIN, HTTP_REMOTE_ORIGIN} = get_host_info(); +const RESOURCES = "/resource-timing/resources/"; + +async function loadInFrame(t, href) { + const iframe = document.createElement("iframe"); + iframe.srcdoc = `<link rel="stylesheet" href="${href}">`; + await new Promise(resolve => { + iframe.onload = resolve; + document.body.appendChild(iframe); + }); + t.add_cleanup(() => iframe.remove()); + return iframe.contentWindow; +} + +// The first load caches the child stylesheet, but not the parent, which is +// no-store, so the second load re-parses the parent and gets the child from +// the cache. +async function loadTwice(t, parentOrigin, childOrigin) { + const id = token(); + const child = `${childOrigin}${RESOURCES}cacheable-import-child.css?${id}`; + const parent = v => + `${parentOrigin}${RESOURCES}no-store-importer.sub.css?import=${encodeURIComponent(child)}&v=${v}`; + await loadInFrame(t, parent(1)); + const win = await loadInFrame(t, parent(2)); + await new Promise(resolve => t.step_timeout(resolve, 0)); + assert_equals(win.performance.getEntriesByName(parent(2)).length, 1, + "Parent stylesheet should be in the timeline"); + return win.performance.getEntriesByName(child).length; +} + +promise_test(async t => { + assert_equals(await loadTwice(t, HTTP_REMOTE_ORIGIN, HTTP_REMOTE_ORIGIN), 0); +}, "Cached @import children of cross-origin stylesheets are not in the timeline"); + +promise_test(async t => { + assert_equals(await loadTwice(t, ORIGIN, ORIGIN), 1); +}, "Cached same-origin @import children of same-origin stylesheets are in the timeline"); + +promise_test(async t => { + assert_equals(await loadTwice(t, ORIGIN, HTTP_REMOTE_ORIGIN), 1); +}, "Cached cross-origin @import children of same-origin stylesheets are in the timeline"); +</script> +</body> ===================================== testing/web-platform/tests/resource-timing/resources/cacheable-import-child.css ===================================== @@ -0,0 +1 @@ +.child { color: blue } ===================================== testing/web-platform/tests/resource-timing/resources/cacheable-import-child.css.headers ===================================== @@ -0,0 +1,2 @@ +Content-Type: text/css +Cache-Control: max-age=600 ===================================== testing/web-platform/tests/resource-timing/resources/no-store-importer.sub.css ===================================== @@ -0,0 +1 @@ +@import "{{GET[import]}}"; ===================================== testing/web-platform/tests/resource-timing/resources/no-store-importer.sub.css.headers ===================================== @@ -0,0 +1,2 @@ +Content-Type: text/css +Cache-Control: no-store ===================================== tools/profiler/gecko/nsProfiler.cpp ===================================== @@ -1320,8 +1320,11 @@ RefPtr<nsProfiler::GatheringPromise> nsProfiler::StartGathering( aEvent.append(Json::Value::UInt64(childPid)); aEvent.append(Json::Value::UInt64{profileShmem.Size<char>()}); }); + const size_t profileLength = + profileShmem.Size<char>() > 0 ? profileShmem.Size<char>() - 1 + : 0; const nsDependentCSubstring profileString( - profileShmem.get<char>(), profileShmem.Size<char>() - 1); + profileShmem.get<char>(), profileLength); if (profileString.IsEmpty() || profileString[0] != '*') { self->GatheredOOPProfile( childPid, profileString, View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/82f... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/82f... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
ma1 (@ma1)