Closed Bug 363634 Opened 18 years ago Closed 17 years ago

Startup event for livemark feed parsing

Categories

(Firefox :: Bookmarks & History, defect, P2)

defect

Tracking

()

RESOLVED DUPLICATE of bug 382711
Firefox 3 beta3

People

(Reporter: sayrer, Assigned: florian)

References

(Depends on 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

Right now, the initial import of the "Latest Headline" feed will trigger a folder creation, but not populate it on startup (avoiding HTTP traffic during startup). Need to listen for an event to kick off refreshes.
Depends on: 358946
Blocks: 370099
rob, what is needed here? an event after startup is complete, saying that it's ok to kickoff HTTP traffic, instead of waiting on the livemark service timer?
(In reply to comment #1)
> rob, what is needed here? an event after startup is complete, saying that it's
> ok to kickoff HTTP traffic, instead of waiting on the livemark service timer?

Yeah, we want to kick off this traffic after the first window is up. I gather that "delayedStartup" is too soon.

OS: Mac OS X → All
Hardware: PC → All
No longer blocks: 370099
Flags: blocking-firefox3?
Flags: blocking-firefox3? → blocking-firefox3+
Due to the fix in bug 380999, the places import-to-folder tests now hit this bug.  They are commented out atm, will need to be re-enabled when this is fixed.
Target Milestone: --- → Firefox 3 alpha6
Assignee: nobody → swon
Can we load all the feeds when the folder is created?
Attached patch Proposing a patch (obsolete) — Splinter Review
When the first window is open, notifyObservers is called with "first-browser-window-after-show"... maybe a better naming?

Would there be a more efficient way to figure out how many windows are there without iterating through the nsIWindowMediator's enumerator?
Attachment #268302 - Flags: review?(dietrich)
Comment on attachment 268302 [details] [diff] [review]
Proposing a patch


>Index: browser/base/content/browser.js
>===================================================================
>RCS file: /cvsroot/mozilla/browser/base/content/browser.js,v
>retrieving revision 1.796
>diff -u -8 -p -r1.796 browser.js
>--- browser/base/content/browser.js	6 Jun 2007 20:17:26 -0000	1.796
>+++ browser/base/content/browser.js	14 Jun 2007 01:09:44 -0000
>@@ -1154,16 +1154,30 @@ function delayedStartup()
>       var ss = Cc["@mozilla.org/browser/sessionstore;1"].
>                getService(Ci.nsISessionStore);
>       ss.init(window);
>     } catch(ex) {
>       dump("nsSessionStore could not be initialized: " + ex + "\n");
>     }
>   }
> 
>+  // Checking to see if this is the first window loaded.
>+  var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
>+                     .getService(Components.interfaces.nsIWindowMediator);
>+  var enumerator = wm.getEnumerator(null);
>+  var i = 0;
>+  while (enumerator.hasMoreElements()) {
>+    i++;
>+    if (i>1)
>+	  break;
>+    enumerator.getNext();
>+  }
>+  if (i == 1)
>+    os.notifyObservers(null, "first-browser-window-after-show", "");
>+

you could probably simplify this to something like:

enumerator.getNext();
if (enumerator.hasMoreElements())
  os.notifyObservers(...);

>+  observe: function(aSubject, aTopic, aData) {
>+    switch (aTopic) {
>+      case "first-browser-window-after-show":
>+	    for (var i=0; i < this._livemarks.length; ++i) {
>+	      this._updateLivemarkChildren(i, false);
>+	    }
>+	    break;
>+    }
>+  },
>+  

the fix needs to *prevent* livemark updates from occurring before the first window comes up.
Attachment #268302 - Flags: review?(dietrich) → review-
Whiteboard: 2d
Whiteboard: 2d → [swag: 1d]
Attached patch Patch v2 (obsolete) — Splinter Review
In this patch, the observer for first-browser-window-after-show is removed when the event is caut, and timer for livemarks update is set here.
Attachment #268302 - Attachment is obsolete: true
Attachment #268393 - Flags: review?(dietrich)
Attached patch Spacing fixedSplinter Review
Spacing fixed
Attachment #268393 - Attachment is obsolete: true
Attachment #268394 - Flags: review?(dietrich)
Attachment #268393 - Flags: review?(dietrich)
Depends on: 364304
retargeting bugs that don't meet the alpha release-blocker criteria at http://wiki.mozilla.org/Firefox3/Schedule.
Target Milestone: Firefox 3 alpha6 → Firefox 3 beta1
Status: NEW → ASSIGNED
Attachment #268394 - Flags: review?(dietrich)
Depends on: 386605
I was talking to Gavin and he brought this up.
Mac can have the app open but the window closed. So closing + reopening a window will cause first-browser-window-after-show to be fired multiple times. Will that cause problems for anything?

As for the livemark feed parsing, the timer (which fires every 15 sec) to update the livemarks would be called every time... so one way would be to check if the timer has been initiated already whenever first-browser-window-after-show is caught?
I am interested in how the notification in the patch relates to the same problem in bug 364304 and bug 386605. The issue with this notification being a hack to get around Ts regressions also comes to mind.

Does livemark feed parsing need to wait for the window to show because of technical reasons?
bug 386605 also mentions the desire to make this notification originate from somewhere in toolkit and not browser.js as this is not only a browser issue.

Also, if the intent is to provide an event/notification that signals it is safe for services to do work without effecting Ts, "first-browser-window-after-show" should be changed to something else. How about "final-ui-ready" to match with "final-ui-startup" (fired right before the first window is shown)
(In reply to comment #12)
> I am interested in how the notification in the patch relates to the same
> problem in bug 364304 and bug 386605. The issue with this notification being a
> hack to get around Ts regressions also comes to mind.

Well, the other day I was accused of "covering up a leak" with a patch that freed memory. ;) 

Ts is how we measure responsiveness on startup for users. One way to improve this responsiveness  is to put off things that aren't essential until the first window is up. A bad hack would be a change that evades Ts, but still delays the first window.

> Does livemark feed parsing need to wait for the window to show because of
> technical reasons?

Yes, service instantiation is not free, and livemark HTTP traffic is not free. It is best to avoid doing this during startup. What this means is that there will be possibly stale RSS content in the live bookmark for a sec after startup. I think that's the right way to do it.

(In reply to comment #13)
> bug 386605 also mentions the desire to make this notification originate from
> somewhere in toolkit and not browser.js as this is not only a browser issue.
> 
So, should this bug wait on 386605? Or can this patch be a temporary solution until 386605 is resolved?

> Also, if the intent is to provide an event/notification that signals it is safe
> for services to do work without effecting Ts, "first-browser-window-after-show"
> should be changed to something else. How about "final-ui-ready" to match with
> "final-ui-startup" (fired right before the first window is shown)
> 

Sound good. I am bad at naming variables.
Whiteboard: [swag: 1d]
Target Milestone: Firefox 3 M7 → Firefox 3 M8
Is it possible to test something? We fire a notification ("final-ui-starup") here:
http://mxr.mozilla.org/seamonkey/source/toolkit/xre/nsAppRunner.cpp#3038

Why not fire a new notification ("final-ui-ready" for lack of a better name) here:
http://mxr.mozilla.org/seamonkey/source/toolkit/xre/nsAppRunner.cpp#3042

if that is too soon, keep pushing it further down XRE_main
Mark, I think what you are suggesting is what Bug 386605 is looking for.
Target Milestone: Firefox 3 M8 → Firefox 3 M9
Target Milestone: Firefox 3 M9 → Firefox 3 M10
Priority: -- → P3
Target Milestone: Firefox 3 M10 → Firefox 3 M11
Assignee: stevewon → florian
Status: ASSIGNED → NEW
Florian, you should be able, at the worst, to just kick off the livemark parsing from delayedStartup as in bug 384810...
Priority: P3 → P2
I think the original issue here was fixed another way in bug 382711. Can we WONTFIX this?
mconnor suggested I mark it as a dupe instead of WONTFIX'ing.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Bug 451915 - move Firefox/Places bugs to Firefox/Bookmarks and History. Remove all bugspam from this move by filtering for the string "places-to-b-and-h".

In Thunderbird 3.0b, you do that as follows:
Tools | Message Filters
Make sure the correct account is selected. Click "New"
Conditions: Body   contains   places-to-b-and-h
Change the action to "Delete Message".
Select "Manually Run" from the dropdown at the top.
Click OK.

Select the filter in the list, make sure "Inbox" is selected at the bottom, and click "Run Now". This should delete all the bugspam. You can then delete the filter.

Gerv
Component: Places → Bookmarks & History
QA Contact: places → bookmarks
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: