Hide the text recognition context menu if the macOS version doesn't support APIs
Categories
(Core :: DOM: Core & HTML, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox105 | --- | fixed |
People
(Reporter: gregtatum, Assigned: gregtatum)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
In older mac OS versions, the context menu will be there, but not work. We need to provide a way to determine if the API is actually available before showing user the option. Right now it's just a platform specific preference.
Assignee | ||
Comment 1•2 years ago
|
||
:emilio I have some fairly simple C++ code to determine if the text recognition APIs are available.
#ifdef XP_MACOSX
bool TextRecognition::IsSupported() {
return nsCocoaFeatures::OnCatalinaOrLater();
}
#else
bool TextRecognition::IsSupported() {
return false;
}
#endif
Do you have a recommendation where I can put this? I don't think putting it in dom/webidl/HTMLImageElement.webidl
next to recognizeCurrentImageText()
is an appropriate place, since I'd have to call out to the content process from the parent process, or create a dummy image element in the parent process.
Do you have a recommendation of where I could wire this up so I can call it from nsContextMenu.js
?
Comment 2•2 years ago
|
||
ChromeUtils.webidl
or nsIXULRuntime.idl
(which you can access via Services.appinfo
) seem like decent options to put this.
Assignee | ||
Comment 3•2 years ago
|
||
This code path gets executed by existing tests, and I don't believe
there is a way to execute this behavior using our CI, since it's a macOS
version check.
Depends on D153668
Pushed by gtatum@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5f860613e76d Only show the macOS context menu if it is supported; r=nordzilla
Comment 5•2 years ago
|
||
bugherder |
Description
•