mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Revert "LibWeb: Allow bypassing transient activation checks for tests"
This reverts commit e52c30cbd5
.
It's highly possible that this test was flaky on CI due to mixing units
of seconds and milliseconds in the transient activation calculation.
Revert the workaround for that commit in an attempt to avoid needless
ad-hoc behavior.
This commit is contained in:
parent
8d7a5afe58
commit
090dbac5a3
Notes:
sideshowbarker
2024-07-16 20:08:14 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/090dbac5a3 Pull-request: https://github.com/SerenityOS/serenity/pull/23336 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/nico
6 changed files with 14 additions and 22 deletions
|
@ -16,7 +16,10 @@
|
|||
|
||||
asyncTest((done) => {
|
||||
writeText(() => {
|
||||
internals.bypassNextTransientActivationTest = true;
|
||||
const button = document.getElementById("button");
|
||||
internals.dispatchUserActivatedEvent(button, new Event("mousedown"));
|
||||
button.dispatchEvent(new Event("click"));
|
||||
|
||||
writeText(done);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -134,7 +134,6 @@ void Window::visit_edges(JS::Cell::Visitor& visitor)
|
|||
visitor.visit(mime_type_object);
|
||||
visitor.visit(m_count_queuing_strategy_size_function);
|
||||
visitor.visit(m_byte_length_queuing_strategy_size_function);
|
||||
visitor.visit(m_internals);
|
||||
}
|
||||
|
||||
void Window::finalize()
|
||||
|
@ -606,14 +605,6 @@ bool Window::has_transient_activation() const
|
|||
// perceive the link between an interaction with the page and the page calling the activation-gated API.
|
||||
static constexpr HighResolutionTime::DOMHighResTimeStamp transient_activation_duration_ms = 5000;
|
||||
|
||||
// AD-HOC: Due to resource limitations on CI, we cannot rely on the time between the activation timestamp and the
|
||||
// transient activation timeout being predictable. So we allow tests to indicate when they want the next
|
||||
// check for a user gesture to succeed.
|
||||
if (m_internals && m_internals->bypass_next_transient_activation_test()) {
|
||||
m_internals->set_bypass_next_transient_activation_test(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// When the current high resolution time given W
|
||||
auto unsafe_shared_time = HighResolutionTime::unsafe_shared_current_time();
|
||||
auto current_time = HighResolutionTime::relative_high_resolution_time(unsafe_shared_time, realm().global_object());
|
||||
|
@ -822,11 +813,8 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
|
|||
|
||||
if (s_inspector_object_exposed)
|
||||
define_direct_property("inspector", heap().allocate<Internals::Inspector>(realm, realm), JS::default_attributes);
|
||||
|
||||
if (s_internals_object_exposed) {
|
||||
m_internals = heap().allocate<Internals::Internals>(realm, realm);
|
||||
define_direct_property("internals", m_internals, JS::default_attributes);
|
||||
}
|
||||
if (s_internals_object_exposed)
|
||||
define_direct_property("internals", heap().allocate<Internals::Internals>(realm, realm), JS::default_attributes);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -287,8 +287,6 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-window-status
|
||||
// When the Window object is created, the attribute must be set to the empty string. It does not do anything else.
|
||||
String m_status;
|
||||
|
||||
JS::GCPtr<Internals::Internals> m_internals;
|
||||
};
|
||||
|
||||
void run_animation_frame_callbacks(DOM::Document&, double now);
|
||||
|
|
|
@ -89,4 +89,10 @@ void Internals::wheel(double x, double y, double delta_x, double delta_y)
|
|||
page.handle_mousewheel({ x, y }, { x, y }, 0, 0, 0, delta_x, delta_y);
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<bool> Internals::dispatch_user_activated_event(DOM::EventTarget& target, DOM::Event& event)
|
||||
{
|
||||
event.set_is_trusted(true);
|
||||
return target.dispatch_event(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,14 +28,11 @@ public:
|
|||
void click(double x, double y);
|
||||
void wheel(double x, double y, double delta_x, double delta_y);
|
||||
|
||||
bool bypass_next_transient_activation_test() const { return m_bypass_next_transient_activation_test; }
|
||||
void set_bypass_next_transient_activation_test(bool bypass_next_transient_activation_test) { m_bypass_next_transient_activation_test = bypass_next_transient_activation_test; }
|
||||
WebIDL::ExceptionOr<bool> dispatch_user_activated_event(DOM::EventTarget&, DOM::Event& event);
|
||||
|
||||
private:
|
||||
explicit Internals(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
bool m_bypass_next_transient_activation_test { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,6 @@
|
|||
undefined click(double x, double y);
|
||||
undefined wheel(double x, double y, double deltaX, double deltaY);
|
||||
|
||||
attribute boolean bypassNextTransientActivationTest;
|
||||
boolean dispatchUserActivatedEvent(EventTarget target, Event event);
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue