Title: [140649] trunk
Revision
140649
Author
[email protected]
Date
2013-01-23 21:42:33 -0800 (Wed, 23 Jan 2013)

Log Message

[Inspector] Add events for tracking page loads and scheduled navigations.
https://bugs.webkit.org/show_bug.cgi?id=104168

Patch by Ken Kania <[email protected]> on 2013-01-23
Reviewed by Pavel Feldman.

These events are needed for clients who need to be aware of when a page is
navigating or about to navigate. Some clients may wish to prevent interaction
with the page during this time. Two of the new events track loading start and
stop, as measured by the ProgressTracker. The other two events track when a
page has a new scheduled navigation and when it no longer has a scheduled
navigation. These latter two events won't allow the client to determine if
a load is going to happen in all circumstances, but is sufficient for many cases.
Make sure we hold a reference to the frame in NavigationScheduler::timerFired
in case the redirect causes the frame to be detached.

Also, minor update to InspectorInputAgent::dispatchMouseEvent to reorder params
to match dispatchKeyEvent.

Source/WebCore:

Tests: inspector-protocol/page/frameScheduledNavigation.html
       inspector-protocol/page/frameStartedLoading.html

* inspector/Inspector.json:
* inspector/InspectorInputAgent.cpp:
(WebCore::InspectorInputAgent::dispatchMouseEvent):
* inspector/InspectorInputAgent.h:
(InspectorInputAgent):
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::frameStartedLoadingImpl):
(WebCore::InspectorInstrumentation::frameStoppedLoadingImpl):
(WebCore::InspectorInstrumentation::frameScheduledNavigationImpl):
(WebCore::InspectorInstrumentation::frameClearedScheduledNavigationImpl):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::frameStartedLoading):
(WebCore):
(WebCore::InspectorInstrumentation::frameStoppedLoading):
(WebCore::InspectorInstrumentation::frameScheduledNavigation):
(WebCore::InspectorInstrumentation::frameClearedScheduledNavigation):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::frameStartedLoading):
(WebCore):
(WebCore::InspectorPageAgent::frameStoppedLoading):
(WebCore::InspectorPageAgent::frameScheduledNavigation):
(WebCore::InspectorPageAgent::frameClearedScheduledNavigation):
* inspector/InspectorPageAgent.h:
* inspector/front-end/ResourceTreeModel.js:
(WebInspector.PageDispatcher.prototype.frameDetached):
(WebInspector.PageDispatcher.prototype.frameStartedLoading):
(WebInspector.PageDispatcher.prototype.frameStoppedLoading):
(WebInspector.PageDispatcher.prototype.frameScheduledNavigation):
(WebInspector.PageDispatcher.prototype.frameClearedScheduledNavigation):
* loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::clear):
(WebCore::NavigationScheduler::timerFired):
(WebCore::NavigationScheduler::startTimer):
(WebCore::NavigationScheduler::cancel):
* loader/ProgressTracker.cpp:
(WebCore::ProgressTracker::progressStarted):
(WebCore::ProgressTracker::finalProgressComplete):

LayoutTests:

* inspector-protocol/page/frameScheduledNavigation-expected.txt: Added.
* inspector-protocol/page/frameScheduledNavigation.html: Added.
* inspector-protocol/page/frameStartedLoading-expected.txt: Added.
* inspector-protocol/page/frameStartedLoading.html: Added.
* platform/chromium/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140648 => 140649)


--- trunk/LayoutTests/ChangeLog	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/LayoutTests/ChangeLog	2013-01-24 05:42:33 UTC (rev 140649)
@@ -1,3 +1,29 @@
+2013-01-23  Ken Kania  <[email protected]>
+
+        [Inspector] Add events for tracking page loads and scheduled navigations.
+        https://bugs.webkit.org/show_bug.cgi?id=104168
+
+        Reviewed by Pavel Feldman.
+
+        These events are needed for clients who need to be aware of when a page is
+        navigating or about to navigate. Some clients may wish to prevent interaction
+        with the page during this time. Two of the new events track loading start and
+        stop, as measured by the ProgressTracker. The other two events track when a
+        page has a new scheduled navigation and when it no longer has a scheduled
+        navigation. These latter two events won't allow the client to determine if
+        a load is going to happen in all circumstances, but is sufficient for many cases.
+        Make sure we hold a reference to the frame in NavigationScheduler::timerFired
+        in case the redirect causes the frame to be detached.
+
+        Also, minor update to InspectorInputAgent::dispatchMouseEvent to reorder params
+        to match dispatchKeyEvent.
+
+        * inspector-protocol/page/frameScheduledNavigation-expected.txt: Added.
+        * inspector-protocol/page/frameScheduledNavigation.html: Added.
+        * inspector-protocol/page/frameStartedLoading-expected.txt: Added.
+        * inspector-protocol/page/frameStartedLoading.html: Added.
+        * platform/chromium/TestExpectations:
+
 2013-01-23  Simon Fraser  <[email protected]>
 
         Avoid creating background layers on pages with a fixed background, but no image

Added: trunk/LayoutTests/inspector-protocol/page/frameScheduledNavigation-expected.txt (0 => 140649)


--- trunk/LayoutTests/inspector-protocol/page/frameScheduledNavigation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/page/frameScheduledNavigation-expected.txt	2013-01-24 05:42:33 UTC (rev 140649)
@@ -0,0 +1,5 @@
+
+Scheduled navigation with delay 0
+Started loading
+Cleared scheduled navigation
+

Added: trunk/LayoutTests/inspector-protocol/page/frameScheduledNavigation.html (0 => 140649)


--- trunk/LayoutTests/inspector-protocol/page/frameScheduledNavigation.html	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/page/frameScheduledNavigation.html	2013-01-24 05:42:33 UTC (rev 140649)
@@ -0,0 +1,43 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<script>
+
+function load()
+{
+    document.querySelector("iframe").src = ""
+}
+
+function test()
+{
+    InspectorTest.eventHandler["Page.frameScheduledNavigation"] = onScheduled;
+    InspectorTest.eventHandler["Page.frameStartedLoading"] = onStarted;
+    InspectorTest.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared;
+    InspectorTest.sendCommand("Page.enable", {});
+
+    function onScheduled(msg)
+    {
+        InspectorTest.log("Scheduled navigation with delay " + msg.params.delay);
+    }
+
+    function onStarted(msg)
+    {
+        // This event should be received before the scheduled navigation is cleared.
+        InspectorTest.log("Started loading");
+    }
+
+    function onCleared(msg)
+    {
+        InspectorTest.log("Cleared scheduled navigation");
+        InspectorTest.completeTest();
+    }
+
+    InspectorTest.sendCommand("Runtime.evaluate", { "_expression_": "load()" });
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+<iframe>
+</body>
+</html>

Added: trunk/LayoutTests/inspector-protocol/page/frameStartedLoading-expected.txt (0 => 140649)


--- trunk/LayoutTests/inspector-protocol/page/frameStartedLoading-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/page/frameStartedLoading-expected.txt	2013-01-24 05:42:33 UTC (rev 140649)
@@ -0,0 +1,4 @@
+
+Started loading
+Stopped loading
+

Added: trunk/LayoutTests/inspector-protocol/page/frameStartedLoading.html (0 => 140649)


--- trunk/LayoutTests/inspector-protocol/page/frameStartedLoading.html	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/page/frameStartedLoading.html	2013-01-24 05:42:33 UTC (rev 140649)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<script>
+
+function load()
+{
+    var frame = document.createElement("iframe");
+    frame.src = ""
+    document.body.appendChild(frame);
+}
+
+function test()
+{
+    InspectorTest.eventHandler["Page.frameStartedLoading"] = onStart;
+    InspectorTest.eventHandler["Page.frameStoppedLoading"] = onStop;
+    InspectorTest.sendCommand("Page.enable", {});
+
+    function onStart()
+    {
+        InspectorTest.log("Started loading");
+    }
+    function onStop()
+    {
+        InspectorTest.log("Stopped loading");
+        InspectorTest.completeTest();
+    }
+
+    InspectorTest.sendCommand("Runtime.evaluate", { "_expression_": "load()" });
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+</body>
+</html>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (140648 => 140649)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-24 05:42:33 UTC (rev 140649)
@@ -4309,11 +4309,6 @@
 webkit.org/b/106858 [ Mac Debug ] scrollingcoordinator/non-fast-scrollable-region-scaled-iframe.html [ ImageOnlyFailure ]
 webkit.org/b/106858 [ Linux Win Debug ] scrollingcoordinator/non-fast-scrollable-region-scaled-iframe.html [ ImageOnlyFailure Pass ]
 
-webkit.org/b/107033 [ Debug ] fast/frames/valid.html [ Crash ]
-webkit.org/b/107033 [ Debug ] fast/events/form-iframe-target-before-load-crash.html [ Crash ]
-webkit.org/b/107033 [ Debug ] fast/events/before-unload-with-subframes.html [ Crash ]
-webkit.org/b/107033 [ Debug ] fast/css/stylesheet-enable-first-alternate-link.html [ Crash ]
-
 # Needs rebaseline.
 webkit.org/b/105574 editing/input/caret-at-the-edge-of-contenteditable.html [ Failure ]
 webkit.org/b/105574 editing/input/reveal-caret-of-multiline-contenteditable.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (140648 => 140649)


--- trunk/Source/WebCore/ChangeLog	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/ChangeLog	2013-01-24 05:42:33 UTC (rev 140649)
@@ -1,3 +1,66 @@
+2013-01-23  Ken Kania  <[email protected]>
+
+        [Inspector] Add events for tracking page loads and scheduled navigations.
+        https://bugs.webkit.org/show_bug.cgi?id=104168
+
+        Reviewed by Pavel Feldman.
+
+        These events are needed for clients who need to be aware of when a page is
+        navigating or about to navigate. Some clients may wish to prevent interaction
+        with the page during this time. Two of the new events track loading start and
+        stop, as measured by the ProgressTracker. The other two events track when a
+        page has a new scheduled navigation and when it no longer has a scheduled
+        navigation. These latter two events won't allow the client to determine if
+        a load is going to happen in all circumstances, but is sufficient for many cases.
+        Make sure we hold a reference to the frame in NavigationScheduler::timerFired
+        in case the redirect causes the frame to be detached.
+
+        Also, minor update to InspectorInputAgent::dispatchMouseEvent to reorder params
+        to match dispatchKeyEvent.
+
+        Tests: inspector-protocol/page/frameScheduledNavigation.html
+               inspector-protocol/page/frameStartedLoading.html
+
+        * inspector/Inspector.json:
+        * inspector/InspectorInputAgent.cpp:
+        (WebCore::InspectorInputAgent::dispatchMouseEvent):
+        * inspector/InspectorInputAgent.h:
+        (InspectorInputAgent):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore):
+        (WebCore::InspectorInstrumentation::frameStartedLoadingImpl):
+        (WebCore::InspectorInstrumentation::frameStoppedLoadingImpl):
+        (WebCore::InspectorInstrumentation::frameScheduledNavigationImpl):
+        (WebCore::InspectorInstrumentation::frameClearedScheduledNavigationImpl):
+        * inspector/InspectorInstrumentation.h:
+        (InspectorInstrumentation):
+        (WebCore::InspectorInstrumentation::frameStartedLoading):
+        (WebCore):
+        (WebCore::InspectorInstrumentation::frameStoppedLoading):
+        (WebCore::InspectorInstrumentation::frameScheduledNavigation):
+        (WebCore::InspectorInstrumentation::frameClearedScheduledNavigation):
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::frameStartedLoading):
+        (WebCore):
+        (WebCore::InspectorPageAgent::frameStoppedLoading):
+        (WebCore::InspectorPageAgent::frameScheduledNavigation):
+        (WebCore::InspectorPageAgent::frameClearedScheduledNavigation):
+        * inspector/InspectorPageAgent.h:
+        * inspector/front-end/ResourceTreeModel.js:
+        (WebInspector.PageDispatcher.prototype.frameDetached):
+        (WebInspector.PageDispatcher.prototype.frameStartedLoading):
+        (WebInspector.PageDispatcher.prototype.frameStoppedLoading):
+        (WebInspector.PageDispatcher.prototype.frameScheduledNavigation):
+        (WebInspector.PageDispatcher.prototype.frameClearedScheduledNavigation):
+        * loader/NavigationScheduler.cpp:
+        (WebCore::NavigationScheduler::clear):
+        (WebCore::NavigationScheduler::timerFired):
+        (WebCore::NavigationScheduler::startTimer):
+        (WebCore::NavigationScheduler::cancel):
+        * loader/ProgressTracker.cpp:
+        (WebCore::ProgressTracker::progressStarted):
+        (WebCore::ProgressTracker::finalProgressComplete):
+
 2013-01-23  Simon Fraser  <[email protected]>
 
         Avoid creating background layers on pages with a fixed background, but no image

Modified: trunk/Source/WebCore/inspector/Inspector.json (140648 => 140649)


--- trunk/Source/WebCore/inspector/Inspector.json	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/inspector/Inspector.json	2013-01-24 05:42:33 UTC (rev 140649)
@@ -494,6 +494,39 @@
                     { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has been detached." }
                 ],
                 "hidden": true
+            },
+            {
+                "name": "frameStartedLoading",
+                "description": "Fired when frame has started loading.",
+                "parameters": [
+                    { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has started loading." }
+                ],
+                "hidden": true
+            },
+            {
+                "name": "frameStoppedLoading",
+                "description": "Fired when frame has stopped loading.",
+                "parameters": [
+                    { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has stopped loading." }
+                ],
+                "hidden": true
+            },
+            {
+                "name": "frameScheduledNavigation",
+                "description": "Fired when frame schedules a potential navigation.",
+                "parameters": [
+                    { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has scheduled a navigation." },
+                    { "name": "delay", "type": "number", "description": "Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start." }
+                ],
+                "hidden": true
+            },
+            {
+                "name": "frameClearedScheduledNavigation",
+                "description": "Fired when frame no longer has a scheduled navigation.",
+                "parameters": [
+                    { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has cleared its scheduled navigation." }
+                ],
+                "hidden": true
             }
         ]
     },
@@ -3363,10 +3396,10 @@
                 "name": "dispatchMouseEvent",
                 "parameters": [
                     { "name": "type", "type": "string", "enum": ["mousePressed", "mouseReleased", "mouseMoved"], "description": "Type of the mouse event." },
+                    { "name": "modifiers", "type": "integer", "optional": true, "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0)." },
+                    { "name": "timestamp", "type": "number", "optional": true, "description": "Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time)." },
                     { "name": "x", "type": "integer", "description": "X coordinate of the event relative to the main frame's viewport."},
                     { "name": "y", "type": "integer", "description": "Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport."},
-                    { "name": "modifiers", "type": "integer", "optional": true, "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0)." },
-                    { "name": "timestamp", "type": "number", "optional": true, "description": "Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time)." },
                     { "name": "button", "type": "string", "enum": ["none", "left", "middle", "right"], "optional": true, "description": "Mouse button (default: \"none\")." },
                     { "name": "clickCount", "type": "integer", "optional": true, "description": "Number of times the mouse button was clicked (default: 0)." }
                 ],

Modified: trunk/Source/WebCore/inspector/InspectorInputAgent.cpp (140648 => 140649)


--- trunk/Source/WebCore/inspector/InspectorInputAgent.cpp	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/inspector/InspectorInputAgent.cpp	2013-01-24 05:42:33 UTC (rev 140649)
@@ -93,7 +93,7 @@
     m_page->mainFrame()->eventHandler()->keyEvent(event);
 }
 
-void InspectorInputAgent::dispatchMouseEvent(ErrorString* error, const String& type, int x, int y, const int* modifiers, const double* timestamp, const String* button, const int* clickCount)
+void InspectorInputAgent::dispatchMouseEvent(ErrorString* error, const String& type, const int* modifiers, const double* timestamp, int x, int y, const String* button, const int* clickCount)
 {
     PlatformEvent::Type convertedType;
     if (type == "mousePressed")
@@ -107,6 +107,8 @@
         return;
     }
 
+    int convertedModifiers = modifiers ? *modifiers : 0;
+
     MouseButton convertedButton = NoButton;
     if (button) {
         if (*button == "left")
@@ -125,7 +127,7 @@
     // assume the origin is in the top-left of the window. Convert.
     IntPoint convertedPoint = m_page->mainFrame()->view()->convertToContainingWindow(IntPoint(x, y));
     IntPoint globalPoint = m_page->chrome()->rootViewToScreen(IntRect(IntPoint(x, y), IntSize(0, 0))).location();
-    int convertedModifiers = modifiers ? *modifiers : 0;
+
     PlatformMouseEvent event(
         convertedPoint,
         globalPoint,

Modified: trunk/Source/WebCore/inspector/InspectorInputAgent.h (140648 => 140649)


--- trunk/Source/WebCore/inspector/InspectorInputAgent.h	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/inspector/InspectorInputAgent.h	2013-01-24 05:42:33 UTC (rev 140649)
@@ -57,7 +57,7 @@
 
     // Methods called from the frontend for simulating input.
     virtual void dispatchKeyEvent(ErrorString*, const String& type, const int* modifiers, const double* timestamp, const String* text, const String* unmodifiedText, const String* keyIdentifier, const int* windowsVirtualKeyCode, const int* nativeVirtualKeyCode, const int* macCharCode, const bool* autoRepeat, const bool* isKeypad, const bool* isSystemKey);
-    virtual void dispatchMouseEvent(ErrorString*, const String& type, int x, int y, const int* modifiers, const double* timestamp, const String* button, const int* clickCount);
+    virtual void dispatchMouseEvent(ErrorString*, const String& type, const int* modifiers, const double* timestamp, int x, int y, const String* button, const int* clickCount);
 
 private:
     InspectorInputAgent(InstrumentingAgents*, InspectorCompositeState*, Page*);

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (140648 => 140649)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-01-24 05:42:33 UTC (rev 140649)
@@ -951,6 +951,30 @@
         inspectorPageAgent->loaderDetachedFromFrame(loader);
 }
 
+void InspectorInstrumentation::frameStartedLoadingImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+{
+    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())
+        inspectorPageAgent->frameStartedLoading(frame);
+}
+
+void InspectorInstrumentation::frameStoppedLoadingImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+{
+    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())
+        inspectorPageAgent->frameStoppedLoading(frame);
+}
+
+void InspectorInstrumentation::frameScheduledNavigationImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, double delay)
+{
+    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())
+        inspectorPageAgent->frameScheduledNavigation(frame, delay);
+}
+
+void InspectorInstrumentation::frameClearedScheduledNavigationImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+{
+    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())
+        inspectorPageAgent->frameClearedScheduledNavigation(frame);
+}
+
 void InspectorInstrumentation::willDestroyCachedResourceImpl(CachedResource* cachedResource)
 {
     if (!instrumentingAgentsSet)

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (140648 => 140649)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-01-24 05:42:33 UTC (rev 140649)
@@ -211,6 +211,10 @@
     static void frameDetachedFromParent(Frame*);
     static void didCommitLoad(Frame*, DocumentLoader*);
     static void loaderDetachedFromFrame(Frame*, DocumentLoader*);
+    static void frameStartedLoading(Frame*);
+    static void frameStoppedLoading(Frame*);
+    static void frameScheduledNavigation(Frame*, double delay);
+    static void frameClearedScheduledNavigation(Frame*);
     static void willDestroyCachedResource(CachedResource*);
 
     static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned int length, unsigned int startLine);
@@ -410,6 +414,10 @@
     static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*);
     static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*);
     static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*);
+    static void frameStartedLoadingImpl(InstrumentingAgents*, Frame*);
+    static void frameStoppedLoadingImpl(InstrumentingAgents*, Frame*);
+    static void frameScheduledNavigationImpl(InstrumentingAgents*, Frame*, double delay);
+    static void frameClearedScheduledNavigationImpl(InstrumentingAgents*, Frame*);
     static void willDestroyCachedResourceImpl(CachedResource*);
 
     static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents*, unsigned int length, unsigned int startLine, Frame*);
@@ -1672,6 +1680,38 @@
 #endif
 }
 
+inline void InspectorInstrumentation::frameStartedLoading(Frame* frame)
+{
+#if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        frameStartedLoadingImpl(instrumentingAgents, frame);
+#endif
+}
+
+inline void InspectorInstrumentation::frameStoppedLoading(Frame* frame)
+{
+#if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        frameStoppedLoadingImpl(instrumentingAgents, frame);
+#endif
+}
+
+inline void InspectorInstrumentation::frameScheduledNavigation(Frame* frame, double delay)
+{
+#if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        frameScheduledNavigationImpl(instrumentingAgents, frame, delay);
+#endif
+}
+
+inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame* frame)
+{
+#if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        frameClearedScheduledNavigationImpl(instrumentingAgents, frame);
+#endif
+}
+
 inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource* cachedResource)
 {
 #if ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (140648 => 140649)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2013-01-24 05:42:33 UTC (rev 140649)
@@ -900,6 +900,26 @@
         m_loaderToIdentifier.remove(iterator);
 }
 
+void InspectorPageAgent::frameStartedLoading(Frame* frame)
+{
+    m_frontend->frameStartedLoading(frameId(frame));
+}
+
+void InspectorPageAgent::frameStoppedLoading(Frame* frame)
+{
+    m_frontend->frameStoppedLoading(frameId(frame));
+}
+
+void InspectorPageAgent::frameScheduledNavigation(Frame* frame, double delay)
+{
+    m_frontend->frameScheduledNavigation(frameId(frame), delay);
+}
+
+void InspectorPageAgent::frameClearedScheduledNavigation(Frame* frame)
+{
+    m_frontend->frameClearedScheduledNavigation(frameId(frame));
+}
+
 void InspectorPageAgent::applyScreenWidthOverride(long* width)
 {
     long widthOverride = m_state->getLong(PageAgentState::pageAgentScreenWidthOverride);

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.h (140648 => 140649)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.h	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.h	2013-01-24 05:42:33 UTC (rev 140649)
@@ -138,6 +138,10 @@
     void frameNavigated(DocumentLoader*);
     void frameDetached(Frame*);
     void loaderDetachedFromFrame(DocumentLoader*);
+    void frameStartedLoading(Frame*);
+    void frameStoppedLoading(Frame*);
+    void frameScheduledNavigation(Frame*, double delay);
+    void frameClearedScheduledNavigation(Frame*);
     void applyScreenWidthOverride(long*);
     void applyScreenHeightOverride(long*);
     void applyEmulatedMedia(String*);

Modified: trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js (140648 => 140649)


--- trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2013-01-24 05:42:33 UTC (rev 140649)
@@ -601,6 +601,18 @@
     frameDetached: function(frameId)
     {
         this._resourceTreeModel._frameDetached(frameId);
+    },
+
+    frameStartedLoading: function(frameId) {
+    },
+
+    frameStoppedLoading: function(frameId) {
+    },
+
+    frameScheduledNavigation: function(frameId, delay) {
+    },
+
+    frameClearedScheduledNavigation: function(frameId) {
     }
 }
 

Modified: trunk/Source/WebCore/loader/NavigationScheduler.cpp (140648 => 140649)


--- trunk/Source/WebCore/loader/NavigationScheduler.cpp	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/loader/NavigationScheduler.cpp	2013-01-24 05:42:33 UTC (rev 140649)
@@ -45,6 +45,7 @@
 #include "HTMLFormElement.h"
 #include "HTMLFrameOwnerElement.h"
 #include "HistoryItem.h"
+#include "InspectorInstrumentation.h"
 #include "Page.h"
 #include "UserGestureIndicator.h"
 #include <wtf/CurrentTime.h>
@@ -286,6 +287,8 @@
 
 void NavigationScheduler::clear()
 {
+    if (m_timer.isActive())
+        InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
     m_timer.stop();
     m_redirect.clear();
 }
@@ -411,11 +414,16 @@
 {
     if (!m_frame->page())
         return;
-    if (m_frame->page()->defersLoading())
+    if (m_frame->page()->defersLoading()) {
+        InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
         return;
+    }
 
+    RefPtr<Frame> protect(m_frame);
+
     OwnPtr<ScheduledNavigation> redirect(m_redirect.release());
     redirect->fire(m_frame);
+    InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
 }
 
 void NavigationScheduler::schedule(PassOwnPtr<ScheduledNavigation> redirect)
@@ -458,10 +466,13 @@
 
     m_timer.startOneShot(m_redirect->delay());
     m_redirect->didStartTimer(m_frame, &m_timer);
+    InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->delay());
 }
 
 void NavigationScheduler::cancel(bool newLoadInProgress)
 {
+    if (m_timer.isActive())
+        InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
     m_timer.stop();
 
     OwnPtr<ScheduledNavigation> redirect(m_redirect.release());

Modified: trunk/Source/WebCore/loader/ProgressTracker.cpp (140648 => 140649)


--- trunk/Source/WebCore/loader/ProgressTracker.cpp	2013-01-24 05:35:37 UTC (rev 140648)
+++ trunk/Source/WebCore/loader/ProgressTracker.cpp	2013-01-24 05:42:33 UTC (rev 140649)
@@ -31,6 +31,7 @@
 #include "FrameLoader.h"
 #include "FrameLoaderStateMachine.h"
 #include "FrameLoaderClient.h"
+#include "InspectorInstrumentation.h"
 #include "Logging.h"
 #include "ResourceResponse.h"
 #include <wtf/text/CString.h>
@@ -120,6 +121,7 @@
     m_numProgressTrackedFrames++;
 
     frame->loader()->client()->didChangeEstimatedProgress();
+    InspectorInstrumentation::frameStartedLoading(frame);
 }
 
 void ProgressTracker::progressCompleted(Frame* frame)
@@ -155,6 +157,7 @@
 
     frame->loader()->client()->setMainFrameDocumentReady(true);
     frame->loader()->client()->postProgressFinishedNotification();
+    InspectorInstrumentation::frameStoppedLoading(frame.get());
 }
 
 void ProgressTracker::incrementProgress(unsigned long identifier, const ResourceResponse& response)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to