⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 252730 in webkit


Ignore:
Timestamp:
Nov 21, 2019, 4:14:59 AM (7 years ago)
Author:
Devin Rousso
Message:

Web Inspector: removing the blackbox for a specific script doesn't actually remove the blackbox
https://bugs.webkit.org/show_bug.cgi?id=204428

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

Previously, when updating the blackbox state of each existing script, we would only tell the
Debugger about when scripts should be blackboxed, not when they shouldn't. This means that
when a given script is un-blackboxed, the Debugger would never get told about it and would
therefore still defer pauses as if it was blackboxed.

The solution to this is simple; update the blackboxed state of every script, not just those
that should be blackboxed, and tell the Debugger about each.

  • inspector/agents/InspectorDebuggerAgent.cpp:

(Inspector::InspectorDebuggerAgent::setShouldBlackboxURL):

LayoutTests:

  • inspector/debugger/setShouldBlackboxURL.html:
  • inspector/debugger/setShouldBlackboxURL-expected.txt:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r252724 r252730  
     12019-11-21  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: removing the blackbox for a specific script doesn't actually remove the blackbox
     4        https://bugs.webkit.org/show_bug.cgi?id=204428
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * inspector/debugger/setShouldBlackboxURL.html:
     9        * inspector/debugger/setShouldBlackboxURL-expected.txt:
     10
    1112019-11-20  Simon Fraser  <simon.fraser@apple.com>
    212
  • trunk/LayoutTests/inspector/debugger/setShouldBlackboxURL-expected.txt

    r251039 r252730  
    301301PASS: Should pause in 'CaseSensitiveRegex_PauseInCallee_Middle'.
    302302PASS: Should not pause in 'CaseSensitiveRegex_PauseInCallee_Outer'.
     303
     304
     305-- Running test case: Debugger.setShouldBlackboxURL.Toggle
     306Evaluating 'createScripts("Toggle")'...
     307Setting breakpoint in 'Toggle_Inner.js'...
     308
     309Blackboxing 'toggle_middle.js'...
     310Evaluating 'Toggle_Outer(10)'...
     311
     312PAUSED: 'Breakpoint' at 'Toggle_Inner:3:1'.
     313{
     314  "breakpointId": "Toggle_Inner.js:3:0"
     315}
     316Stepping over...
     317
     318PAUSED: 'BlackboxedScript' at 'Toggle_Outer:3:1'.
     319{
     320  "originalReason": "other",
     321  "originalData": {
     322    "breakpointId": "Toggle_Inner.js:3:0"
     323  }
     324}
     325Stepping over...
     326
     327Resuming...
     328PASS: Resumed.
     329PASS: Should not pause in 'Toggle_Middle'.
     330
     331Removing blackbox for 'toggle_middle.js'...
     332Evaluating 'Toggle_Outer(10)'...
     333
     334PAUSED: 'Breakpoint' at 'Toggle_Inner:3:1'.
     335{
     336  "breakpointId": "Toggle_Inner.js:3:0"
     337}
     338Stepping over...
     339
     340PAUSED: 'other' at 'Toggle_Middle:3:1'.
     341Stepping over...
     342
     343PAUSED: 'other' at 'Toggle_Outer:3:1'.
     344Stepping over...
     345
     346Resuming...
     347PASS: Resumed.
     348PASS: Should pause in 'Toggle_Middle'.
    303349
    304350
  • trunk/LayoutTests/inspector/debugger/setShouldBlackboxURL.html

    r251039 r252730  
    461461
    462462    suite.addTestCase({
     463        name: "Debugger.setShouldBlackboxURL.Toggle",
     464        description: "Check that the URL does not remain blackboxed if it's blackboxed state is toggled on and then off.",
     465        async test() {
     466            let resumePromise = null;
     467
     468            let [innerSourceURL, middleSourceURL, outerSourceURL] = await Promise.all([
     469                listenForSourceParsed(/Toggle_Inner\.js$/),
     470                listenForSourceParsed(/Toggle_Middle\.js$/),
     471                listenForSourceParsed(/Toggle_Outer\.js$/),
     472                evaluate(`createScripts("Toggle")`),
     473            ]);
     474            await setBreakpoint(innerSourceURL, 3); // last line of function, so it only pauses once
     475
     476            ProtocolTest.newline();
     477
     478            resumePromise = new Promise((resolve, reject) => {
     479                resumeCallback = function() {
     480                    ProtocolTest.expectThat(!pausedFunctionNames.includes("Toggle_Middle"), "Should not pause in 'Toggle_Middle'.");
     481                    resolve();
     482                };
     483            });
     484
     485            await setBlackbox(middleSourceURL);
     486            await evaluate(`Toggle_Outer(10)`);
     487
     488            ProtocolTest.newline();
     489
     490            await resumePromise;
     491
     492            resumePromise = new Promise((resolve, reject) => {
     493                resumeCallback = function() {
     494                    ProtocolTest.expectThat(pausedFunctionNames.includes("Toggle_Middle"), "Should pause in 'Toggle_Middle'.");
     495                    resolve();
     496                };
     497            });
     498
     499            ProtocolTest.log(`Removing blackbox for '${middleSourceURL.toLowerCase()}'...`);
     500            await InspectorProtocol.awaitCommand({
     501                method: "Debugger.setShouldBlackboxURL",
     502                params: {url: middleSourceURL.toLowerCase(), shouldBlackbox: false},
     503            });
     504
     505            await evaluate(`Toggle_Outer(10)`);
     506
     507            ProtocolTest.newline();
     508
     509            await resumePromise;
     510        },
     511    });
     512
     513    suite.addTestCase({
    463514        name: "Debugger.setShouldBlackboxURL.Invalid.emptyURL",
    464515        description: "Check that an error is thrown if the given url is empty.",
  • trunk/Source/JavaScriptCore/ChangeLog

    r252728 r252730  
     12019-11-21  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: removing the blackbox for a specific script doesn't actually remove the blackbox
     4        https://bugs.webkit.org/show_bug.cgi?id=204428
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Previously, when updating the blackbox state of each existing script, we would only tell the
     9        `Debugger` about when scripts should be blackboxed, not when they shouldn't. This means that
     10        when a given script is un-blackboxed, the `Debugger` would never get told about it and would
     11        therefore still defer pauses as if it was blackboxed.
     12
     13        The solution to this is simple; update the blackboxed state of every script, not just those
     14        that should be blackboxed, and tell the `Debugger` about each.
     15
     16        * inspector/agents/InspectorDebuggerAgent.cpp:
     17        (Inspector::InspectorDebuggerAgent::setShouldBlackboxURL):
     18
    1192019-11-20  Yusuke Suzuki  <ysuzuki@apple.com>
    220
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp

    r251872 r252730  
    912912        m_blackboxedURLs.removeAll(config);
    913913
    914     auto blackboxType = shouldBlackbox ? Optional<JSC::Debugger::BlackboxType>(JSC::Debugger::BlackboxType::Deferred) : WTF::nullopt;
    915914    for (auto& [sourceID, script] : m_scripts) {
    916915        if (isWebKitInjectedScript(script.sourceURL))
    917916            continue;
    918         if (!shouldBlackboxURL(script.sourceURL) && !shouldBlackboxURL(script.url))
    919             continue;
     917
     918        Optional<JSC::Debugger::BlackboxType> blackboxType;
     919        if (shouldBlackboxURL(script.sourceURL) || shouldBlackboxURL(script.url))
     920            blackboxType = JSC::Debugger::BlackboxType::Deferred;
    920921        m_scriptDebugServer.setBlackboxType(sourceID, blackboxType);
    921922    }
Note: See TracChangeset for help on using the changeset viewer.