Closed Bug 1791281 Opened 12 days ago Closed 8 days ago

Remove mUsesFontMetricDependentFontUnits (move to rust's device)

Categories

(Core :: Layout: Positioned, defect)

defect

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

Bug 1790067 uncovered a subtle data race caused by our mUsesFontMetricDependentFontUnits bitfield. TSAN says:

[task 2022-09-17T18:57:12.983Z] 18:57:12     INFO - GECKO(1659) |     #37 nsXULPrototypeDocument::NotifyLoadDone() /builds/worker/checkouts/gecko/dom/xul/nsXULPrototypeDocument.cpp:419:5 (libxul.so+0x58c891e)
[task 2022-09-17T18:57:12.983Z] 18:57:12     INFO - GECKO(1659) |     #38 XULContentSinkImpl::DidBuildModel(bool) /builds/worker/checkouts/gecko/dom/xul/nsXULContentSink.cpp:176:17 (libxul.so+0x58b4cf0) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.984Z] 18:57:12     INFO - GECKO(1659) |     #39 DidBuildModel /builds/worker/checkouts/gecko/parser/htmlparser/nsParser.cpp:332:14 (libxul.so+0x219b96f) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.984Z] 18:57:12     INFO - GECKO(1659) |     #40 nsParser::ResumeParse(bool, bool, bool) /builds/worker/checkouts/gecko/parser/htmlparser/nsParser.cpp:767:11 (libxul.so+0x219b96f)
[task 2022-09-17T18:57:12.985Z] 18:57:12     INFO - GECKO(1659) |     #41 OnStopRequest /builds/worker/checkouts/gecko/parser/htmlparser/nsParser.cpp:1062:10 (libxul.so+0x219d7df) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.985Z] 18:57:12     INFO - GECKO(1659) |     #42 non-virtual thunk to nsParser::OnStopRequest(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/parser/htmlparser/nsParser.cpp (libxul.so+0x219d7df)
[task 2022-09-17T18:57:12.986Z] 18:57:12     INFO - GECKO(1659) |     #43 OnStopRequest /builds/worker/checkouts/gecko/parser/prototype/PrototypeDocumentParser.cpp:138:29 (libxul.so+0x218a3a6) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.986Z] 18:57:12     INFO - GECKO(1659) |     #44 non-virtual thunk to mozilla::parser::PrototypeDocumentParser::OnStopRequest(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/parser/prototype/PrototypeDocumentParser.cpp (libxul.so+0x218a3a6)
[task 2022-09-17T18:57:12.987Z] 18:57:12     INFO - GECKO(1659) |     #45 nsDocumentOpenInfo::OnStopRequest(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/uriloader/base/nsURILoader.cpp:216:15 (libxul.so+0x20f37d4) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.987Z] 18:57:12     INFO - GECKO(1659) |     #46 mozilla::net::ParentChannelWrapper::OnStopRequest(nsIRequest*, nsresult) /builds/worker/workspace/obj-build/dist/include/mozilla/net/ParentChannelWrapper.h:28:3 (libxul.so+0x1bcf9cb) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.988Z] 18:57:12     INFO - GECKO(1659) |     #47 OnStopRequest /builds/worker/checkouts/gecko/netwerk/protocol/http/ParentChannelListener.cpp:98:32 (libxul.so+0x1a43b79) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.988Z] 18:57:12     INFO - GECKO(1659) |     #48 non-virtual thunk to mozilla::net::ParentChannelListener::OnStopRequest(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/netwerk/protocol/http/ParentChannelListener.cpp (libxul.so+0x1a43b79)
[task 2022-09-17T18:57:12.989Z] 18:57:12     INFO - GECKO(1659) |     #49 nsDocumentOpenInfo::OnStopRequest(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/uriloader/base/nsURILoader.cpp:216:15 (libxul.so+0x20f37d4) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.989Z] 18:57:12     INFO - GECKO(1659) |     #50 nsJARChannel::OnStopRequest(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/modules/libjar/nsJARChannel.cpp:1269:16 (libxul.so+0x201440a) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.990Z] 18:57:12     INFO - GECKO(1659) |     #51 non-virtual thunk to nsJARChannel::OnStopRequest(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/modules/libjar/nsJARChannel.cpp (libxul.so+0x2017382) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.990Z] 18:57:12     INFO - GECKO(1659) |     #52 nsInputStreamPump::OnStateStop() /builds/worker/checkouts/gecko/netwerk/base/nsInputStreamPump.cpp:670:16 (libxul.so+0x13b3b01) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.991Z] 18:57:12     INFO - GECKO(1659) |     #53 nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) /builds/worker/checkouts/gecko/netwerk/base/nsInputStreamPump.cpp:395:21 (libxul.so+0x13b2b82) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.991Z] 18:57:12     INFO - GECKO(1659) |     #54 non-virtual thunk to nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) /builds/worker/checkouts/gecko/netwerk/base/nsInputStreamPump.cpp (libxul.so+0x13b3df9) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.992Z] 18:57:12     INFO - GECKO(1659) |     #55 operator() /builds/worker/checkouts/gecko/xpcom/io/nsPipe3.cpp:74:47 (libxul.so+0x119b5f1) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.993Z] 18:57:12     INFO - GECKO(1659) |     #56 already_AddRefed<mozilla::CancelableRunnable> NS_NewCancelableRunnableFunction<CallbackHolder::CallbackHolder(nsIAsyncInputStream*, nsIInputStreamCallback*, unsigned int, nsIEventTarget*)::'lambda'()>(char const*, CallbackHolder::CallbackHolder(nsIAsyncInputStream*, nsIInputStreamCallback*, unsigned int, nsIEventTarget*)::'lambda'()&&)::FuncCancelableRunnable::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:650:9 (libxul.so+0x119b5f1)
[task 2022-09-17T18:57:12.993Z] 18:57:12     INFO - GECKO(1659) |     #57 mozilla::RunnableTask::Run() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:538:16 (libxul.so+0x11fc837) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.994Z] 18:57:12     INFO - GECKO(1659) |     #58 mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:851:26 (libxul.so+0x11d2567) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.994Z] 18:57:12     INFO - GECKO(1659) |     #59 mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:683:15 (libxul.so+0x11d09d6) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.995Z] 18:57:12     INFO - GECKO(1659) |     #60 mozilla::TaskController::ProcessPendingMTTask(bool) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:461:36 (libxul.so+0x11d0cb4) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.995Z] 18:57:12     INFO - GECKO(1659) |     #61 operator() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:187:37 (libxul.so+0x1200617) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.996Z] 18:57:12     INFO - GECKO(1659) |     #62 mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5 (libxul.so+0x1200617)
[task 2022-09-17T18:57:12.996Z] 18:57:12     INFO - GECKO(1659) |     #63 nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1205:16 (libxul.so+0x11e6c12) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.997Z] 18:57:12     INFO - GECKO(1659) |     #64 NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:465:10 (libxul.so+0x11ed305) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.997Z] 18:57:12     INFO - GECKO(1659) |     #65 mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:85:21 (libxul.so+0x1e5677b) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.998Z] 18:57:12     INFO - GECKO(1659) |     #66 RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:381:10 (libxul.so+0x1d74e2c) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:12.998Z] 18:57:12     INFO - GECKO(1659) |     #67 RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:374:3 (libxul.so+0x1d74e2c)
[task 2022-09-17T18:57:12.999Z] 18:57:12     INFO - GECKO(1659) |     #68 MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:356:3 (libxul.so+0x1d74e2c)
[task 2022-09-17T18:57:12.999Z] 18:57:12     INFO - GECKO(1659) |     #69 nsBaseAppShell::Run() /builds/worker/checkouts/gecko/widget/nsBaseAppShell.cpp:150:27 (libxul.so+0x5c23416) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:13.000Z] 18:57:13     INFO - GECKO(1659) |     #70 nsAppStartup::Run() /builds/worker/checkouts/gecko/toolkit/components/startup/nsAppStartup.cpp:295:30 (libxul.so+0x853a603) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:13.001Z] 18:57:13     INFO - GECKO(1659) |     #71 XREMain::XRE_mainRun() /builds/worker/checkouts/gecko/toolkit/xre/nsAppRunner.cpp:5720:22 (libxul.so+0x866b9f7) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:13.001Z] 18:57:13     INFO - GECKO(1659) |     #72 XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) /builds/worker/checkouts/gecko/toolkit/xre/nsAppRunner.cpp:5913:8 (libxul.so+0x866c4b2) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:13.002Z] 18:57:13     INFO - GECKO(1659) |     #73 XRE_main(int, char**, mozilla::BootstrapConfig const&) /builds/worker/checkouts/gecko/toolkit/xre/nsAppRunner.cpp:5969:21 (libxul.so+0x866cb24) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:13.002Z] 18:57:13     INFO - GECKO(1659) |     #74 mozilla::BootstrapImpl::XRE_main(int, char**, mozilla::BootstrapConfig const&) /builds/worker/checkouts/gecko/toolkit/xre/Bootstrap.cpp:45:12 (libxul.so+0x8678ea2) (BuildId: 4104598d1a90341ac54817406d1e363ef79e8792)
[task 2022-09-17T18:57:13.003Z] 18:57:13     INFO - GECKO(1659) |     #75 do_main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:226:22 (firefox+0xe012f) (BuildId: d5a532d047ef3e5bfadb3d8c1e44eae3609b585d)
[task 2022-09-17T18:57:13.003Z] 18:57:13     INFO - GECKO(1659) |     #76 main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:430:16 (firefox+0xe012f)
[task 2022-09-17T18:57:13.004Z] 18:57:13     INFO - GECKO(1659) | SUMMARY: ThreadSanitizer: data race /builds/worker/checkouts/gecko/layout/base/nsPresContext.h:1066:39 in SetUsesFontMetricDependentFontUnits

We should just move that bit to Device like every other similar bits.

While looking at moving the flag around I realized that the only reason
we have FontMetricsProvider and co is because we didn't have access to
the per-document font-prefs cache. That's trivial to fix tho, so do
that and simplify the setup for font queries even more.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6168b847e821
Simplify our setup for font metric queries from style. r=jfkthame
Status: NEW → RESOLVED
Closed: 8 days ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.