diff --git a/components/servo/tests/common/mod.rs b/components/servo/tests/common/mod.rs index b2df4f13c1f..fd6e99df4da 100644 --- a/components/servo/tests/common/mod.rs +++ b/components/servo/tests/common/mod.rs @@ -143,6 +143,7 @@ pub(crate) struct WebViewDelegateImpl { pub(crate) url_changed: Cell, pub(crate) cursor_changed: Cell, pub(crate) new_frame_ready: Cell, + pub(crate) load_status_changed: Cell, } impl WebViewDelegateImpl { @@ -166,6 +167,12 @@ impl WebViewDelegate for WebViewDelegateImpl { self.new_frame_ready.set(true); webview.paint(); } + + fn notify_load_status_changed(&self, _webview: WebView, status: LoadStatus) { + if status == LoadStatus::Complete { + self.load_status_changed.set(true); + } + } } pub(crate) fn evaluate_javascript( diff --git a/components/servo/tests/multiprocess.rs b/components/servo/tests/multiprocess.rs index cbd1255d110..6dd8a84c6fe 100644 --- a/components/servo/tests/multiprocess.rs +++ b/components/servo/tests/multiprocess.rs @@ -32,7 +32,9 @@ fn test_multiprocess_preference_observer(servo_test: &ServoTest) -> Result<(), a prefs.dom_servo_helpers_enabled = true; prefs::set(prefs); + delegate.load_status_changed.set(false); webview.reload(); + let _ = servo_test.spin(move || Ok(!delegate.load_status_changed.get())); let result = evaluate_javascript(servo_test, webview.clone(), "window.gc"); ensure!(matches!(result, Ok(JSValue::Object(..))));