Closed Bug 687696 Opened 13 years ago Closed 13 years ago

test_IHistory.cpp uses places without a profile

Categories

(Toolkit :: Places, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: espindola, Assigned: espindola)

References

Details

Attachments

(2 files, 1 obsolete file)

It looks like test_IHistory *has* a profile. The issues are * the shutdown messages not being sent * The bookmark, annotation and favicon services not being used by the test (they are lazily initiated).
Attached patch proposed patch (obsolete) (deleted) — Splinter Review
Attachment #561179 - Flags: review?(mak77)
(In reply to Rafael Ávila de Espíndola (:espindola) from comment #1) > * The bookmark, annotation and favicon services not being used by the test > (they are lazily initiated). Why should this matter?
Ah ok, I see, you just don't want to startup the services if they are not needed. that's ok. The shotdown observer should be moved to places_test_harness.h and places_test_harness_tail.h so that any newly added test will use it, I don't understand why it has to listen to both will-shutdown and shutdown, could't it just listen to xpcom-will-shutdown and notify both profile notifications with NotifyObservers? The order should be guarantee
(In reply to Marco Bonardo [:mak] from comment #3) > (In reply to Rafael Ávila de Espíndola (:espindola) from comment #1) > > * The bookmark, annotation and favicon services not being used by the test > > (they are lazily initiated). > > Why should this matter? The getter tries to start those during shutdown...
Attached patch new patch (deleted) — Splinter Review
Attachment #561179 - Attachment is obsolete: true
Attachment #561179 - Flags: review?(mak77)
Attachment #561195 - Flags: review?(mak77)
Comment on attachment 561195 [details] [diff] [review] new patch Review of attachment 561195 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/places/nsNavHistory.cpp @@ +5129,4 @@ > NS_ENSURE_SUCCESS(rv, rv); > > // nsNavBookmarks > + nsNavBookmarks *bookmarks = nsNavBookmarks::GetBookmarksServiceIfAvailable(); while here, please fix pointer style (correct is toward type) and remove these useless comments like // nsNavBookmarks, // nsAnnotationService, // nsFaviconService... they are just anticipating what is written on the immediately following line. ::: toolkit/components/places/tests/cpp/places_test_harness.h @@ +338,5 @@ > +class ShutdownObserver : public nsIObserver > +{ > +public: > + NS_DECL_ISUPPORTS > + ShutdownObserver() { newline between decl and between methods (also the other method below) pls brace on newline too @@ +340,5 @@ > +public: > + NS_DECL_ISUPPORTS > + ShutdownObserver() { > + nsCOMPtr<nsIObserverService> observerService = > + do_GetService(NS_OBSERVERSERVICE_CONTRACTID); nit: don't remember if in this specific harness we may use mozilla::services, it would be nice. @@ +350,5 @@ > + NS_IMETHOD Observe(nsISupports* aSubject, > + const char* aTopic, > + const PRUnichar* aData) > + { > + if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { I think it would be a bit more real if we listen to will-shutdown rather than shutdown (since ideally profile notifications are supposed to happen before) @@ +354,5 @@ > + if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { > + nsCOMPtr<nsIObserverService> os = > + do_GetService(NS_OBSERVERSERVICE_CONTRACTID); > + os->NotifyObservers(nsnull, TOPIC_PROFILE_TEARDOWN, nsnull); > + os->NotifyObservers(nsnull, TOPIC_PROFILE_CHANGE, nsnull); please cast to (void) if you don't care about result value, per our code style
Attachment #561195 - Flags: review?(mak77) → review+
Assignee: nobody → respindola
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Comment on attachment 561195 [details] [diff] [review] new patch >--- a/toolkit/components/places/tests/cpp/places_test_harness_tail.h >+++ b/toolkit/components/places/tests/cpp/places_test_harness_tail.h >@@ -115,6 +115,8 @@ main(int aArgc, > char** aArgv) > { > ScopedXPCOM xpcom(TEST_NAME); >+ nsCOMPtr<ShutdownObserver> shutdownObserver = new ShutdownObserver(); ShutdownObserver is not an interface, so nsCOMPtr<ShutdownObserver> is illegal.
(In reply to Ms2ger from comment #12) > ShutdownObserver is not an interface, so nsCOMPtr<ShutdownObserver> is > illegal. Right, actually it will work correctly but should be a nsRefPtr, thanks for pointing that out.
(In reply to Ed Morley [:edmorley] from comment #14) > Not sure if this or bug 683400 is responsible for the recent Ts regression: > > https://groups.google.com/forum/#!topic/mozilla.dev.tree-management/WOlX- > ghe0H4 > > http://graphs-new.mozilla.org/graph.html#tests=[[54,63,14],[54,63, > 15]]&sel=1316423909867.185,1316699577328&displayrange=7&datatype=running Or just the Talos downtime yesterday. this bug can t be responsible for any Talos change, it's a test-only fix.
ehr, nevermind, it modifies the shutdown process. But ideally can't make it slower since in the worst case is same as before.
Attached patch Use nsRefPtr (deleted) — Splinter Review
Attachment #561748 - Flags: review?(mak77)
Attachment #561748 - Flags: review?(mak77) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: