@@ -836,7 +836,7 @@ index 777a54166ed6664561b3f8249a6abb4ac59d0480..e738f34f65fa8137a16bf7b66bc237b8
836836 "name": "webSocketWillSendHandshakeRequest",
837837 "description": "Fired when WebSocket is about to initiate handshake.",
838838diff --git a/Source/JavaScriptCore/inspector/protocol/Page.json b/Source/JavaScriptCore/inspector/protocol/Page.json
839- index 78980810141a9e9b65b93e6cebe80daff9a52dc1..4818c82fff8b19e060e129275ef5f95f1db2fcb0 100644
839+ index 78980810141a9e9b65b93e6cebe80daff9a52dc1..b13fa7275289bb095bcbf76e8cb5ff4d5db6e03b 100644
840840--- a/Source/JavaScriptCore/inspector/protocol/Page.json
841841+++ b/Source/JavaScriptCore/inspector/protocol/Page.json
842842@@ -109,6 +109,41 @@
@@ -925,7 +925,7 @@ index 78980810141a9e9b65b93e6cebe80daff9a52dc1..4818c82fff8b19e060e129275ef5f95f
925925 {
926926 "name": "snapshotNode",
927927 "description": "Capture a snapshot of the specified node that does not include unrelated layers.",
928- @@ -282,19 +341,85 @@
928+ @@ -282,19 +341,92 @@
929929 "returns": [
930930 { "name": "data", "type": "string", "description": "Base64-encoded web archive." }
931931 ]
@@ -992,6 +992,13 @@ index 78980810141a9e9b65b93e6cebe80daff9a52dc1..4818c82fff8b19e060e129275ef5f95f
992992+ "description": "Overrides window.orientation with provided value.",
993993+ "parameters": [
994994+ { "name": "angle", "type": "integer", "optional": true }
995+ + ]
996+ + },
997+ + {
998+ + "name": "setActivityPaused",
999+ + "description": "Pauses page activity (active objets, animations).",
1000+ + "parameters": [
1001+ + { "name": "paused", "type": "boolean" }
9951002+ ]
9961003 }
9971004 ],
@@ -1013,7 +1020,7 @@ index 78980810141a9e9b65b93e6cebe80daff9a52dc1..4818c82fff8b19e060e129275ef5f95f
10131020 ]
10141021 },
10151022 {
1016- @@ -304,6 +429 ,14 @@
1023+ @@ -304,6 +436 ,14 @@
10171024 { "name": "frame", "$ref": "Frame", "description": "Frame object." }
10181025 ]
10191026 },
@@ -1028,7 +1035,7 @@ index 78980810141a9e9b65b93e6cebe80daff9a52dc1..4818c82fff8b19e060e129275ef5f95f
10281035 {
10291036 "name": "frameDetached",
10301037 "description": "Fired when frame has been detached from its parent.",
1031- @@ -340,12 +473 ,50 @@
1038+ @@ -340,12 +480 ,50 @@
10321039 { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has cleared its scheduled navigation." }
10331040 ]
10341041 },
@@ -3073,10 +3080,10 @@ index b038a1879c043aa17dae97425693f29be42e3258..d60716b837663004675ffd90bceede4c
30733080
30743081 } // namespace WebCore
30753082diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
3076- index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c670a0c1a2 100644
3083+ index 3e8680e1df15245df250aa8e52c3126935832037..6265563481ad523f4cac4d05142667698b797231 100644
30773084--- a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
30783085+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
3079- @@ -32,6 +32,8 @@
3086+ @@ -32,20 +32,27 @@
30803087 #include "config.h"
30813088 #include "InspectorPageAgent.h"
30823089
@@ -3085,9 +3092,12 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
30853092 #include "CachedResource.h"
30863093 #include "CachedResourceLoader.h"
30873094 #include "Cookie.h"
3088- @@ -40,12 +42,15 @@
3095+ #include "CookieJar.h"
3096+ #include "CustomHeaderFields.h"
3097+ +#include "CSSAnimationController.h"
30893098 #include "DOMWrapperWorld.h"
30903099 #include "Document.h"
3100+ +#include "DocumentTimeline.h"
30913101 #include "DocumentLoader.h"
30923102+#include "FocusController.h"
30933103 #include "Frame.h"
@@ -3101,7 +3111,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
31013111 #include "HTMLNames.h"
31023112 #include "ImageBuffer.h"
31033113 #include "InspectorClient.h"
3104- @@ -56,19 +61,28 @@
3114+ @@ -56,19 +63,30 @@
31053115 #include "MIMETypeRegistry.h"
31063116 #include "MemoryCache.h"
31073117 #include "Page.h"
@@ -3115,6 +3125,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
31153125 #include "SecurityOrigin.h"
31163126 #include "Settings.h"
31173127 #include "StyleScope.h"
3128+ +#include "SVGDocumentExtensions.h"
31183129 #include "TextEncoding.h"
31193130+#include "TypingCommand.h"
31203131 #include "UserGestureIndicator.h"
@@ -3124,21 +3135,22 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
31243135 #include <JavaScriptCore/RegularExpression.h>
31253136+#include <wtf/DateMath.h>
31263137 #include <wtf/ListHashSet.h>
3138+ +#include <wtf/MainThread.h>
31273139+#include <wtf/NeverDestroyed.h>
31283140+#include <wtf/Ref.h>
31293141+#include <wtf/RefPtr.h>
31303142 #include <wtf/Stopwatch.h>
31313143 #include <wtf/text/Base64.h>
31323144 #include <wtf/text/StringBuilder.h>
3133- @@ -81,7 +95 ,6 @@
3145+ @@ -81,7 +99 ,6 @@
31343146 #include "LegacyWebArchive.h"
31353147 #endif
31363148
31373149-
31383150 namespace WebCore {
31393151
31403152 using namespace Inspector;
3141- @@ -100,6 +113 ,11 @@ using namespace Inspector;
3153+ @@ -100,6 +117 ,11 @@ using namespace Inspector;
31423154 macro(WebRTCEncryptionEnabled) \
31433155 macro(WebSecurityEnabled)
31443156
@@ -3150,15 +3162,15 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
31503162 static bool decodeBuffer(const char* buffer, unsigned size, const String& textEncodingName, String* result)
31513163 {
31523164 if (buffer) {
3153- @@ -340,6 +358 ,7 @@ InspectorPageAgent::InspectorPageAgent(PageAgentContext& context, InspectorClien
3165+ @@ -340,6 +362 ,7 @@ InspectorPageAgent::InspectorPageAgent(PageAgentContext& context, InspectorClien
31543166 , m_frontendDispatcher(makeUnique<Inspector::PageFrontendDispatcher>(context.frontendRouter))
31553167 , m_backendDispatcher(Inspector::PageBackendDispatcher::create(context.backendDispatcher, this))
31563168 , m_inspectedPage(context.inspectedPage)
31573169+ , m_injectedScriptManager(context.injectedScriptManager)
31583170 , m_client(client)
31593171 , m_overlay(overlay)
31603172 {
3161- @@ -373,11 +392 ,20 @@ void InspectorPageAgent::enable(ErrorString& errorString)
3173+ @@ -373,11 +396 ,20 @@ void InspectorPageAgent::enable(ErrorString& errorString)
31623174 #if HAVE(OS_DARK_MODE_SUPPORT)
31633175 defaultAppearanceDidChange(m_inspectedPage.defaultUseDarkAppearance());
31643176 #endif
@@ -3179,7 +3191,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
31793191
31803192 ErrorString unused;
31813193 setShowPaintRects(unused, false);
3182- @@ -415,12 +443 ,34 @@ void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrig
3194+ @@ -415,12 +447 ,34 @@ void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrig
31833195 m_inspectedPage.mainFrame().loader().reload(reloadOptions);
31843196 }
31853197
@@ -3216,7 +3228,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
32163228 FrameLoadRequest frameLoadRequest { *frame.document(), frame.document()->securityOrigin(), WTFMove(resourceRequest), "_self"_s, InitiatedByMainFrame::Unknown };
32173229 frameLoadRequest.disableNavigationToInvalidURL();
32183230 frame.loader().changeLocation(WTFMove(frameLoadRequest));
3219- @@ -748,15 +798 ,16 @@ void InspectorPageAgent::setShowPaintRects(ErrorString&, bool show)
3231+ @@ -748,15 +802 ,16 @@ void InspectorPageAgent::setShowPaintRects(ErrorString&, bool show)
32203232 m_overlay->setShowPaintRects(show);
32213233 }
32223234
@@ -3238,7 +3250,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
32383250 }
32393251
32403252 void InspectorPageAgent::frameNavigated(Frame& frame)
3241- @@ -764,13 +815 ,23 @@ void InspectorPageAgent::frameNavigated(Frame& frame)
3253+ @@ -764,13 +819 ,23 @@ void InspectorPageAgent::frameNavigated(Frame& frame)
32423254 m_frontendDispatcher->frameNavigated(buildObjectForFrame(&frame));
32433255 }
32443256
@@ -3265,7 +3277,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
32653277 }
32663278
32673279 Frame* InspectorPageAgent::frameForId(const String& frameId)
3268- @@ -782,20 +843 ,18 @@ String InspectorPageAgent::frameId(Frame* frame)
3280+ @@ -782,20 +847 ,18 @@ String InspectorPageAgent::frameId(Frame* frame)
32693281 {
32703282 if (!frame)
32713283 return emptyString();
@@ -3292,7 +3304,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
32923304 }
32933305
32943306 Frame* InspectorPageAgent::assertFrame(ErrorString& errorString, const String& frameId)
3295- @@ -806,11 +865 ,6 @@ Frame* InspectorPageAgent::assertFrame(ErrorString& errorString, const String& f
3307+ @@ -806,11 +869 ,6 @@ Frame* InspectorPageAgent::assertFrame(ErrorString& errorString, const String& f
32963308 return frame;
32973309 }
32983310
@@ -3304,7 +3316,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
33043316 void InspectorPageAgent::frameStartedLoading(Frame& frame)
33053317 {
33063318 m_frontendDispatcher->frameStartedLoading(frameId(&frame));
3307- @@ -831,6 +885 ,12 @@ void InspectorPageAgent::frameClearedScheduledNavigation(Frame& frame)
3319+ @@ -831,6 +889 ,12 @@ void InspectorPageAgent::frameClearedScheduledNavigation(Frame& frame)
33083320 m_frontendDispatcher->frameClearedScheduledNavigation(frameId(&frame));
33093321 }
33103322
@@ -3317,7 +3329,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
33173329 void InspectorPageAgent::defaultAppearanceDidChange(bool useDarkAppearance)
33183330 {
33193331 m_frontendDispatcher->defaultAppearanceDidChange(useDarkAppearance ? Inspector::Protocol::Page::Appearance::Dark : Inspector::Protocol::Page::Appearance::Light);
3320- @@ -888,6 +948 ,48 @@ void InspectorPageAgent::didRecalculateStyle()
3332+ @@ -888,6 +952 ,48 @@ void InspectorPageAgent::didRecalculateStyle()
33213333 m_overlay->update();
33223334 }
33233335
@@ -3366,7 +3378,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
33663378 Ref<Inspector::Protocol::Page::Frame> InspectorPageAgent::buildObjectForFrame(Frame* frame)
33673379 {
33683380 ASSERT_ARG(frame, frame);
3369- @@ -1031,6 +1133 ,29 @@ void InspectorPageAgent::snapshotRect(ErrorString& errorString, int x, int y, in
3381+ @@ -1031,6 +1137 ,29 @@ void InspectorPageAgent::snapshotRect(ErrorString& errorString, int x, int y, in
33703382 *outDataURL = snapshot->toDataURL("image/png"_s, WTF::nullopt, PreserveResolution::Yes);
33713383 }
33723384
@@ -3396,7 +3408,7 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
33963408 void InspectorPageAgent::archive(ErrorString& errorString, String* data)
33973409 {
33983410 #if ENABLE(WEB_ARCHIVE) && USE(CF)
3399- @@ -1048,4 +1173,543 @@ void InspectorPageAgent::archive(ErrorString& errorString, String* data)
3411+ @@ -1048,4 +1177,578 @@ void InspectorPageAgent::archive(ErrorString& errorString, String* data)
34003412 #endif
34013413 }
34023414
@@ -3938,10 +3950,45 @@ index 3e8680e1df15245df250aa8e52c3126935832037..aa712305c6eeb786445b4953a55005c6
39383950+ errorString = "Orientation events are disabled in this build";
39393951+#endif
39403952+}
3953+ +
3954+ +void InspectorPageAgent::setActivityPaused(Inspector::ErrorString& errorString, bool paused)
3955+ +{
3956+ + setMainThreadCallbacksPaused(paused);
3957+ + bool webAnimationsCSSIntegrationEnabled = RuntimeEnabledFeatures::sharedFeatures().webAnimationsCSSIntegrationEnabled();
3958+ + for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
3959+ + ASSERT(frame->document());
3960+ + auto& document = *frame->document();
3961+ + if (paused) {
3962+ + document.suspendScriptedAnimationControllerCallbacks();
3963+ + document.suspendActiveDOMObjects(ReasonForSuspension::JavaScriptDebuggerPaused);
3964+ + if (webAnimationsCSSIntegrationEnabled) {
3965+ + if (auto* timeline = document.existingTimeline())
3966+ + timeline->suspendAnimations();
3967+ + }
3968+ + if (document.svgExtensions())
3969+ + document.accessSVGExtensions().pauseAnimations();
3970+ + } else {
3971+ + document.resumeActiveDOMObjects(ReasonForSuspension::JavaScriptDebuggerPaused);
3972+ + document.resumeScriptedAnimationControllerCallbacks();
3973+ + if (webAnimationsCSSIntegrationEnabled) {
3974+ + if (auto* timeline = document.existingTimeline())
3975+ + timeline->resumeAnimations();
3976+ + }
3977+ + if (document.svgExtensions())
3978+ + document.accessSVGExtensions().unpauseAnimations();
3979+ + }
3980+ + }
3981+ + if (!webAnimationsCSSIntegrationEnabled) {
3982+ + if (paused)
3983+ + m_inspectedPage.mainFrame().animation().suspendAnimations();
3984+ + else
3985+ + m_inspectedPage.mainFrame().animation().resumeAnimations();
3986+ + }
3987+ +}
39413988+
39423989 } // namespace WebCore
39433990diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.h b/Source/WebCore/inspector/agents/InspectorPageAgent.h
3944- index 6c75829502336b0806db2531e78186d2c559e44c..a2f8734a41a3a7d6ba489ea65fe8ca18e91c92d9 100644
3991+ index 6c75829502336b0806db2531e78186d2c559e44c..1ad6b8e863c56fd572910db6c6fb524d367f2ad8 100644
39453992--- a/Source/WebCore/inspector/agents/InspectorPageAgent.h
39463993+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.h
39473994@@ -34,17 +34,23 @@
@@ -3987,7 +4034,7 @@ index 6c75829502336b0806db2531e78186d2c559e44c..a2f8734a41a3a7d6ba489ea65fe8ca18
39874034 void overrideUserAgent(ErrorString&, const String* value) override;
39884035 void overrideSetting(ErrorString&, const String& setting, const bool* value) override;
39894036 void getCookies(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::Cookie>>& cookies) override;
3990- @@ -112,20 +121,31 @@ public:
4037+ @@ -112,20 +121,32 @@ public:
39914038 void setShowPaintRects(ErrorString&, bool show) override;
39924039 void setEmulatedMedia(ErrorString&, const String&) override;
39934040 void setForcedAppearance(ErrorString&, const String&) override;
@@ -4006,6 +4053,7 @@ index 6c75829502336b0806db2531e78186d2c559e44c..a2f8734a41a3a7d6ba489ea65fe8ca18
40064053+ void crash(ErrorString&) override;
40074054+ void setScreenSizeOverride(ErrorString&, int width, int height) override;
40084055+ void setOrientationOverride(Inspector::ErrorString&, const int* angle) override;
4056+ + void setActivityPaused(Inspector::ErrorString&, bool) override;
40094057
40104058 // InspectorInstrumentation
40114059- void domContentEventFired();
@@ -4023,7 +4071,7 @@ index 6c75829502336b0806db2531e78186d2c559e44c..a2f8734a41a3a7d6ba489ea65fe8ca18
40234071 void defaultAppearanceDidChange(bool useDarkAppearance);
40244072 void applyUserAgentOverride(String&);
40254073 void applyEmulatedMedia(String&);
4026- @@ -134,6 +154 ,12 @@ public:
4074+ @@ -134,6 +155 ,12 @@ public:
40274075 void didLayout();
40284076 void didScroll();
40294077 void didRecalculateStyle();
@@ -4036,15 +4084,15 @@ index 6c75829502336b0806db2531e78186d2c559e44c..a2f8734a41a3a7d6ba489ea65fe8ca18
40364084
40374085 Frame* frameForId(const String& frameId);
40384086 WEBCORE_EXPORT String frameId(Frame*);
4039- @@ -142,6 +168 ,7 @@ public:
4087+ @@ -142,6 +169 ,7 @@ public:
40404088
40414089 private:
40424090 double timestamp();
40434091+ void ensureUserWorldsExistInAllFrames(const Vector<DOMWrapperWorld*>&);
40444092
40454093 static bool mainResourceContent(Frame*, bool withBase64Encode, String* result);
40464094 static bool dataContent(const char* data, unsigned size, const String& textEncodingName, bool withBase64Encode, String* result);
4047- @@ -153,18 +180 ,20 @@ private:
4095+ @@ -153,18 +181 ,20 @@ private:
40484096 RefPtr<Inspector::PageBackendDispatcher> m_backendDispatcher;
40494097
40504098 Page& m_inspectedPage;
0 commit comments