[Webkit-unassigned] [Bug 208420] New: Web Inspector: introduce a proxy-based protocol test harness

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Feb 29 16:41:40 PST 2020


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

            Bug ID: 208420
           Summary: Web Inspector: introduce a proxy-based protocol test
                    harness
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Inspector
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: pfeldman at chromium.org
                CC: inspector-bugzilla-changes at group.apple.com

Here is how it looks:

    const protocol = InspectorProtocol.protocol;

    // Setup interception.
    await Promise.all([protocol.Runtime.enable(), protocol.Network.enable()]);
    await protocol.Network.setInterceptionEnabled({ enabled: true });

    // Get URL to override and override it.
    const { result } = await protocol.Runtime.evaluate({ expression: "document.URL" });
    const url = result.value.substring(0, result.value.lastIndexOf("/")) + "/resources/data.json";
    await protocol.Network.addInterception({ url, stage: "response" });

    // Fetch URL and intercept it.
    protocol.Runtime.evaluate({ expression: "fetch('resources/data.json').then(r => r.text())"});
    const event = await protocol.Network.onceResponseIntercepted();
    ProtocolTest.pass("Intercepted response.");

    // // Let the load continue.
    await Promise.all([
        protocol.Network.onceResponseReceived(),
        protocol.Network.interceptContinue({ requestId: event.params.requestId })
    ]);
    ProtocolTest.pass("Response received.");

    await protocol.Network.removeInterception({ url, stage: "response" });

WDYT?

-- 
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/20200301/ca69d7cb/attachment.htm>


More information about the webkit-unassigned mailing list