/* * Copyright (c) 2022, Andrew Kaster * Copyright (c) 2022, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include #include namespace Web::HTML { JS::NonnullGCPtr Navigator::create(JS::Realm& realm) { return realm.heap().allocate(realm, realm).release_allocated_value_but_fixme_should_propagate_errors(); } Navigator::Navigator(JS::Realm& realm) : PlatformObject(realm) { } Navigator::~Navigator() = default; JS::ThrowCompletionOr Navigator::initialize(JS::Realm& realm) { MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype(realm, "Navigator")); return {}; } // https://w3c.github.io/webdriver/#dfn-webdriver bool Navigator::webdriver() const { // Returns true if webdriver-active flag is set, false otherwise. // NOTE: The NavigatorAutomationInformation interface should not be exposed on WorkerNavigator. auto const& window = verify_cast(HTML::current_global_object()); return window.page()->is_webdriver_active(); } }