Closed Bug 1420285 Opened 7 years ago Closed 6 years ago

Change <browser> attribute isPreloadBrowser to preloadedState

Categories

(Firefox :: New Tab Page, defect, P1)

57 Branch
defect

Tracking

()

RESOLVED FIXED
Firefox 59
Iteration:
59.4 - Jan 15
Tracking Status
firefox57 --- wontfix
firefox58 --- wontfix
firefox59 --- fixed

People

(Reporter: ursula, Assigned: ursula)

References

Details

Attachments

(2 files)

In order for Activity Stream to update the preloaded page to fix ticket: https://github.com/mozilla/activity-stream/issues/3331 , we first want to allow the RemotePageManager to know which message port belongs to the preloaded browser so we can directly target that one.

As discussed with :mconley, the approach we decided to take is to change the browser's attribute "isPreloadBrowser" to instead be something along the lines of "preloadedState" where the preloaded browser will have a "preloaded" state that will change to "consumed" once we use it for the newtab and then finally be removed altogether when we navigate away. That way the RemotePageManager can just check if the browser has the correct preloaded state and pass that info to Activity Stream.
Alternatively, from a xul:browser, one could check if its gBrowser ancestor has _preloadedBrowser pointing at it.
Blocks: 1421437
Status: NEW → ASSIGNED
Iteration: --- → 1.25
Priority: -- → P1
Blocks: 1415491
Iteration: 1.25 → 1.26
Summary: Allow RemotePageManager to know which message port is the preloaded browser → Change <browser> attribute isPreloadBrowser to preloadedState
Comment on attachment 8939927 [details]
Bug 1420285 - Change <browser> attribute isPreloadBrowser to preloadedState

https://reviewboard.mozilla.org/r/209984/#review215952

Works for me, thanks! Just a few small notes below.

::: browser/base/content/tabbrowser.xml:2254
(Diff revision 1)
> +             *   3. When we then navigate away from the new tab, the 'preloadedState'
> +             *      attribute is removed from the browser altogether and the
> +             *      process starts over again for the next preloaded browser

It's also possible to have multiple browsers in the "preloadedState" == "consumed" state though, right?

Perhaps instead of saying here in point 3 that the process starts over again, perhaps we should say that "consumed" browsers will attempt to switch to a new content process when navigating away from about:newtab.

::: dom/base/test/browser_aboutnewtab_process_selection.js:93
(Diff revision 1)
> +  let preloadedTabState = gBrowser._preloadedBrowser.getAttribute("preloadedState");
> +  is(preloadedTabState, PRELOADED_STATE, "The preloaded browser has the correct attribute");

We might want to check for preloadedState to be PRELOADED_STATE on the first preloaded tab before it gets consumed too.

::: dom/base/test/browser_aboutnewtab_process_selection.js:99
(Diff revision 1)
> +  is(preloadedTabState, PRELOADED_STATE, "The preloaded browser has the correct attribute");
> +
> +  // Navigate away and check that the attribute has been removed altogether
> +  gBrowser.selectedBrowser.loadURI(TEST_URL);
> +  let navigatedTabHasState = gBrowser.selectedBrowser.hasAttribute("preloadedState");
> +  is(navigatedTabHasState, false, "Correctly removed the preloadState attribute when navigating away");

I think it's more idiomatic in our testing code to do something like:

```js
ok(!navigatedTabHasState, "Correctly removed the preloadState attribute when navigating away");
```
Attachment #8939927 - Flags: review?(mconley) → review+
Pushed by usarracini@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b30d693096e3
Change <browser> attribute isPreloadBrowser to preloadedState r=mconley
https://hg.mozilla.org/mozilla-central/rev/b30d693096e3
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
Commits pushed to master at https://github.com/mozilla/activity-stream

https://github.com/mozilla/activity-stream/commit/4453f5de2aeaa9c350cc50064a5694664cb41a70
chore(telemetry): Backport Bug 1420285 - Changes to TelemetryFeed for preloaded sessions

https://github.com/mozilla/activity-stream/commit/595beeebe6882d0d3989b12230616ee62e3130b6
Merge pull request #3919 from sarracini/gh3916

chore(telemetry): Backport Bug 1420285 - Changes to TelemetryFeed for preloaded sessions
Iteration: 1.26 → 59.4 - Jan 15
Component: Activity Streams: Newtab → New Tab Page
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: