Closed Bug 1177296 Opened 9 years ago Closed 6 years ago

Wrong performance.marks placements?

Categories

(Firefox OS Graveyard :: Gaia::Settings, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: zbraniecki, Unassigned)

Details

Settings is the only app we have that has contentInteractive fired before navigationLoaded[0].

According to the spec[1] contentInteractive should happen when content is visible (so after visuallyLoaded) and visuallyLoaded should happen after navigation is both loaded and interactive. 


[0] http://raptor.mozilla.org/#/dashboard/script/apps.js?device=flame-kk&branch=master&memory=319&series=coldlaunch.*&panelId=11&fullscreen
[1] https://developer.mozilla.org/en-US/Apps/Build/Performance/Firefox_OS_app_responsiveness_guidelines
Eli, can you confirm that?
Flags: needinfo?(eperelman)
So thinking about this, I think Gandalf is correct about how the markers should work, but I can't say I know enough about the Settings app startup flow to know if the events are in the correct place or not. Regardless, I think you've raised a good point about the definition of contentInteractive. With the current definition...

> Emit this marker when your application designates that it has bound the events for the minimum set of functionality to allow the user to interact with the "above-the-fold" content made available at visuallyLoaded.

...it is entirely possible for contentInteractive to fire before visuallyLoaded as we don't make the distinction in the definition itself that the user actually *can* interact with these elements. For example:

```
<section hidden class="above-the-fold"></section>

var section = document.querySelector('section');

section.addEventListener('click', () => navigate());
performance.mark('contentInteractive');

section.removeAttribute('hidden');
performance.mark('visuallyLoaded');
```

I don't think this should be allowed. We should modify the definition to make it clear that contentInteractive should not be fired until the user has the ability to interact with the elements made available in visuallyLoaded. That would then make the above example code into this:

```
var section = document.querySelector('section');

section.addEventListener('click', () => navigate());
section.removeAttribute('hidden');

performance.mark('contentInteractive');
performance.mark('visuallyLoaded');
```

I'd venture to say though that you can still fire contentInteractive before visuallyLoaded as the order isn't dependent, but there should not be a gap between them if that is the case. Probably easier to understand if visuallyLoaded is fired first. :)
Flags: needinfo?(eperelman)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.