Open Bug 1935175 Opened 2 months ago Updated 1 month ago

JS Tracer - Top level js calls don't get a JS Frame

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: fkilic, Assigned: alexical)

References

Details

Attachments

(2 files)

Thank you for helping make Firefox better. If you are reporting a defect, please complete the following:

What were you doing?

This is a follow-up to a discussion on Matrix.

I was profiling (here's the profile) my website, and noticed top-level JS calls (e.g. fetch calls in the profile linked) don't get their own JS frames.

I'm trying to automate Firefox to gather JS APIs websites use here, and I use JS frames to associate (DOM) Something.Something entries in the profile to their scripts and pages, but it seems top-level JS calls don't get a JS frame and are children of root directly.

Please tell us what site you were on, and what steps led to the error you are reporting

  1. Change profiler config to: Threads="GeckoMain", Features="JavaScript, No Periodic Sampling, JS Execution Tracing"
  2. Visit my website
  3. Start profiler
  4. Refresh page
  5. Stop/Capture profiler/profile

What happened?

fetch calls didn't get a JS frame in the call stack

What should have happened?

Some call stack similar to the one in DevTools > Network (for example, it shows <anonymous> https://fklc.dev/:1:18883)

Anything else we should know?

The following is the code that runs on my page. From the profile, it looks like anything that has a some sort of scope gets their JS frame (i.e. the calls in fetch's then has (root scope) JS frame), and top-level calls (fetchs in this case) don't.

function renderRepo(t) {
  return `
<a href="${ t.html_url }" target="_blank" rel="noopener">
<section>
<div class="section_title">${ t.name }</div>
<div class="about_section">
<span>${ t.description }</span>
</div>
<div class="bottom_section">
<span style="display:inline-block;"><i class="fa-code"></i> ${ t.language }</span>
<span><i class="fa-star"></i> ${ t.stargazers_count }</span>
<span><i class="fa-code-branch"></i> ${ t.forks }</span>
</div>
</section>
</a>`
}
const username = 'FKLC';
fetch('https://api.github.com/users/FKLC').then((t => t.json())).then(
  (
    t => {
      document.title = t.name,
      document.querySelector('meta[name=\'description\']').setAttribute('content', t.bio),
      document.querySelector('link[rel=\'shortcut icon\']').setAttribute('href', t.avatar_url),
      document.getElementById('profile_img').style = `background: url(${ t.avatar_url }) center;`,
      document.getElementById('username').innerHTML = `<span style="display:block;">${ t.name }</span>@${ t.login }`,
      document.getElementById('userbio').innerHTML = t.bio,
      document.getElementById('about').innerHTML = [
        t.company &&
        `<span><i class="fa-users"></i> ${ t.company }</span>`,
        t.email &&
        `<span><i class="fa-envelope"></i> ${ t.email }</span>`,
        t.blog &&
        `<span><i class="fa-link"></i> ${ t.blog }</span>`,
        t.location &&
        `<span><i class="fa-map-marker"></i> ${ t.location }</span>`,
        t.hireable &&
        '<span><i class="fa-user-tie"></i> Available for hire</span>'
      ].join('')
    }
  )
),
fetch(
  'https://api.github.com/search/repositories?q=user:FKLC fork:false&sort=stars'
).then((t => t.json())).then(
  (
    t => {
      const e = [];
      for (let n of t.items) e.push(renderRepo(n));
      document.getElementById('work_section').innerHTML = e.join('')
    }
  )
);

Do you have extensions installed? You can also go to about:support in another window or tab and attach the report it generates to this bug.

No, I was using yesterday's (3 Dec 2024) mozilla-central build around 9:30, on macos, with a clean profile.

Alex, any idea what might be happening here?

Flags: needinfo?(dothayer)

I think I just initially excluded these to narrow down what I had to cover
in my initial implementation, but it seems like we can fairly trivially
include non-function frames.

Assignee: nobody → dothayer
Status: NEW → ASSIGNED

This is basically just adjustint to a few changes on the spidermonkey side
which allow us to include non-function frames in the trace.

Flags: needinfo?(dothayer)

The severity field is not set for this bug.
:bomsy, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(hmanilla)

Making this a P2 since its been worked on

Severity: -- → S3
Flags: needinfo?(hmanilla)
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: