Open Bug 1562052 Opened 5 years ago Updated 25 days ago

[Mac] Add native theme for Mac that avoids native theming system calls

Categories

(Core :: Widget: Cocoa, defect, P2)

67 Branch
Unspecified
macOS
defect

Tracking

()

People

(Reporter: haik, Unassigned)

References

(Blocks 1 open bug)

Details

Similarly to the work on bug 1381938 for Windows, on Mac we also need to avoid some API's used by theming for sandboxing purposes. Specifically, to remove access launchservices in the Mac sandbox. With access to launchservices removed from the content sandbox (and some other changes to bypass crashes) we hit the following crash with _RegisterApplication() trying to connect to launchservices.

(lldb) 
* thread #1, name = 'MainThread', queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0 libsystem_kernel.dylib`__pthread_kill() 
    frame #1 libsystem_pthread.dylib`pthread_kill() 
    frame #2 libsystem_c.dylib`abort() 
    frame #3 HIServices`_RegisterApplication() 
    frame #4 HIServices`GetCurrentProcess() 
    frame #5 HIToolbox`MenuBarInstance::GetAggregateUIMode() 
    frame #6 AppKit`_NSScreenConfigurationUpdateSharedInfoForReason() 
    frame #7 AppKit`___NSScreenConfigurationEnsureInitialUpdateOccurred_block_invoke() 
    frame #8 libdispatch.dylib`_dispatch_client_callout() 
    frame #9 libdispatch.dylib`_dispatch_once_callout() 
    frame #10 AppKit`+[_NSScreenConfiguration latestGreatestBackingScaleFactor]() 
    frame #11 AppKit`-[NSView _transformToBackingUsingIntegralizationSpace:]() 
    frame #12 AppKit`-[NSView _primitiveConvertPointToBacking:useIntegralizationSpace:]() 
    frame #13 AppKit`__41-[NSTableView _cacheTableColumnPositions]_block_invoke() 
    frame #14 CoreFoundation`-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]() 
    frame #15 AppKit`-[NSTableView _cacheTableColumnPositions]() 
    frame #16 AppKit`-[NSTableView _minTableWidth]() 
    frame #17 AppKit`-[NSTableView _minimumFrameSize]() 
    frame #18 AppKit`-[NSTableView tile]() 
    frame #19 AppKit`-[NSTableView frame]() 
    frame #20 AppKit`-[NSTableView setFrameSize:]() 
    frame #21 AppKit`-[NSTableView _tileAndRedisplayAll]() 
    frame #22 AppKit`-[NSTableView addTableColumn:]() 
    frame #23 AppKit`-[NSComboBoxCell initPopUpWindow]() 
    frame #24 AppKit`-[NSComboBoxCell initTextCell:]() 
    frame #25 XUL`nsNativeThemeCocoa::nsNativeThemeCocoa() at nsNativeThemeCocoa.mm:488
    frame #26 XUL`do_GetNativeTheme() at nsNativeThemeCocoa.mm:444
    frame #27 XUL`do_GetNativeTheme() at nsNativeThemeCocoa.mm:4495
    frame #28 XUL`nsBox::nsBox() at nsBox.cpp:64
    frame #29 XUL`nsFrame::nsFrame() at nsFrame.cpp:479
    frame #30 XUL`NS_NewViewportFrame() at nsSplittableFrame.h:79
    frame #31 XUL`NS_NewViewportFrame() at nsContainerFrame.h:473
    frame #32 XUL`NS_NewViewportFrame() at ViewportFrame.h:89
    frame #33 XUL`NS_NewViewportFrame() at ViewportFrame.h:89
    frame #34 XUL`NS_NewViewportFrame() at ViewportFrame.h:35
    frame #35 XUL`NS_NewViewportFrame() at ViewportFrame.cpp:31
    frame #36 XUL`nsCSSFrameConstructor::ConstructRootFrame() at nsCSSFrameConstructor.cpp:2468
    frame #37 XUL`mozilla::PresShell::Initialize() at PresShell.cpp:1738
    frame #38 XUL`nsContentSink::StartLayout() at nsContentSink.cpp:1206
    frame #39 XUL`nsContentSink::StyleSheetLoaded() at nsContentSink.cpp:246
    frame #40 XUL`mozilla::css::Loader::SheetComplete() at Loader.cpp:1649
    frame #41 XUL`mozilla::MozPromise<bool, bool, true>::ThenValue<mozilla::css::Loader::ParseSheet(nsTSubstring<char> const&, mozilla::css::SheetLoadData*, mozilla::css::Loader::AllowAsyncParse)::$_18, mozilla::css::Loader::ParseSheet(nsTSubstring<char> const&, mozilla::css::SheetLoadData*, mozilla::css::Loader::AllowAsyncParse)::$_19>::DoResolveOrRejectInternal() at Loader.cpp:1605
    frame #42 XUL`mozilla::MozPromise<bool, bool, true>::ThenValue<mozilla::css::Loader::ParseSheet(nsTSubstring<char> const&, mozilla::css::SheetLoadData*, mozilla::css::Loader::AllowAsyncParse)::$_18, mozilla::css::Loader::ParseSheet(nsTSubstring<char> const&, mozilla::css::SheetLoadData*, mozilla::css::Loader::AllowAsyncParse)::$_19>::DoResolveOrRejectInternal() at MozPromise.h:503
    frame #43 XUL`mozilla::MozPromise<bool, bool, true>::ThenValue<mozilla::css::Loader::ParseSheet(nsTSubstring<char> const&, mozilla::css::SheetLoadData*, mozilla::css::Loader::AllowAsyncParse)::$_18, mozilla::css::Loader::ParseSheet(nsTSubstring<char> const&, mozilla::css::SheetLoadData*, mozilla::css::Loader::AllowAsyncParse)::$_19>::DoResolveOrRejectInternal() at MozPromise.h:535
    frame #44 XUL`mozilla::MozPromise<bool, bool, true>::ThenValue<mozilla::css::Loader::ParseSheet(nsTSubstring<char> const&, mozilla::css::SheetLoadData*, mozilla::css::Loader::AllowAsyncParse)::$_18, mozilla::css::Loader::ParseSheet(nsTSubstring<char> const&, mozilla::css::SheetLoadData*, mozilla::css::Loader::AllowAsyncParse)::$_19>::DoResolveOrRejectInternal() at MozPromise.h:717
    frame #45 XUL`mozilla::MozPromise<bool, bool, true>::ThenValueBase::ResolveOrRejectRunnable::Run() at MozPromise.h:393
    frame #46 XUL`mozilla::SchedulerGroup::Runnable::Run() at SchedulerGroup.cpp:295
    frame #47 XUL`nsThread::ProcessNextEvent() at nsThread.cpp:1215
    frame #48 XUL`NS_ProcessNextEvent() at nsThreadUtils.cpp:486
    frame #49 XUL`mozilla::ipc::MessagePump::Run() at MessagePump.cpp:88
    frame #50 XUL`MessageLoop::Run() at message_loop.cc:315
    frame #51 XUL`MessageLoop::Run() at message_loop.cc:308
    frame #52 XUL`MessageLoop::Run() at message_loop.cc:290
    frame #53 XUL`nsBaseAppShell::Run() at nsBaseAppShell.cpp:137
    frame #54 XUL`nsAppShell::Run() at nsAppShell.mm:704
    frame #55 XUL`XRE_RunAppShell() at nsEmbedFunctions.cpp:919
    frame #56 XUL`MessageLoop::Run() at message_loop.cc:315
    frame #57 XUL`MessageLoop::Run() at message_loop.cc:308
    frame #58 XUL`MessageLoop::Run() at message_loop.cc:290
    frame #59 XUL`XRE_InitChildProcess() at nsEmbedFunctions.cpp:754
    frame #60 plugin-container`main() at plugin-container.cpp:56
    frame #61 plugin-container`main() at MozillaRuntimeMain.cpp:23
    frame #62 libdyld.dylib`start() 
    frame #63 libdyld.dylib`start()
Blocks: 1504554

My next patch for bug 1381938 will include an option to enable a basic theme across all platforms that should avoid system calls. I'm expecting to have this uploaded soon.

Priority: -- → P1
Priority: P1 → P2
Severity: normal → S3

Most of this will be addressed by bug 1690842. I believe it makes sense to keep this bug open in case there is any additional work that needs to occur before this is completely addressed.

Depends on: 1690842
You need to log in before you can comment on or make changes to this bug.