Closed Bug 260865 Opened 20 years ago Closed 20 years ago

Remove nsIAlertListener

Categories

(SeaMonkey :: General, defect)

x86
All
defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: csthomas, Assigned: csthomas)

References

()

Details

Attachments

(1 file, 3 obsolete files)

do you want to fix other issues in this interface? things that come to mind:
<biesi> 1. can the listener be null
<biesi> 2. can I put up an alert when a previous one is up
<biesi> 3. what happens if I try 2

comments should use doxygen-style

unless there's some real reason for the listener interface, i'd rather it just
use nsIObserver

"put up" should be "post" or something...
"has gone away" should probably be "goes away" or something...
Summary: grammar fix → Remove nsIAlertListener
Attachment #159635 - Attachment is obsolete: true
Attached patch Patch (obsolete) — Splinter Review
Doesn't touch toolkit.	I'll do that in a separate patch.
Attachment #163060 - Flags: superreview?(jag)
Attachment #163060 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #163060 - Flags: superreview?(jag) → superreview?(dmose)
Status: NEW → ASSIGNED
I'll take a look at this later. My first nit to pick would be that I think we
usually define uuids in IDL in all uppercase.
Comment on attachment 163060 [details] [diff] [review]
Patch

>-[scriptable, uuid(7E8B76C6-A70C-4075-81AA-D48B6152E1B4)]
>+[scriptable, uuid(3a3c2953-01ee-4d9c-a102-5aa0d7bd444c)]
Good catch, jag!

>+   gAlertListener = window.arguments[5].QueryInterface(Components.interfaces.nsIObserver);
Nit: This QI shouldn't be necessary because the argument was stored in an
interface pointer which will tell the window watcher what type it is.

>@@ -978,18 +978,24 @@ nsDownload::Observe(nsISupports* aSubjec
>     nsCAutoString path;
>     nsresult rv = GetFilePathUTF8(mTarget, path);
>     // XXX why can't nsDownload cancel itself without help from the dl manager?
>     if (NS_SUCCEEDED(rv))
>       mDownloadManager->CancelDownload(path);
>     // Ignoring return value; this function will get called twice,
>     // and bad things happen if we return a failure code the second time.
>   }
> 
>+  if (strcmp(aTopic, "alertclickcallback") == 0) {
>+    // show the download manager
>+    mDownloadManager->Open(nsnull, this);
>+    return NS_OK;
>+  }
else if? (also in nsMessengerWinIntegration.cpp)
Attached patch Revised patch (obsolete) — Splinter Review
(In reply to comment #6)
> (From update of attachment 163060 [details] [diff] [review])
> >-[scriptable, uuid(7E8B76C6-A70C-4075-81AA-D48B6152E1B4)]
> >+[scriptable, uuid(3a3c2953-01ee-4d9c-a102-5aa0d7bd444c)]
> Good catch, jag!
Fixed

> >+   gAlertListener =
window.arguments[5].QueryInterface(Components.interfaces.nsIObserver);
> Nit: This QI shouldn't be necessary because the argument was stored in an
> interface pointer which will tell the window watcher what type it is.
I removed the if.  Since we no longer do a QI, if the argument is null, there's
no problem.

> 
> >@@ -978,18 +978,24 @@ nsDownload::Observe(nsISupports* aSubjec
> >	nsCAutoString path;
> >	nsresult rv = GetFilePathUTF8(mTarget, path);
> >	// XXX why can't nsDownload cancel itself without help from the dl
manager?
> >	if (NS_SUCCEEDED(rv))
> >	  mDownloadManager->CancelDownload(path);
> >	// Ignoring return value; this function will get called twice,
> >	// and bad things happen if we return a failure code the second time.
> >   }
> > 
> >+  if (strcmp(aTopic, "alertclickcallback") == 0) {
> >+	// show the download manager
> >+	mDownloadManager->Open(nsnull, this);
> >+	return NS_OK;
> >+  }
> else if? (also in nsMessengerWinIntegration.cpp)

All the ifs return (I added a return statement to the if that was missing one),
and the old code didn't use else if.
Attachment #163060 - Attachment is obsolete: true
Attachment #163060 - Flags: superreview?(dmose)
Attachment #163060 - Flags: superreview?
Attachment #163060 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #163060 - Flags: review?
Attachment #163232 - Flags: superreview?(dmose)
Attachment #163232 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 163232 [details] [diff] [review]
Revised patch

This looks ok to me. It'd be mighty nice if you could kill those (pre-existing)
tabs in nsIAlertsService.idl while you're poking around in there, and realign
the arguments on the third and fourth line of showAlertNotification.

No need for a new patch for that.

r=jag, requesting sr= from Neil
Attachment #163232 - Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #163232 - Flags: superreview?(dmose)
Attachment #163232 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #163232 - Flags: review+
Comment on attachment 163232 [details] [diff] [review]
Revised patch

>       mDownloadManager->CancelDownload(path);
>     // Ignoring return value; this function will get called twice,
>     // and bad things happen if we return a failure code the second time.
>+
>+    return NS_OK;
Kill that blank line, as the comment refers to the return NS_OK.

I crashed this several times during testing before discovering that the
parameters to showAlertNotification aren't null-checked :-( Someone should
convert the w?strings to AStrings...
Attachment #163232 - Flags: superreview?(neil.parkwaycc.co.uk) → superreview+
Attached patch to check inSplinter Review
Attachment #163232 - Attachment is obsolete: true
could you file a new bug about comment 2?
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: