简体   繁体   中英

Xdebug dont stop if used from web-worker?

Is it possible that Xdebug doesn't stop in breakpoints if requests started from inside a web-worker? I'm doing a fetch() request.

fetch(datatable_instance_defaults.pathToSqlFile + 'returnSqlRes.php',
    {
        headers: {
            'Accept': 'text/plain',
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        method: "post",
        body: JSON.stringify(sql)
    })
    .then(function (res) {
        return res.json();
    })

Since the web-worker API has no access to the session storage according to the DedicatedWorkerGlobalScope your Xdebug session cookie can not be passed along to the server, thus it does not recognize your open Xdebug session from the main thread.

You could temporarily add the XDEBUG_SESSION_START GET parameter to your URL to start a new Xdebug session. (see the documentation of xdebug, too)

fetch(datatable_instance_defaults.pathToSqlFile + 'returnSqlRes.php?XDEBUG_SESSION_START=session_name',

It is a little inconvenient to do it this way, but I imagine that the plugin developers need to figure out a way to keep the Xdebug session or restart it for service-worker requests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM