mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
LibWeb: Implement navigator.{plugins,mimeTypes}
This commit is contained in:
parent
5e422bdae0
commit
4d0277cd9a
20 changed files with 767 additions and 4 deletions
|
@ -39,7 +39,7 @@ JS::ThrowCompletionOr<void> Navigator::initialize(JS::Realm& realm)
|
|||
bool Navigator::pdf_viewer_enabled() const
|
||||
{
|
||||
// The NavigatorPlugins mixin's pdfViewerEnabled getter steps are to return the user agent's PDF viewer supported.
|
||||
// NOTE: THe NavigatorPlugins mixin should only be exposed on the Window object.
|
||||
// NOTE: The NavigatorPlugins mixin should only be exposed on the Window object.
|
||||
auto const& window = verify_cast<HTML::Window>(HTML::current_global_object());
|
||||
return window.page()->pdf_viewer_supported();
|
||||
}
|
||||
|
@ -54,4 +54,25 @@ bool Navigator::webdriver() const
|
|||
return window.page()->is_webdriver_active();
|
||||
}
|
||||
|
||||
void Navigator::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_mime_type_array);
|
||||
visitor.visit(m_plugin_array);
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<JS::NonnullGCPtr<MimeTypeArray>> Navigator::mime_types()
|
||||
{
|
||||
if (!m_mime_type_array)
|
||||
m_mime_type_array = TRY(heap().allocate<MimeTypeArray>(realm(), realm()));
|
||||
return *m_mime_type_array;
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<JS::NonnullGCPtr<PluginArray>> Navigator::plugins()
|
||||
{
|
||||
if (!m_plugin_array)
|
||||
m_plugin_array = TRY(heap().allocate<PluginArray>(realm(), realm()));
|
||||
return *m_plugin_array;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue