[Webkit-unassigned] [Bug 192884] New: Confusingly nested events in the timeline for Mutation Observers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 19 15:12:46 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=192884

            Bug ID: 192884
           Summary: Confusingly nested events in the timeline for Mutation
                    Observers
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Inspector
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: simon.fraser at apple.com
                CC: inspector-bugzilla-changes at group.apple.com

With the fix for bug 192669, MutationObserver callbacks fail to wrap their "script evaluated" record, which makes the event nesting look broken.

This happens because TimelineManager.js makes assumptions about the nesting of TimelineAgent.EventType.ObserverCallback events. MutationObserver callbacks are called inside of performMicrotaskCheckpoint(), but this is nested inside the instrumentation inside ScriptController::evaluateInWorld(), which makes the records look like:


{
    "method": "Timeline.eventRecorded",
    "params": {
        "record": {
            "startTime": 126.1153933230089,
            "data": {},
            "children": [{
                "startTime": 126.13111369599937,
                "frameId": "0.1",
                "data": {},
                "children": [],
                "endTime": 126.13206217900733,
                "type": "RecalculateStyles"
            }, {
                "startTime": 126.15065376498387,
                "frameId": "0.1",
                "data": {},
                "children": [],
                "endTime": 126.15083438300644,
                "type": "RecalculateStyles"
            }, {
                "startTime": 126.1510179519828,
                "data": {},
                "frameId": "0.1",
                "type": "ScheduleStyleRecalculation"
            }, {
                "startTime": 126.15147269400768,
                "frameId": "0.1",
                "data": {
                    "url": "file:///Volumes/Data/Development/media/testcontent/DOM API/callback-types.html",
                    "lineNumber": 11
                },
                "children": [{
                    "startTime": 126.15439619901008,
                    "frameId": "0.1",
                    "data": {
                        "type": "MutationObserver"
                    },
                    "children": [{
                        "startTime": 126.15448315799586,
                        "frameId": "0.1",
                        "data": {
                            "scriptName": "file:///Volumes/Data/Development/media/testcontent/DOM API/callback-types.html",
                            "scriptLine": 28
                        },
                        "children": [],
                        "endTime": 126.17735613300465,
                        "type": "FunctionCall"
                    }],
                    "endTime": 126.17736832599621,
                    "type": "ObserverCallback"
                }],
                "endTime": 126.17738567499327,
                "type": "EvaluateScript"
            }],
            "endTime": 126.17764653699123,
            "type": "RenderingFrame"
        }
    }
}

I think we need to close the "ScriptController::evaluateInWorld" block before we open the block in JSExecState::didLeaveScriptContext().

Stack for MutationObserver callbacks:

  * frame #0: 0x00000003da414918 WebCore`WebCore::MutationObserver::deliver(this=0x00000003f96001e0) at MutationObserver.cpp:249
    frame #1: 0x00000003da415490 WebCore`WebCore::MutationObserver::notifyMutationObservers() at MutationObserver.cpp:301
    frame #2: 0x00000003da41a611 WebCore`WebCore::MutationObserverMicrotask::run(this=0x00000003fba2dbb8) at MutationObserver.cpp:168
    frame #3: 0x00000003da3f9ab3 WebCore`WebCore::MicrotaskQueue::performMicrotaskCheckpoint(this=0x00000003dd623190) at Microtasks.cpp:94
    frame #4: 0x00000003d9ddbe0a WebCore`WebCore::JSExecState::didLeaveScriptContext(exec=0x00000003f74e0048) at JSExecState.cpp:42
    frame #5: 0x00000003d9d90d05 WebCore`WebCore::JSExecState::~JSExecState(this=0x00007ffee6c16e40) at JSExecState.h:145
    frame #6: 0x00000003d9d90b25 WebCore`WebCore::JSExecState::~JSExecState(this=0x00007ffee6c16e40) at JSExecState.h:134
    frame #7: 0x00000003d9e22a35 WebCore`WebCore::JSExecState::profiledEvaluate(exec=0x00000003f74e0048, reason=Other, source=0x00007ffee6c170d0, thisValue=JSValue @ 0x00007ffee6c16e70, returnedException=0x00007ffee6c16ed8) at JSExecState.h:81
    frame #8: 0x00000003d9e22786 WebCore`WebCore::ScriptController::evaluateInWorld(this=0x00000003f67e93c0, sourceCode=0x00007ffee6c170c8, world=0x00000003f67c11a0, exceptionDetails=0x0000000000000000) at ScriptController.cpp:131
    frame #9: 0x00000003d9e22afd WebCore`WebCore::ScriptController::evaluate(this=0x00000003f67e93c0, sourceCode=0x00007ffee6c170c8, exceptionDetails=0x0000000000000000) at ScriptController.cpp:147
    frame #10: 0x00000003da4913e1 WebCore`WebCore::ScriptElement::executeClassicScript(this=0x00000003f95002a0, sourceCode=0x00007ffee6c170c8) at ScriptElement.cpp:387
    frame #11: 0x00000003da48f6f0 WebCore`WebCore::ScriptElement::prepareScript(this=0x00000003f95002a0, scriptStartPosition=0x00007ffee6c173b8, supportLegacyTypes=DisallowLegacyTypeInTypeAttribute) at ScriptElement.cpp:267
    frame #12: 0x00000003da91aef4 WebCore`WebCore::HTMLScriptRunner::runScript(this=0x00000003fbad2cf0, scriptElement=0x00000003f95002a0, scriptStartPosition=0x00007ffee6c173b8) at HTMLScriptRunner.cpp:250
    frame #13: 0x00000003da91ad1f WebCore`WebCore::HTMLScriptRunner::execute(this=0x00000003fbad2cf0, element=0x00007ffee6c173a8, scriptStartPosition=0x00007ffee6c173b8) at HTMLScriptRunner.cpp:140

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181219/5d02c668/attachment.html>


More information about the webkit-unassigned mailing list