Closed Bug 1399696 Opened 4 years ago Closed 4 years ago

TypeError: header is null | contentSearchUI.js

Categories

(Firefox :: New Tab Page, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 57
Tracking Status
firefox57 --- fixed

People

(Reporter: tcampbell, Assigned: k88hudson)

References

Details

Attachments

(1 file)

In Nightly 20170913220121, I get TypeErrors when opening debug console on New Tab page.

STR:
  - Remove search from new tab page
  - Reload / Open a new new tab page
  - Open debug console

Expected:
  - Clean console

Actual:
  - TypeError: header is null | contentSearchUI.js:611:5 (_updateDefaultEngineHeader)
I can't seem to reproduce. I can set a breakpoint for when the search box is shown, but it never calls into contentSearchUI for me when I remove the search box.

If you turn on "Persist Logs", what do you see when reloading the page when you have search off? Should be one of

jar:file:…activity-stream@mozilla.org.xpi!/chrome/content/data/content/activity-stream-prerendered.html
jar:file:…activity-stream@mozilla.org.xpi!/chrome/content/data/content/activity-stream.html
I see: activity-stream@mozilla.org.xpi!/chrome/content/data/content/activity-stream-prerendered.html

My new tab page has everything disabled. I'm on Win10 64-bit FF. This only started after last nightly update within 24hr.
Ah, did you disable things through the in-content preferences? It should have toggled browser.newtabpage.activity-stream.prerender to false automatically, but maybe something is broken.
Correct. I'm using in-content prefs to toggle. It happens on Linux as well for me. If I add search, the error goes away, if I remove it comes back.

The browser.newtabpage.activity-stream.prerender is false in about:config and still uses prerended page.
Flags: needinfo?(khudson)
Ah, looks like the prerender pref isn't getting properly read at initialization in aboutNewTabService
Flags: needinfo?(khudson)
Attachment #8908632 - Flags: review?(edilee)
Comment on attachment 8908632 [details]
Bug 1399696 - aboutNewTabService should initialize with the correct _activityStreamPrerender value

https://reviewboard.mozilla.org/r/180300/#review185458

Maybe just initialize in the constructor just before calling `this.toggleActivityStream();` ?

::: browser/components/newtab/aboutNewTabService.js:139
(Diff revision 1)
>      if (stateEnabled) {
>        this._activityStreamEnabled = true;
>      } else {
>        this._activityStreamEnabled = false;
>      }
> +    this._activityStreamPrerender = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED);

The constructor does call `toggleActivityStream` but we should already be updating this state when the pref actually changes. Any reason not to just initialize correctly from the constructor?
Attachment #8908632 - Flags: review?(edilee) → review+
Assignee: nobody → khudson
Comment on attachment 8908632 [details]
Bug 1399696 - aboutNewTabService should initialize with the correct _activityStreamPrerender value

https://reviewboard.mozilla.org/r/180300/#review185458

> The constructor does call `toggleActivityStream` but we should already be updating this state when the pref actually changes. Any reason not to just initialize correctly from the constructor?

The pref can start off being different on browser initialization (i.e. from previous changes to the pref), which will never trigger the observer
Comment on attachment 8908632 [details]
Bug 1399696 - aboutNewTabService should initialize with the correct _activityStreamPrerender value

https://reviewboard.mozilla.org/r/180300/#review185458

To be honest I think specifically initializing values in the constructor would make more sense than adding to toggleActivityStream, but I didn't want to do any refactoring considering we're pretty close to the cut-off
Pushed by khudson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2ad95439eef6
aboutNewTabService should initialize with the correct _activityStreamPrerender value r=Mardak
https://hg.mozilla.org/mozilla-central/rev/2ad95439eef6
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 57
Duplicate of this bug: 1400082
Blocks: 1394533
Blocks: 1371920
Component: Activity Streams: Newtab → New Tab Page
You need to log in before you can comment on or make changes to this bug.