feat_expose_documentloader_setdefersloading_on_webdocumentloader.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Samuel Attard <[email protected]>
  3. Date: Thu, 9 Mar 2023 01:28:56 -0800
  4. Subject: feat: expose DocumentLoader::SetDefersLoading on WebDocumentLoader
  5. This allows embedders to call SetDefersLoading without reaching into Blink internals. Electron uses this to defer page loading until the preload scripts have finished executing.
  6. This might be upstreamable?
  7. diff --git a/third_party/blink/public/web/web_document_loader.h b/third_party/blink/public/web/web_document_loader.h
  8. index 23b29fe25bc463ff1d36aa502a27c4222595e7c5..c1ac6172c4cee72f64f42ca64d2db9c0f1f48738 100644
  9. --- a/third_party/blink/public/web/web_document_loader.h
  10. +++ b/third_party/blink/public/web/web_document_loader.h
  11. @@ -38,6 +38,7 @@
  12. #include "third_party/blink/public/platform/cross_variant_mojo_util.h"
  13. #include "third_party/blink/public/platform/web_archive_info.h"
  14. #include "third_party/blink/public/platform/web_common.h"
  15. +#include "third_party/blink/public/platform/web_loader_freeze_mode.h"
  16. #include "third_party/blink/public/platform/web_source_location.h"
  17. #include "third_party/blink/public/web/web_navigation_type.h"
  18. @@ -63,6 +64,8 @@ class BLINK_EXPORT WebDocumentLoader {
  19. virtual std::unique_ptr<ExtraData> Clone() = 0;
  20. };
  21. + virtual void SetDefersLoading(WebLoaderFreezeMode) = 0;
  22. +
  23. static bool WillLoadUrlAsEmpty(const WebURL&);
  24. // Returns the http referrer of original request which initited this load.
  25. diff --git a/third_party/blink/renderer/core/loader/document_loader.h b/third_party/blink/renderer/core/loader/document_loader.h
  26. index 1c6da71f9526f1567fe18d40524818f48e62584a..63b9bdae7f6552e047023be3b503bf05154e7ca9 100644
  27. --- a/third_party/blink/renderer/core/loader/document_loader.h
  28. +++ b/third_party/blink/renderer/core/loader/document_loader.h
  29. @@ -327,7 +327,7 @@ class CORE_EXPORT DocumentLoader : public GarbageCollected<DocumentLoader>,
  30. soft_navigation_heuristics_task_id,
  31. bool should_skip_screenshot);
  32. - void SetDefersLoading(LoaderFreezeMode);
  33. + void SetDefersLoading(LoaderFreezeMode) override;
  34. DocumentLoadTiming& GetTiming() { return document_load_timing_; }